Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Entity ¶
type Entity struct { Id int `db:"id"` Name string `db:"name"` Description string `db:"description""` Properties PropertyMap `db:"properties"` }
Entity is a struct with same fields as database columns
type EntityDB ¶
type EntityDB struct {
// contains filtered or unexported fields
}
func NewEntityDB ¶
type PropertyMap ¶
type PropertyMap map[string]interface{}
PropertyMap is a type for our properties field. Note that if you have different kinds of entities (orders, customers, books, ...), you can simply re-use this type if they have a similar field.
func (*PropertyMap) Scan ¶
func (p *PropertyMap) Scan(src interface{}) error
Scan will take the JSONB data that comes from the database and transform it to the entity type.
Click to show internal directories.
Click to hide internal directories.