persist/test/basic/main.go

54 lines
909 B
Go
Raw Normal View History

2018-08-03 15:08:30 -04:00
package main
//go:generate pgen
import (
"fmt"
"go/token"
"gitlab.wow.st/gmp/persist"
)
func main() {
persist.Init()
2018-08-03 15:08:30 -04:00
x := persistInt("x",5)
fmt.Println(x)
fmt.Println(x.Get())
x.Set(3)
fmt.Println(x)
2018-08-03 15:08:30 -04:00
var y1 mine1 = 6
y2 := mine2{}
y1p := persistM1("y1",y1)
y1 = y1p.Get()
y2p := persistM2("y2",y2)
y2 = y2p.Get()
2018-08-03 15:08:30 -04:00
y3 := token.FileSet{}
y3p := persistM3("y3",y3)
y3 = y3p.Get()
2018-08-03 15:08:30 -04:00
y4 := make(map[*token.FileSet]*token.File)
y4p := persistM4("y4",y4)
y4 = y4p.Get()
2018-08-03 15:08:30 -04:00
y5 := make(map[*token.FileSet]*persist.Var)
y5p := persistM5("y5",y5)
y5 = y5p.Get()
2018-08-03 15:08:30 -04:00
y6 := make(map[persist.Var]token.FileSet)
y6p := persistM6("y6",y6)
y6 = y6p.Get()
2018-08-03 15:08:30 -04:00
z := func(interface{}) {
_ = persistFloat("y7",1.0)
2018-08-03 15:08:30 -04:00
}
z(persistString("z","ok"))
2018-08-03 15:08:30 -04:00
s := persistString("s","ok bye")
fmt.Println(s)
s.Set("one two")
var ts string
ts = s.Get() // this works
_ = ts
persist.Commit()
persist.Shutdown()
2018-08-03 15:08:30 -04:00
}