orm

package
v0.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

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 Gorm

type Gorm interface {
	ORM
	query.QueryBuilder[*gorm.DB]
	DB() *gorm.DB
	RegisterModel(model ...any) 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

func (*GormRepository[Model]) Update added in v0.2.8

func (g *GormRepository[Model]) Update(updates map[string]interface{}, options ...query.Option) error

type ORM

type ORM interface {
	OrmName() scene.ImplName
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL