Documentation ¶
Index ¶
- Constants
- func ApplyCount[T Model](db *gorm.DB, q *query.Query) *gorm.DB
- func ApplyQuery[T Model](db *gorm.DB, q *query.Query) *gorm.DB
- func Close(db *gorm.DB) error
- func Connect(conn Connection) (*gorm.DB, error)
- func FromContext(ctx context.Context) *gorm.DB
- func NewAutoPreload() gorm.Plugin
- func TableName(db *gorm.DB, model any) string
- func ToContext(ctx context.Context, db *gorm.DB) context.Context
- func Transaction(ctx context.Context, f func(ctx context.Context) error) (err error)
- type AutoPreload
- type Connection
- type Crud
- type CrudRepository
- func (r CrudRepository[M]) Create(ctx context.Context, model *M) error
- func (r CrudRepository[M]) Delete(ctx context.Context, model *M) error
- func (r CrudRepository[M]) DeleteByPK(ctx context.Context, pk ...any) error
- func (r CrudRepository[M]) List(ctx context.Context, qe query.Encode) ([]*M, int64, error)
- func (r CrudRepository[M]) ReturnByPK(ctx context.Context, qe query.Encode, pk ...any) (*M, error)
- func (r CrudRepository[M]) Save(ctx context.Context, model *M) error
- func (r CrudRepository[M]) Update(ctx context.Context, model *M) error
- type IncrementalModel
- type Jsonb
- type Logger
- func (l *Logger) Error(ctx context.Context, s string, args ...any)
- func (l *Logger) Info(ctx context.Context, s string, args ...any)
- func (l *Logger) LogMode(gormlogger.LogLevel) gormlogger.Interface
- func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l *Logger) Warn(ctx context.Context, s string, args ...any)
- type Model
- type NullTime
- type Point
- type Search
- type Tabler
- type UniversalModel
Constants ¶
View Source
const (
Name = "gorm"
)
Variables ¶
This section is empty.
Functions ¶
func NewAutoPreload ¶
Types ¶
type AutoPreload ¶
type AutoPreload struct { }
func (AutoPreload) Initialize ¶
func (p AutoPreload) Initialize(db *gorm.DB) error
func (AutoPreload) Name ¶
func (p AutoPreload) Name() string
type Connection ¶
type Crud ¶
type Crud[M Model] interface { Create(ctx context.Context, model *M) error ReturnByPK(ctx context.Context, qs query.Encode, pk ...any) (*M, error) Update(ctx context.Context, model *M) error Save(ctx context.Context, model *M) error List(ctx context.Context, qs query.Encode) ([]*M, int64, error) DeleteByPK(ctx context.Context, pk ...any) error Delete(ctx context.Context, model *M) error }
type CrudRepository ¶
type CrudRepository[M Model] struct { }
func NewCrudRepository ¶
func NewCrudRepository[M Model]() *CrudRepository[M]
func (CrudRepository[M]) Create ¶
func (r CrudRepository[M]) Create(ctx context.Context, model *M) error
func (CrudRepository[M]) Delete ¶
func (r CrudRepository[M]) Delete(ctx context.Context, model *M) error
func (CrudRepository[M]) DeleteByPK ¶
func (r CrudRepository[M]) DeleteByPK(ctx context.Context, pk ...any) error
func (CrudRepository[M]) ReturnByPK ¶
type IncrementalModel ¶
type IncrementalModel struct {
ID uint32 `gorm:"primaryKey"`
}
func (IncrementalModel) PrimaryKeys ¶
func (m IncrementalModel) PrimaryKeys() []string
type Logger ¶
type Logger struct{}
func (*Logger) LogMode ¶
func (l *Logger) LogMode(gormlogger.LogLevel) gormlogger.Interface
type Point ¶
type UniversalModel ¶
func (UniversalModel) PrimaryKeys ¶
func (m UniversalModel) PrimaryKeys() []string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.