repositories

package
v0.0.0-...-09d31aa Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: ISC Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPosition = errors.New("position is out of bounds")

ErrInvalidPosition is returned when the log post is attempted moved outside of the range.

View Source
var ErrNotFound = errors.New("resource not found")

ErrNotFound should be returned instead of any database-specific not found error.

View Source
var ErrParentMismatch = errors.New("parent resource is not the same for the entire list")

ErrParentMismatch is returned if the list refer to different parent objects when it shouldn't.

View Source
var ErrTagDoesNotExist = errors.New("tag already exists")

ErrTagDoesNotExist is returned if a non-existing tag is attempted removed.

View Source
var ErrTagExists = errors.New("tag already exists")

ErrTagExists is returned if an existing tag is added again.

Functions

This section is empty.

Types

type ChangeRepository

type ChangeRepository interface {
	Find(ctx context.Context, id string) (*models.Change, error)
	List(ctx context.Context, filter models.ChangeFilter) ([]*models.Change, error)
	Insert(ctx context.Context, change models.Change) (*models.Change, error)
	Remove(ctx context.Context, change models.Change) error
}

type ChannelRepository

type ChannelRepository interface {
	Find(ctx context.Context, name string) (*models.Channel, error)
	List(ctx context.Context, filter models.ChannelFilter) ([]*models.Channel, error)
	Insert(ctx context.Context, channel models.Channel) (*models.Channel, error)
	Update(ctx context.Context, channel models.Channel, update models.ChannelUpdate) (*models.Channel, error)
	Remove(ctx context.Context, channel models.Channel) error
}

ChannelRepository is an interface for a database using channels.

type ChapterRepository

type ChapterRepository interface {
	Find(ctx context.Context, id string) (*models.Chapter, error)
	List(ctx context.Context, filter models.ChapterFilter) ([]*models.Chapter, error)
	Insert(ctx context.Context, chapter models.Chapter) (*models.Chapter, error)
	Update(ctx context.Context, chapter models.Chapter, update models.ChapterUpdate) (*models.Chapter, error)
	Move(ctx context.Context, chapter models.Chapter, from, to models.Story) (*models.Chapter, error)
	Delete(ctx context.Context, chapter models.Chapter) error
}

type CharacterRepository

type CharacterRepository interface {
	Find(ctx context.Context, id string) (*models.Character, error)
	FindNick(ctx context.Context, nick string) (*models.Character, error)
	FindName(ctx context.Context, name string) (*models.Character, error)
	List(ctx context.Context, filter models.CharacterFilter) ([]*models.Character, error)
	Insert(ctx context.Context, character models.Character) (*models.Character, error)
	Update(ctx context.Context, character models.Character, update models.CharacterUpdate) (*models.Character, error)
	AddNick(ctx context.Context, character models.Character, nick string) (*models.Character, error)
	RemoveNick(ctx context.Context, character models.Character, nick string) (*models.Character, error)
	Delete(ctx context.Context, character models.Character) error
}

CharacterRepository is an interface for a database using characters.

type CommentRepository

type CommentRepository interface {
	Find(ctx context.Context, id string) (*models.Comment, error)
	List(ctx context.Context, filter models.CommentFilter) ([]*models.Comment, error)
	Insert(ctx context.Context, comment models.Comment) (*models.Comment, error)
	Update(ctx context.Context, comment models.Comment, update models.CommentUpdate) (*models.Comment, error)
	Delete(ctx context.Context, comment models.Comment) error
}

type FileRepository

type FileRepository interface {
	Find(ctx context.Context, id string) (*models.File, error)
	List(ctx context.Context, filter models.FileFilter) ([]*models.File, error)
	Insert(ctx context.Context, file models.File) (*models.File, error)
	Update(ctx context.Context, file models.File, update models.FileUpdate) (*models.File, error)
	Delete(ctx context.Context, file models.File) error
}

FileRepository is an interface for database operations relating to file metadata.

type KeyRepository

type KeyRepository interface {
	Find(ctx context.Context, id string) (*models.Key, error)
	List(ctx context.Context, filter models.KeyFilter) ([]*models.Key, error)
	Insert(ctx context.Context, key models.Key) (*models.Key, error)
	Delete(ctx context.Context, key models.Key) error
}

type LogRepository

type LogRepository interface {
	Find(ctx context.Context, id string) (*models.Log, error)
	List(ctx context.Context, filter models.LogFilter) ([]*models.Log, error)
	Insert(ctx context.Context, log models.Log) (*models.Log, error)
	Update(ctx context.Context, log models.Log, update models.LogUpdate) (*models.Log, error)
	Delete(ctx context.Context, log models.Log) error
}

type PostRepository

type PostRepository interface {
	Find(ctx context.Context, id string) (*models.Post, error)
	List(ctx context.Context, filter models.PostFilter) ([]*models.Post, error)
	Insert(ctx context.Context, post models.Post) (*models.Post, error)
	InsertMany(ctx context.Context, posts ...*models.Post) ([]*models.Post, error)
	Update(ctx context.Context, post models.Post, update models.PostUpdate) (*models.Post, error)
	Move(ctx context.Context, post models.Post, position int) ([]*models.Post, error)
	Delete(ctx context.Context, post models.Post) error
}

type StoryRepository

type StoryRepository interface {
	Find(ctx context.Context, id string) (*models.Story, error)
	List(ctx context.Context, filter models.StoryFilter) ([]*models.Story, error)
	Insert(ctx context.Context, story models.Story) (*models.Story, error)
	Update(ctx context.Context, story models.Story, update models.StoryUpdate) (*models.Story, error)
	AddTag(ctx context.Context, story models.Story, tag models.Tag) error
	RemoveTag(ctx context.Context, story models.Story, tag models.Tag) error
	Delete(ctx context.Context, story models.Story) error
}

type TagRepository

type TagRepository interface {
	Find(ctx context.Context, kind models.TagKind, name string) (*models.Tag, error)
	List(ctx context.Context, filter models.TagFilter) ([]*models.Tag, error)
}

TagRepository is an interface for a database using logs.

type UserRepository

type UserRepository interface {
	Find(ctx context.Context, id string) (*models.User, error)
	List(ctx context.Context) ([]*models.User, error)
	Insert(ctx context.Context, user models.User) (*models.User, error)
}

Jump to

Keyboard shortcuts

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