core

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GormTransactional

type GormTransactional interface {
	Transactional[gorm.DB]
}

GormTransactional represent the interface of a Transactional gorm.DB

type OrmQuery

type OrmQuery interface {
	Query(args ...any) OrmQueryFunc
}

type OrmQueryFunc

type OrmQueryFunc = func(*gorm.DB) *gorm.DB

type OrmRepository

type OrmRepository[T any, K comparable] struct {
	Repository
	// contains filtered or unexported fields
}

func (*OrmRepository[T, ID]) Delete

func (this *OrmRepository[T, ID]) Delete(object *T) Error

func (*OrmRepository[T, ID]) DeleteById

func (this *OrmRepository[T, ID]) DeleteById(id ID) Error

func (*OrmRepository[T, ID]) FindById

func (this *OrmRepository[T, ID]) FindById(id ID) Optional[*T]

func (*OrmRepository[T, ID]) PostConstruct

func (this *OrmRepository[T, ID]) PostConstruct(parent any) Error

func (*OrmRepository[T, ID]) Query

func (this *OrmRepository[T, ID]) Query(queries ...OrmQueryFunc) *gorm.DB

func (*OrmRepository[T, ID]) Save

func (this *OrmRepository[T, ID]) Save(object *T) (*T, Error)

func (*OrmRepository[T, ID]) SaveAll

func (this *OrmRepository[T, ID]) SaveAll(objects []*T) ([]*T, Error)

type OrmRepositoryInterface

type OrmRepositoryInterface[T any, K comparable] interface {
	// Query() lets you execute queries on <T>, calling gorm Model() *gorm.DB first.
	Query(queries ...OrmQueryFunc) *gorm.DB
	// FindById() lets you find an optional model pointer by its Id or type <ID>.
	FindById(id K) Optional[*T]
	// Delete() lets you delete a model <T> pointer, previously returned.
	Delete(object *T) Error
	// DeleteById() lets you delete a model using its id of type <ID>.
	DeleteById(id K) Error
	// Save() saves a model <T> pointer, returning the pointer and/or an Error.
	Save(object *T) (*T, Error)
	// SaveAll saves a slice of <T> pointers, returning it and/or an Error.
	SaveAll(object []*T) ([]*T, Error)
}

Jump to

Keyboard shortcuts

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