repo

package
v0.0.0-...-ff237a8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generepo

type Generepo[T types.Modeler] struct {
	// contains filtered or unexported fields
}

func (*Generepo[T]) Archive

func (g *Generepo[T]) Archive(entity *T) error

func (*Generepo[T]) Connection

func (g *Generepo[T]) Connection(tx *gorm.DB, tableName string, filters []types.FilterInput, sortBy string, direction types.AscOrDesc, limit int, after int) ([]*T, *types.PageInfo, error)

func (*Generepo[T]) Create

func (g *Generepo[T]) Create(entity *T) (*T, error)

func (*Generepo[T]) Delete

func (g *Generepo[T]) Delete(entity *T) error

func (*Generepo[T]) FindBy

func (g *Generepo[T]) FindBy(filters []types.Filter, preloads ...string) (*T, error)

uses = to return a single *T

func (*Generepo[T]) FuzzyFindBy

func (g *Generepo[T]) FuzzyFindBy(key string, value any) ([]*T, error)

uses ILIKE to return an array of *T

func (*Generepo[T]) ListBy

func (g *Generepo[T]) ListBy(filters []types.Filter, preloads ...string) ([]*T, error)

uses = to return an array of *T

func (*Generepo[T]) Update

func (g *Generepo[T]) Update(entity *T) (*T, error)

type Repository

type Repository struct {
	User  types.IGenericRepo[types.User]
	Apple types.IGenericRepo[types.Apple]
	DB    *gorm.DB
}

func Init

func Init() (*Repository, error)

func NewRepository

func NewRepository(db *gorm.DB) *Repository

Jump to

Keyboard shortcuts

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