Documentation ¶
Index ¶
- Constants
- func ApplyCount[T any](db *gorm.DB, q query.Query) *gorm.DB
- func ApplyQuery[T any](db *gorm.DB, q query.Query) *gorm.DB
- func Close(db *gorm.DB) error
- func Connect(conn Connection) (*gorm.DB, error)
- func DIMiddleware(db *gorm.DB) mux.MiddlewareFunc
- func NewLogger() *logger
- func TableName(db *gorm.DB, model any) string
- func Transaction(ctx context.Context, f func(ctx context.Context) error) (err error)
- func UnaryDIInterceptor(db *gorm.DB) grpc.UnaryServerInterceptor
- type Connection
- type Crud
- type CrudRepository
- func (r CrudRepository[M, K]) Create(ctx context.Context, model *M) error
- func (r CrudRepository[M, K]) DB(ctx context.Context) *gorm.DB
- func (r CrudRepository[M, K]) Delete(ctx context.Context, model *M) error
- func (r CrudRepository[M, K]) DeleteByID(ctx context.Context, id K) error
- func (r CrudRepository[M, K]) List(ctx context.Context, qe query.Encode) ([]*M, int64, error)
- func (r CrudRepository[M, K]) ReturnByID(ctx context.Context, id K, qe query.Encode) (*M, error)
- func (r CrudRepository[M, K]) Save(ctx context.Context, model *M) error
- func (r CrudRepository[M, K]) Update(ctx context.Context, model *M) error
- type Identity
- type IncrementalModel
- type Jsonb
- type Point
- type Search
- type Tabler
- type UniversalModel
Constants ¶
View Source
const (
Name = "gorm"
)
Variables ¶
This section is empty.
Functions ¶
func DIMiddleware ¶ added in v1.3.0
func DIMiddleware(db *gorm.DB) mux.MiddlewareFunc
func Transaction ¶ added in v1.2.1
func UnaryDIInterceptor ¶
func UnaryDIInterceptor(db *gorm.DB) grpc.UnaryServerInterceptor
Types ¶
type Connection ¶
type Crud ¶
type Crud[M Identity[K], K any] interface { Create(ctx context.Context, model *M) error ReturnByID(ctx context.Context, id K, qs query.Encode) (*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) DeleteByID(ctx context.Context, id K) error Delete(ctx context.Context, model *M) error }
type CrudRepository ¶
func NewCrudRepository ¶
func NewCrudRepository[M Identity[K], K any]() *CrudRepository[M, K]
func (CrudRepository[M, K]) Create ¶
func (r CrudRepository[M, K]) Create(ctx context.Context, model *M) error
func (CrudRepository[M, K]) Delete ¶
func (r CrudRepository[M, K]) Delete(ctx context.Context, model *M) error
func (CrudRepository[M, K]) DeleteByID ¶
func (r CrudRepository[M, K]) DeleteByID(ctx context.Context, id K) error
func (CrudRepository[M, K]) ReturnByID ¶
type IncrementalModel ¶
type IncrementalModel struct {
ID uint32
}
func (IncrementalModel) GetID ¶
func (m IncrementalModel) GetID() uint32
type Point ¶
type UniversalModel ¶
func (UniversalModel) GetID ¶
func (m UniversalModel) GetID() uuid.UUID
Source Files ¶
Click to show internal directories.
Click to hide internal directories.