repositories

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ReadOnlyMode will RLock(read) the data .
	ReadOnlyMode = iota
	// ReadWriteMode will Lock(read/write) the data.
	ReadWriteMode
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MovieRepository

type MovieRepository interface {
	Exec(query Query, action Query, limit int, mode int) (ok bool)

	Select(query Query) (movie datamodels.Movie, found bool)
	SelectMany(query Query, limit int) (results []datamodels.Movie)

	InsertOrUpdate(movie datamodels.Movie) (updatedMovie datamodels.Movie, err error)
	Delete(query Query, limit int) (deleted bool)
}

MovieRepository handles the basic operations of a movie entity/model. It's an interface in order to be testable, i.e a memory movie repository or a connected to an sql database.

func NewMovieRepository

func NewMovieRepository(source map[int64]datamodels.Movie) MovieRepository

NewMovieRepository returns a new movie memory-based repository, the one and only repository type in our example.

type Query

type Query func(datamodels.Movie) bool

Query represents the visitor and action queries.

Jump to

Keyboard shortcuts

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