database

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDBError

func BuildDBError(err error, methodName string) error

Types

type Attribute

type Attribute struct {
	*Repository
}

func NewAttribute

func NewAttribute() *Attribute

NewAttribute

func (*Attribute) BuildConditionParams

func (repo *Attribute) BuildConditionParams(q *model.AttributeQuery) (condition string, params []interface{})

func (*Attribute) FindAll

func (repo *Attribute) FindAll() ([]model.Attribute, error)

FindAll

func (*Attribute) FindAllFull

func (repo *Attribute) FindAllFull() ([]model.Attribute, error)

FindAll

func (*Attribute) FindAllFullByEntity

func (repo *Attribute) FindAllFullByEntity(q *model.AttributeQuery, entityID int) ([]model.Attribute, error)

FindAllFullByEntity

func (*Attribute) FindByID

func (repo *Attribute) FindByID(id int) (model.Attribute, error)

FindByID

func (*Attribute) FindFullByID

func (repo *Attribute) FindFullByID(id int) (model.Attribute, error)

FindFullByID

type Base

type Base interface {
	GetID() int
	SetCurrentTimeUpdatedAt()
	SetID(int)
}

type Entity

type Entity struct {
	*Repository
}

func NewEntity

func NewEntity() *Entity

func (*Entity) BuildConditionParams

func (repo *Entity) BuildConditionParams(q *model.EntityQuery) (condition string, params []interface{})

BuildConditionParams build condition deleted_at is NULL

func (*Entity) FindAll

func (repo *Entity) FindAll() ([]model.Entity, error)

FindAll

func (*Entity) FindAllFull

func (repo *Entity) FindAllFull(q *model.EntityQuery) ([]model.Entity, error)

FindAllFull

func (*Entity) FindBaseByIDs

func (repo *Entity) FindBaseByIDs(m interface{}, ids []int) error

func (*Entity) FindByID

func (repo *Entity) FindByID(id int) (model.Entity, error)

FindByID

func (*Entity) FindFullByID

func (repo *Entity) FindFullByID(id int) (model.Entity, error)

FindFullByID

type Repository

type Repository struct {
	*SQLHandler
}

func New

func New() *Repository

func (*Repository) Delete

func (repo *Repository) Delete(m Base) error

Delete

func (*Repository) FindAllWithPreload

func (repo *Repository) FindAllWithPreload(attribute interface{}) error

FindAll

func (*Repository) FindBaseByID

func (repo *Repository) FindBaseByID(m interface{}, id int) error

FindBaseByID

func (*Repository) GetOffsetLimit

func (repo *Repository) GetOffsetLimit(page int, pageSize int) (offset int, limit int)

GetOffset

func (*Repository) Store

func (repo *Repository) Store(m Base) (int, error)

Store

func (*Repository) Update

func (repo *Repository) Update(m Base) (int, error)

Update

type SQLHandler

type SQLHandler struct {
	// contains filtered or unexported fields
}

func NewSQLHandler

func NewSQLHandler() *SQLHandler

func (*SQLHandler) Find

func (h *SQLHandler) Find(attribute interface{}) error

func (*SQLHandler) FindAllByConditionWithPreload

func (h *SQLHandler) FindAllByConditionWithPreload(attribute interface{}, c string, p []interface{}, offset int, limit int) error

func (*SQLHandler) FindAllWithPreloadAndJoin

func (h *SQLHandler) FindAllWithPreloadAndJoin(attribute interface{}, c string, p []interface{}, offset int, limit int, joins string) error

func (*SQLHandler) FindByAttribute

func (h *SQLHandler) FindByAttribute(m interface{}, q interface{}) error

func (*SQLHandler) FindByConditionWithPreload

func (h *SQLHandler) FindByConditionWithPreload(attribute interface{}, c string, p []interface{}) error

FindByConditionWithPreload with preload

func (*SQLHandler) FindWithPreload

func (h *SQLHandler) FindWithPreload(attribute interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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