Documentation ¶
Index ¶
- Variables
- type DB
- func (db *DB) AutoMigrate(dst ...any) *DB
- func (db *DB) Base(dest any, conds ...any) *DB
- func (db *DB) Close() error
- func (db *DB) Error() error
- func (db *DB) First(x any, conds ...any) bool
- func (db *DB) FirstOrCreate(first, create func(), x any, conds ...any)
- func (db *DB) NoRecord() bool
- func (db *DB) Preload(t any, conds ...any) *DB
- func (db *DB) Preloads(t any, conds ...any) *DB
- func (db *DB) Select(dest any, fields []string, conds ...any) *DB
- func (db *DB) SetDB(r *gorm.DB) *DB
- func (db *DB) SetDialector(dialector gorm.Dialector) *DB
- func (db *DB) SetSqlite(file string) *DB
- type Model
- type NoCopy
Constants ¶
This section is empty.
Variables ¶
View Source
var Ref = Reflect.New[[]string](func(self *Reflect.Reflect[[]string], field reflect.StructField, elem reflect.Type) []string { if _, ok := elem.FieldByName(field.Name + "ID"); !ok { return []string{} } preloads := make([][]string, 0) if !self.GetType(field.Type, &preloads) { return []string{} } r := make([]string, 0) for _, preload := range preloads { for _, s := range preload { r = append(r, fmt.Sprintf("%v.%v", field.Name, s)) } } if len(r) == 0 { return []string{field.Name} } return r }, func(r *Reflect.Reflect[[]string]) { r.Alias = func(elem reflect.Type) []uintptr { return []uintptr{ Reflect.Addr(elem), Reflect.Addr(reflect.SliceOf(elem)), Reflect.Addr(reflect.SliceOf(reflect.PtrTo(elem))), } } })
Functions ¶
This section is empty.
Types ¶
type DB ¶
func (*DB) AutoMigrate ¶ added in v0.11.4
func (*DB) FirstOrCreate ¶
Click to show internal directories.
Click to hide internal directories.