tags

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTagNotFound = errors.New("tag not found")

Functions

This section is empty.

Types

type APIRouter

type APIRouter struct {
	Control *Control
}

func (*APIRouter) RegisterRoutes

func (rt *APIRouter) RegisterRoutes(mux *chi.Mux)

type Control

type Control struct {
	Algorithm string
	DB        *database.Database
	TagRepo   TagRepo
}

func (*Control) CreateIfNotExists

func (c *Control) CreateIfNotExists(ctx context.Context, tag string) (*Tag, error)

func (*Control) Delete

func (c *Control) Delete(ctx context.Context, exec bob.Executor, tag string) error

func (*Control) GetNext

func (c *Control) GetNext(ctx context.Context) (string, error)

func (*Control) MarkTagUnused

func (c *Control) MarkTagUnused(ctx context.Context, exec bob.Executor, tag string) error

type ListTagsPageViewModel

type ListTagsPageViewModel struct {
	Page  *TagListPage
	Query ListTagsQuery
}

type ListTagsQuery

type ListTagsQuery struct {
	Search   string
	InUse    *bool
	Page     int
	PageSize int
	OrderBy  string
	OrderDir string
}

type RepoSQLite

type RepoSQLite struct{}

func (*RepoSQLite) Create

func (*RepoSQLite) Create(ctx context.Context, exec bob.Executor, tag *Tag) (*Tag, error)

func (*RepoSQLite) Delete

func (*RepoSQLite) Delete(ctx context.Context, exec bob.Executor, tag string) error

func (*RepoSQLite) Get

func (*RepoSQLite) Get(ctx context.Context, exec bob.Executor, tag string) (*Tag, error)

func (*RepoSQLite) GetUnused

func (*RepoSQLite) GetUnused(ctx context.Context, exec bob.Executor) (*Tag, error)

func (*RepoSQLite) List

func (*RepoSQLite) List(ctx context.Context, exec bob.Executor, query ListTagsQuery) (*TagListPage, error)

func (*RepoSQLite) MarkTagUnused

func (*RepoSQLite) MarkTagUnused(ctx context.Context, exec bob.Executor, tag string) error

func (*RepoSQLite) MarkTagUsed

func (*RepoSQLite) MarkTagUsed(ctx context.Context, exec bob.Executor, tag string) error

func (*RepoSQLite) NextSequential

func (*RepoSQLite) NextSequential(ctx context.Context, exec bob.Executor) (int64, error)

type Tag

type Tag struct {
	ID        int64
	Tag       string
	InUse     bool
	CreatedAt time.Time
	UpdatedAt time.Time
}

type TagListPage

type TagListPage struct {
	Tags     []*Tag
	Total    int
	NumPages int
	Page     int
	PageSize int
}

type TagRepo

type TagRepo interface {
	List(ctx context.Context, exec bob.Executor, query ListTagsQuery) (*TagListPage, error)
	GetUnused(ctx context.Context, exec bob.Executor) (*Tag, error)
	Get(ctx context.Context, exec bob.Executor, tag string) (*Tag, error)
	NextSequential(ctx context.Context, exec bob.Executor) (int64, error)
	Create(ctx context.Context, exec bob.Executor, tag *Tag) (*Tag, error)
	MarkTagUsed(ctx context.Context, exec bob.Executor, tag string) error
	MarkTagUnused(ctx context.Context, exec bob.Executor, tag string) error
	Delete(ctx context.Context, exec bob.Executor, tag string) error
}

type UIRouter

type UIRouter struct {
	Control *Control
}

func (*UIRouter) RegisterRoutes

func (rt *UIRouter) RegisterRoutes(mux *chi.Mux)

Jump to

Keyboard shortcuts

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