Documentation ¶
Index ¶
- func OpenSysDatabase(driver, dataSource string) error
- func UpdateDatabase() error
- type DB
- func (db *DB) CreateMyType(myType MyType) (int, error)
- func (db *DB) CreateMyTypeTable() error
- func (db *DB) DeleteMyType(id int) error
- func (db *DB) FindMyType(name string) (MyType, error)
- func (db *DB) GetMyType(id int) (MyType, error)
- func (db *DB) ListMyTypes() ([]MyType, error)
- func (db *DB) UpdateMyType(id int, myType MyType) error
- type Datastore
- type MyType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenSysDatabase ¶
OpenSysDatabase Return an open database connection
func UpdateDatabase ¶
func UpdateDatabase() error
UpdateDatabase creates or updates tables by using DDL
Types ¶
type DB ¶
DB struct holding database implementation for datastore
var Db *DB
Db pointer to database hander
func (*DB) CreateMyType ¶
CreateMyType Inserts a new register
func (*DB) CreateMyTypeTable ¶
CreateMyTypeTable creates the database table
func (*DB) FindMyType ¶
FindMyType searches for a specific register
func (*DB) ListMyTypes ¶
ListMyTypes returns all the registers of the table
type Datastore ¶
type Datastore interface { CreateMyTypeTable() error ListMyTypes() ([]MyType, error) GetMyType(id int) (MyType, error) FindMyType(name string) (MyType, error) CreateMyType(myType MyType) (int, error) UpdateMyType(id int, myType MyType) DeleteMyType(id int) error }
Datastore interface for different data storages
Click to show internal directories.
Click to hide internal directories.