tag

package
v0.0.0-...-187a358 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("can not find tag in store")
View Source
var ErrTagAlreadyExists = errors.New("tag already exists")

Functions

This section is empty.

Types

type MockRepository

type MockRepository struct {
	mock.Mock
}

mockery --name=Repository --filename=repository_mock.go --output=./ --structname=MockRepository --inpackage MockRepository is an autogenerated mock type for the Repository type

func NewMockRepository

func NewMockRepository(t mockConstructorTestingTNewMockRepository) *MockRepository

NewMockRepository creates a new instance of MockRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockRepository) AllExist

func (_m *MockRepository) AllExist(ids []string, authorID string) (bool, error)

AllExist provides a mock function with given fields: ids, authorID

func (*MockRepository) Create

func (_m *MockRepository) Create(tag *Tag) error

Create provides a mock function with given fields: tag

func (*MockRepository) Delete

func (_m *MockRepository) Delete(id string, authorID string) error

Delete provides a mock function with given fields: id, authorID

func (*MockRepository) DeleteByAuthorID

func (_m *MockRepository) DeleteByAuthorID(authorID string) (int, error)

DeleteByAuthorID provides a mock function with given fields: authorID

func (*MockRepository) Get

func (_m *MockRepository) Get(id string, authorID string) (*Tag, error)

Get provides a mock function with given fields: id, authorID

func (*MockRepository) Update

func (_m *MockRepository) Update(tag *Tag) error

Update provides a mock function with given fields: tag

type Repository

type Repository interface {
	Create(tag *Tag) error                 // Create returns ErrTagAlreadyExists if record for pair name-authorID already exists
	Update(tag *Tag) error                 // Update returns ErrTagAlreadyExists if record for pair name-authorID already exists
	Get(id, authorID string) (*Tag, error) // Get provide tag by id and authorID, return ErrNotFound when tag not exist
	Delete(id, authorID string) error
	AllExist(ids []string, authorID string) (bool, error)
	DeleteByAuthorID(authorID string) (int, error)
}

type Tag

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

func NewTag

func NewTag(name, authorID string) (*Tag, error)

func UnmarshalFromDB

func UnmarshalFromDB(
	id string,
	tag string,
	authorID string,
) *Tag

func (*Tag) ApplyChanges

func (t *Tag) ApplyChanges(tag string) error

func (*Tag) AuthorID

func (t *Tag) AuthorID() string

func (*Tag) ID

func (t *Tag) ID() string

func (*Tag) ToMap

func (t *Tag) ToMap() map[string]interface{}

Jump to

Keyboard shortcuts

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