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 UserRepository ¶
type UserRepository interface { Exec(query Query, action Query, limit int, mode int) (ok bool) Select(query Query) (user datamodels.User, found bool) SelectMany(query Query, limit int) (results []datamodels.User) InsertOrUpdate(user datamodels.User) (updatedUser datamodels.User, err error) Delete(query Query, limit int) (deleted bool) }
UserRepository handles the basic operations of a user entity/model. It's an interface in order to be testable, i.e a memory user repository or a connected to an sql database.
func NewUserRepository ¶
func NewUserRepository(source map[int64]datamodels.User) UserRepository
NewUserRepository returns a new user memory-based repository, the one and only repository type in our example.
Click to show internal directories.
Click to hide internal directories.