api_entity

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 2 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 GormFilter

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

type GormRepository added in v0.0.8

type GormRepository[T RepositoryItem] interface {
	New() T
	NewSlice() []T

	Conn() *gorm.DB
	Select(query interface{}, args ...interface{}) *gorm.DB // table name added to select

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

	Create(T) (T, error)
	Update(T) (bool, error)
	Delete(T) (bool, error)
}

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 RepositoryEntity added in v0.0.17

type RepositoryEntity interface {
	IsFilterable(field string) bool
}

type RepositoryItem added in v0.0.8

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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