Documentation ¶
Index ¶
- Variables
- func NewID() string
- type Address
- type CourseModel
- type MemDB
- func (db *MemDB) Delete(table string, fieldName string, fieldVal interface{}) error
- func (db *MemDB) Get(table string, fieldName string, fieldVal interface{}) (interface{}, error)
- func (db *MemDB) Insert(table string, data interface{}) error
- func (db *MemDB) List(table string, fieldName string, fieldVal interface{}) ([]interface{}, error)
- func (db *MemDB) Wipe()
- type RegistrationModel
- type UserModel
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("model not found")
ErrNotFound is the error returned when a model cannot be found.
Functions ¶
Types ¶
type Address ¶
type Address struct { // Number is the street number. Number int // Street is the street name. Street string // City is the city name. City string // State is the US state 2 letter code. State string // Zip is the US Zip code. Zip int }
Address is a street address.
type CourseModel ¶
type CourseModel struct { // ID is the course identifier. ID string // Name is the unique course name. Name string // Description is the course description. Description string // StatTime is the data and time the course starts. StartTime time.Time // EndTime is the date and time the course ends. EndTime time.Time // Location is the place the course is being held at. Location string }
CourseModel is the database model used to persist courses.
type MemDB ¶
type MemDB struct {
*memdb.MemDB
}
MemDB is an in-memory database.
func NewDB ¶
func NewDB() *MemDB
NewDB returns a new in-memory database pre-initialized with seed data.
func NewEmptyDB ¶
func NewEmptyDB() *MemDB
NewEmptyDB returns an empty database, mainly intended for tests.
func (*MemDB) Delete ¶
Delete deletes the entry from table where the field fieldName has the value fieldVal.
func (*MemDB) Get ¶
Get retrieves the entry from table where the field fieldName has the value fieldVal.
type RegistrationModel ¶
type RegistrationModel struct { // ID is the registration identifier. ID string // CourseID is the course identifier. CourseID string // FirstName is the attendee first name. FirstName string // LastName is the attendee last name. LastName string // Address is the attendee street address. Address *Address }
RegistrationModel is the database model used to persist registrations.
Click to show internal directories.
Click to hide internal directories.