persistence

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(config Configuration) *sqlx.DB

func NewSessionStore

func NewSessionStore(db *sqlx.DB) session.SessionStore

Types

type Configuration

type Configuration struct {
	Driver     string `configName:"dbdriver"`
	Connection string `configName:"dbconn"`
}

type Findable

type Findable[ENTITY any, FILTER any] struct {
	SQLDao
	// contains filtered or unexported fields
}

func NewFindable

func NewFindable[ENTITY any, FILTER any](
	db *sqlx.DB,
	buildFindSql func(filter *FILTER, params map[string]interface{}) string,
	buildOrderBySql func() string,
	elementsPerPage int) Findable[ENTITY, FILTER]

func NewFindableDefault

func NewFindableDefault[ENTITY any, FILTER any](
	db *sqlx.DB,
	buildFindSql func(filter *FILTER, params map[string]interface{}) string,
	buildOrderBySql func() string) Findable[ENTITY, FILTER]

func (Findable[ENTITY, FILTER]) Find

func (repo Findable[ENTITY, FILTER]) Find(filter *FILTER, pag *pagination.Pagination) (pagination.List[ENTITY], error)

type SQLDao

type SQLDao struct {
	DB *sqlx.DB
}

func NewDao

func NewDao(db *sqlx.DB) SQLDao

func (SQLDao) BeginOrFatal

func (repo SQLDao) BeginOrFatal() *sqlx.Tx

type SQLSessionStore

type SQLSessionStore struct {
	SQLDao
}

func (SQLSessionStore) Delete

func (store SQLSessionStore) Delete(id session.Id)

func (SQLSessionStore) Get

func (store SQLSessionStore) Get(id session.Id) (session.Entry, error)

func (SQLSessionStore) Save

func (store SQLSessionStore) Save(entry session.Entry)

Jump to

Keyboard shortcuts

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