Documentation
¶
Index ¶
- Constants
- type GenericRepository
- type Gorm
- type GormRepository
- func (g *GormRepository[Model]) Count(options ...query.Option) (count int64, err error)
- func (g *GormRepository[Model]) Create(data *Model) error
- func (g *GormRepository[Model]) Delete(options ...query.Option) error
- func (g *GormRepository[Model]) FindFirst(options ...query.Option) (data Model, found bool, err error)
- func (g *GormRepository[Model]) List(offset, limit int64, options ...query.Option) (model.PaginationResult[Model], error)
- func (g *GormRepository[Model]) Setup() error
- func (g *GormRepository[Model]) Update(updates map[string]interface{}, options ...query.Option) error
- type ORM
Constants ¶
View Source
const Lens scene.CompositionName = "orm"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenericRepository ¶ added in v0.2.8
type GenericRepository[Model any] interface { Create(data *Model) error Update(updates map[string]interface{}, options ...query.Option) error Delete(options ...query.Option) error FindFirst(options ...query.Option) (data Model, found bool, err error) Count(options ...query.Option) (count int64, err error) List(offset, limit int64, options ...query.Option) (model.PaginationResult[Model], error) }
type GormRepository ¶ added in v0.2.8
type GormRepository[Model any] struct { // contains filtered or unexported fields }
func NewGormRepository ¶ added in v0.2.8
func NewGormRepository[Model any]( db Gorm, fieldMapper query.FieldMapper) *GormRepository[Model]
func (*GormRepository[Model]) Count ¶ added in v0.2.8
func (g *GormRepository[Model]) Count(options ...query.Option) (count int64, err error)
func (*GormRepository[Model]) Create ¶ added in v0.2.8
func (g *GormRepository[Model]) Create(data *Model) error
func (*GormRepository[Model]) Delete ¶ added in v0.2.8
func (g *GormRepository[Model]) Delete(options ...query.Option) error
func (*GormRepository[Model]) FindFirst ¶ added in v0.2.8
func (g *GormRepository[Model]) FindFirst(options ...query.Option) (data Model, found bool, err error)
func (*GormRepository[Model]) List ¶ added in v0.2.8
func (g *GormRepository[Model]) List(offset, limit int64, options ...query.Option) (model.PaginationResult[Model], error)
func (*GormRepository[Model]) Setup ¶ added in v0.2.8
func (g *GormRepository[Model]) Setup() error
Click to show internal directories.
Click to hide internal directories.