tags

package
v0.0.0-...-9831a62 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = fmt.Errorf("not found")
	ErrAlreadyExists = fmt.Errorf("tag already exists")
)

Known errors.

Functions

This section is empty.

Types

type Service

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

Service allows to manage tags resource.

func NewService

func NewService(db *sql.DB) *Service

NewService returns new tags service.

func (*Service) Create

func (s *Service) Create(ctx context.Context, userID string, title string) (*Tag, error)

Create creates a tag.

func (*Service) GetByTitle

func (s *Service) GetByTitle(ctx context.Context, userID string, title string) (*Tag, error)

GetByTitle returns a tag by it's id.

func (*Service) List

func (s *Service) List(ctx context.Context, userID string, pageSize int, createdLT *time.Time) ([]*Tag, error)

List returns a list of user tags.

type Tag

type Tag struct {
	ID      string    `json:"id"`
	UserID  string    `json:"-"`
	Title   string    `json:"title"`
	Created time.Time `json:"created"`
}

Tag is the tag model.

Jump to

Keyboard shortcuts

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