Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DBConnection ¶
type DBConnection struct {
Host, Port, User, Password, DBName string
}
DBConnection wraps information necessary to connect to a database.
func (DBConnection) Setup ¶
func (dbConnection DBConnection) Setup()
Setup database connection based on parameters provided in the receiver.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository implements dependency injection for database connection.
func NewRepository ¶
func NewRepository(db *gorm.DB) Repository
NewRepository constructs a new Repository so we don't need to expose Repository's internal fields.
func (*Repository) FindAll ¶
func (r *Repository) FindAll(dest interface{}) bool
FindAll is an abstraction of gorm.Find. Searches all records of the desired interface.
func (*Repository) FindByField ¶
func (r *Repository) FindByField(dest interface{}, query interface{}) bool
FindByField is an abstraction of gorm.Find. Finds the desired interface applying the provided query parameter.
func (*Repository) FindByID ¶
func (r *Repository) FindByID(dest interface{}, id uint64) bool
FindByID is an abstraction of gorm.Find using primary key. Searches desired interface using provided primary key
func (*Repository) GetDB ¶
func (r *Repository) GetDB() *gorm.DB
GetDB gives direct access to gorm.DB capabilities.