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.
Click to show internal directories.
Click to hide internal directories.