* fix: composite map assign * reword comment Co-authored-by: Marc Vertes <mvertes@free.fr>
27 lines
285 B
Go
27 lines
285 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
type Item struct {
|
|
Object interface{}
|
|
Expiry time.Duration
|
|
}
|
|
|
|
func main() {
|
|
items := map[string]Item{}
|
|
|
|
items["test"] = Item{
|
|
Object: "test",
|
|
Expiry: time.Second,
|
|
}
|
|
|
|
item := items["test"]
|
|
fmt.Println(item)
|
|
}
|
|
|
|
// Output:
|
|
// {test 1s}
|