persist/cmd/pgen/template.go

37 lines
712 B
Go

package main
const template string = `//Generated by gitlab.wow.st/persist/cmd/pgen.
//Do not edit
package main
import (
"encoding/gob"
"time"
"unsafe"
"gitlab.wow.st/gmp/persist"
)
type Var_N persist.Var
func New(name string, x _T, opt ...persist.Option) *Var_N {
gob.Register(x)
ptr := persist.New(name, x, opt...)
ret := (*Var_N)(unsafe.Pointer(ptr))
return ret
}
func (v *Var_N) Set(x _T) error {
ptr := (*persist.Var)(unsafe.Pointer(v))
return ptr.Set(x)
}
func (v *Var_N) Get(ts ...time.Time) _T {
ptr := (*persist.Var)(unsafe.Pointer(v))
return ptr.Get(ts...).(_T)
}
func (v *Var_N) History() ([]persist.TVar, error) {
ptr := (*persist.Var)(unsafe.Pointer(v))
return ptr.History()
}
`