56 lines
996 B
Go
56 lines
996 B
Go
package main
|
|
//go:generate pgen
|
|
|
|
import (
|
|
"fmt"
|
|
gtoken "go/token"
|
|
"gitlab.wow.st/gmp/persist"
|
|
)
|
|
|
|
func main() {
|
|
persist.Init()
|
|
|
|
x := persistInt("x",5)
|
|
fmt.Println(x)
|
|
fmt.Println(x.Get())
|
|
x.Set(3)
|
|
fmt.Println(x)
|
|
|
|
var y1 mine1 = 6
|
|
y2 := mine2{}
|
|
y1p := persistM1("y1",y1)
|
|
y1 = y1p.Get() // confirm types match
|
|
y2p := persistM2("y2",y2)
|
|
y2 = y2p.Get()
|
|
y3 := gtoken.FileSet{}
|
|
y3p := persistM3("y3",y3)
|
|
y3 = y3p.Get()
|
|
y4 := make(map[*gtoken.FileSet]*gtoken.File)
|
|
y4p := persistM4("y4",y4)
|
|
y4 = y4p.Get()
|
|
y5 := make(map[*gtoken.FileSet]*persist.Var)
|
|
y5p := persistM5("y5",y5)
|
|
y5 = y5p.Get()
|
|
y6 := make(map[persist.Var]gtoken.FileSet)
|
|
y6p := persistM6("y6",y6)
|
|
y6 = y6p.Get()
|
|
y7p := persistIntArray("y7",[]int{1,2,3})
|
|
_ = y7p
|
|
|
|
z := func(interface{}) {
|
|
_ = persistFloat("y7",1.0)
|
|
}
|
|
z(persistString("z","ok"))
|
|
|
|
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()
|
|
}
|
|
|