category

package
v0.0.0-...-3bb7120 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	ID       int32
	Category string
	Handle   string
	ParentID *int32
}

type CreateChildCategoryIfNotExistsRow

type CreateChildCategoryIfNotExistsRow struct {
	ID       int32
	Category string
	Handle   string
	ParentID *int32
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type GetCategoryRow

type GetCategoryRow struct {
	ID             int32
	Category       string
	Handle         string
	ParentID       *int32
	IsLeafCategory bool
}

type GetCategoryWithAncestorsRow

type GetCategoryWithAncestorsRow struct {
	ID       int32
	Category string
	Handle   string
	ParentID *int32
	Level    int32
}

type Querier

type Querier interface {
	CreateChildCategoryIfNotExists(ctx context.Context, category string, handle string, parentID *int32) (*CreateChildCategoryIfNotExistsRow, error)
	CreateTopCategory(ctx context.Context, category string, handle string) (*Category, error)
	GetCategory(ctx context.Context, id int32) (*GetCategoryRow, error)
	GetCategoryByName(ctx context.Context, category string) (*Category, error)
	GetCategoryWithAncestors(ctx context.Context, id int32) ([]*GetCategoryWithAncestorsRow, error)
	GetCategoryWithSiblings(ctx context.Context, id int32) ([]*Category, error)
	GetChildCategories(ctx context.Context, parentID *int32) ([]*Category, error)
	GetLeafCategoryIDs(ctx context.Context, id int32) ([][]int32, error)
	GetRootCategories(ctx context.Context) ([]*Category, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateChildCategoryIfNotExists

func (q *Queries) CreateChildCategoryIfNotExists(ctx context.Context, category string, handle string, parentID *int32) (*CreateChildCategoryIfNotExistsRow, error)

func (*Queries) CreateTopCategory

func (q *Queries) CreateTopCategory(ctx context.Context, category string, handle string) (*Category, error)

func (*Queries) GetCategory

func (q *Queries) GetCategory(ctx context.Context, id int32) (*GetCategoryRow, error)

func (*Queries) GetCategoryByName

func (q *Queries) GetCategoryByName(ctx context.Context, category string) (*Category, error)

func (*Queries) GetCategoryWithAncestors

func (q *Queries) GetCategoryWithAncestors(ctx context.Context, id int32) ([]*GetCategoryWithAncestorsRow, error)

func (*Queries) GetCategoryWithSiblings

func (q *Queries) GetCategoryWithSiblings(ctx context.Context, id int32) ([]*Category, error)

func (*Queries) GetChildCategories

func (q *Queries) GetChildCategories(ctx context.Context, parentID *int32) ([]*Category, error)

func (*Queries) GetLeafCategoryIDs

func (q *Queries) GetLeafCategoryIDs(ctx context.Context, id int32) ([][]int32, error)

func (*Queries) GetRootCategories

func (q *Queries) GetRootCategories(ctx context.Context) ([]*Category, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type Repository

type Repository interface {
	Querier
}

func NewRepository

func NewRepository(db *pgxpool.Pool) Repository

Jump to

Keyboard shortcuts

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