repo

package
v0.0.0-...-e33bd30 Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RecordNotFoundError

type RecordNotFoundError struct {
	Entity interface{}
	ID     int
}

RecordNotFoundError is used when repository search failed to find an entity

func (*RecordNotFoundError) Error

func (e *RecordNotFoundError) Error() string

type StoryRepo

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

func NewStoryRepo

func NewStoryRepo() *StoryRepo

NewStoryRepo initializes a new StoryRepo instance

func (*StoryRepo) Create

func (r *StoryRepo) Create(newStory *entity.Story) error

Create saves the newStory

func (*StoryRepo) Delete

func (r *StoryRepo) Delete(existingStory *entity.Story) error

Delete removes the existingStory

func (*StoryRepo) Get

func (r *StoryRepo) Get(storyID int) (*entity.Story, error)

Get retrieves a single story by the storyID

func (*StoryRepo) Get10LatestStories

func (r *StoryRepo) Get10LatestStories() ([]*entity.Story, error)

Get10LatestStories retrieve 10 newest stories ordered by latest update

func (*StoryRepo) GetByAuthorID

func (r *StoryRepo) GetByAuthorID(writerID int) ([]*entity.Story, error)

GetByAuthorID retrieves all stories that the writerID involved

func (*StoryRepo) Update

func (r *StoryRepo) Update(updatedStory *entity.Story) error

Update edits the updatedStory

Jump to

Keyboard shortcuts

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