api_entity

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConvertToModel added in v0.0.8

type ConvertToModel[T any] interface {
	ToModel() T
}

type Creator added in v0.0.32

type Creator[T Entity] interface {
	Create(T) (T, error)
}

type Entity added in v0.0.32

type Entity interface {
	schema.Tabler
	GetID() int64
}

type FilterType

type FilterType string

type GormFilter

type GormFilter interface {
	Condition() string
	Values() []interface{}
	ApplyTo(c *gorm.DB) *gorm.DB
}

type HasRepository added in v0.0.32

type HasRepository[T Entity] interface {
	NewRepository() Repository[T]
}

type Initializable added in v0.0.32

type Initializable[T Entity] interface {
	New() T
	NewSlice() []T
}

type NotFilterableError added in v0.0.10

type NotFilterableError struct {
	Field string
}

func (NotFilterableError) Error added in v0.0.10

func (e NotFilterableError) Error() string

type Raw added in v0.0.32

type Raw string

func (Raw) ApplyTo added in v0.0.32

func (r Raw) ApplyTo(c *gorm.DB) *gorm.DB

func (Raw) Condition added in v0.0.32

func (r Raw) Condition() string

func (Raw) Values added in v0.0.32

func (r Raw) Values() []interface{}

type Remover added in v0.0.32

type Remover[T Entity] interface {
	Delete(T) (bool, error)
}

type Repository added in v0.0.32

type Repository[T Entity] interface {
	Conn() *gorm.DB
	Select(query interface{}, args ...interface{}) *gorm.DB // table name added to select

	Filter(filters ...GormFilter) *gorm.DB
	GetByID(id int64) (T, error)
	GetByIDs(ids ...int64) ([]T, error)
	GetOne(filters ...GormFilter) (T, error)
	GetResults(filters ...GormFilter) ([]T, error)
}

type Updater added in v0.0.32

type Updater[T Entity] interface {
	Update(T) (bool, error)
}

type Where added in v0.0.32

type Where []any

func (Where) ApplyTo added in v0.0.32

func (w Where) ApplyTo(c *gorm.DB) *gorm.DB

func (Where) Condition added in v0.0.32

func (w Where) Condition() string

func (Where) Values added in v0.0.32

func (w Where) Values() []any

Jump to

Keyboard shortcuts

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