pg

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithTx

func WithTx(ctx context.Context, tx *sql.Tx) context.Context

Types

type AdminRepository

type AdminRepository struct {
	Repository[model.Admin, int64]
}

func NewAdminRepository

func NewAdminRepository(db *sql.DB) *AdminRepository

func (*AdminRepository) FindByEmail

func (r *AdminRepository) FindByEmail(ctx context.Context, email string) (model.Admin, error)

type ConfigurationRepository

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

func NewConfigurationRepository

func NewConfigurationRepository(db *sql.DB) *ConfigurationRepository

func (*ConfigurationRepository) Load

func (*ConfigurationRepository) Save

type MenuRepository struct {
	Repository[model.Menu, int64]
}

func NewMenuRepository

func NewMenuRepository(db *sql.DB) *MenuRepository
func (r *MenuRepository) Create(ctx context.Context, m *model.Menu) error
func (r *MenuRepository) FindByHandle(ctx context.Context, handle string) (model.Menu, error)
func (r *MenuRepository) Update(ctx context.Context, m *model.Menu) error

type Metas

type Metas []model.Meta

func NewMetas

func NewMetas(metas []model.Meta) Metas

func (*Metas) Scan

func (m *Metas) Scan(src any) error

func (*Metas) Value

func (m *Metas) Value() (driver.Value, error)

type NodeRepository

type NodeRepository struct {
	Repository[model.Node, int64]
	// contains filtered or unexported fields
}

func NewNodeRepository

func NewNodeRepository(db *sql.DB) *NodeRepository

func (*NodeRepository) Create

func (r *NodeRepository) Create(ctx context.Context, m *model.Node) error

func (*NodeRepository) Delete

func (r *NodeRepository) Delete(ctx context.Context, ids ...int64) error

func (*NodeRepository) FindWithChildren

func (r *NodeRepository) FindWithChildren(ctx context.Context, id int64) ([]model.Node, error)

func (*NodeRepository) Update

func (r *NodeRepository) Update(ctx context.Context, m *model.Node) error

type OTP

type OTP model.OTP

func (*OTP) Scan

func (otp *OTP) Scan(src any) error

func (*OTP) Value

func (otp *OTP) Value() (driver.Value, error)

type PageRepository

type PageRepository struct {
	Repository[model.Page, int64]
}

func NewPageRepository

func NewPageRepository(db *sql.DB) *PageRepository

func (*PageRepository) Create

func (r *PageRepository) Create(ctx context.Context, m *model.Page) error

func (*PageRepository) FindByAlias

func (r *PageRepository) FindByAlias(ctx context.Context, siteID int64, alias string, now time.Time) (model.Page, error)

func (*PageRepository) FindByParentID

func (r *PageRepository) FindByParentID(ctx context.Context, parentID int64, now time.Time) ([]model.Page, error)

func (*PageRepository) FindByPattern

func (r *PageRepository) FindByPattern(ctx context.Context, siteID int64, pattern string, now time.Time) (model.Page, error)

func (*PageRepository) FindByURL

func (r *PageRepository) FindByURL(ctx context.Context, siteID int64, url string, now time.Time) (model.Page, error)

func (*PageRepository) Update

func (r *PageRepository) Update(ctx context.Context, m *model.Page) error

type Password

type Password model.Password

func (*Password) Scan

func (p *Password) Scan(src any) error

func (*Password) Value

func (p *Password) Value() (driver.Value, error)

type Repository

type Repository[T interface{ GetID() ID }, ID any] struct {
	DB            *sql.DB
	Table         string
	SelectColumns []string
	RowScan       func(interface{ Scan(dest ...any) error }, *T) error
	InsertValues  func(*T) map[string]any
	UpdateValues  func(*T) map[string]any
	OnError       func(error) error
}

func (Repository[T, ID]) Create

func (r Repository[T, ID]) Create(ctx context.Context, m *T) error

func (Repository[T, ID]) Delete

func (r Repository[T, ID]) Delete(ctx context.Context, ids ...ID) error

func (Repository[T, ID]) Find

func (r Repository[T, ID]) Find(ctx context.Context, criteria *cr.Criteria) ([]T, error)

func (Repository[T, ID]) FindAndCount

func (r Repository[T, ID]) FindAndCount(ctx context.Context, criteria *cr.Criteria) ([]T, int, error)

func (Repository[T, ID]) FindBy

func (r Repository[T, ID]) FindBy(ctx context.Context, column string, value any) (m T, err error)

func (Repository[T, ID]) FindByID

func (r Repository[T, ID]) FindByID(ctx context.Context, id ID) (T, error)

func (Repository[T, ID]) Update

func (r Repository[T, ID]) Update(ctx context.Context, m *T) error

type Roles

type Roles []string

func NewRoles

func NewRoles(roles []string) Roles

func (*Roles) Scan

func (r *Roles) Scan(src any) error

func (*Roles) Value

func (r *Roles) Value() (driver.Value, error)

type SiteRepository

type SiteRepository struct {
	Repository[model.Site, int64]
}

func NewSiteRepository

func NewSiteRepository(db *sql.DB) *SiteRepository

func (*SiteRepository) FindByHosts

func (r *SiteRepository) FindByHosts(ctx context.Context, hosts []string, now time.Time) ([]model.Site, error)

type StrMap

type StrMap map[string]string

func NewStrMap

func NewStrMap(strMap map[string]string) StrMap

func (*StrMap) Scan

func (m *StrMap) Scan(src any) error

func (*StrMap) Value

func (m *StrMap) Value() (driver.Value, error)

type TemplateRepository

type TemplateRepository struct {
	Repository[model.Template, int64]
}

func NewTemplateRepository

func NewTemplateRepository(db *sql.DB) *TemplateRepository

func (*TemplateRepository) FindByName

func (r *TemplateRepository) FindByName(ctx context.Context, name string) (model.Template, error)

Jump to

Keyboard shortcuts

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