Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Thing ¶
type Thing struct { ID string `gorm:"primary_key:true"` Title string `json:"title"` Amount int `json:"amount"` CreatedAt time.Time UpdatedAt time.Time // This is a pointer so's a nil value can be returned // Gorm by default checks DeletedAt, so unless nil is // returned, a blank time will always be checked, // resulting in 0 results. DeletedAt *time.Time }
Thing - Thing model
type ThingRepository ¶
type ThingRepository struct {
// contains filtered or unexported fields
}
ThingRepository - Repository object for `things`
func NewThingRepository ¶
func NewThingRepository(db *gorm.DB) *ThingRepository
NewThingRepository - Create a new instance of `ThingRepository` database instance injected
func (*ThingRepository) FindAll ¶
func (repository *ThingRepository) FindAll() ([]Thing, error)
FindAll - Find all of the things
func (*ThingRepository) Insert ¶
func (repository *ThingRepository) Insert(thing Thing) error
Insert - Create a thing
Click to show internal directories.
Click to hide internal directories.