type User struct { Id string `gorm:"primarykey"` Name string CreatedAt time.Time `gorm:"index"` }
db.AutoMigrate(&User{})
db.Create(&User{ Name: "u1", Id: uuid.NewV4().String(), CreatedAt: baseTime.Add(4 * time.Hour), })
type Page struct { driver.Executor PageInfo cursorFunc func(i int64) (string, error) } 结构体里放函数
cursorFunc: func(i int64) (string, error) { rc, err := dp.Cursor(i) if err != nil { return "", err } m, err := p.CursorMarshaller.Marshal(rc) if err != nil { return "", err } return string(m), nil } 函数返回值
字节转 []byte 转 字符串 string(byte)