Documentation
¶
Index ¶
- type DB
- func (db *DB) Create(rd randomdata.RandomData) error
- func (db *DB) DeleteSpecific(id uint) error
- func (db *DB) GetEverything() ([]*randomdata.RandomData, error)
- func (db *DB) GetSpecific(id uint) (*randomdata.RandomData, error)
- func (db *DB) HandleGlobalWeb(w http.ResponseWriter, r *http.Request)
- func (db *DB) HandleSpecificWeb(w http.ResponseWriter, r *http.Request)
- func (db *DB) UpdateSpecific(id uint, newRD randomdata.RandomData) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
func CreateLocalDB ¶
Creates a local database file in the same directory as executable if does not exist already. Creates a table with such structure: (id PRIMARY KEY, title TEXT, text TEXT), which represents underlying fields of `RandomData`
func (*DB) Create ¶
func (db *DB) Create(rd randomdata.RandomData) error
Create a new `RandomData` row in db
func (*DB) DeleteSpecific ¶
Delete `RandomData` from db with given id
func (*DB) GetEverything ¶
func (db *DB) GetEverything() ([]*randomdata.RandomData, error)
Collect and return all rows in db
func (*DB) GetSpecific ¶
func (db *DB) GetSpecific(id uint) (*randomdata.RandomData, error)
Get `RandomData` from db with given id
func (*DB) HandleGlobalWeb ¶
func (db *DB) HandleGlobalWeb(w http.ResponseWriter, r *http.Request)
Handler function for all `RandomData`s in database
func (*DB) HandleSpecificWeb ¶
func (db *DB) HandleSpecificWeb(w http.ResponseWriter, r *http.Request)
Handler function for a specific `RandomData` in database
func (*DB) UpdateSpecific ¶
func (db *DB) UpdateSpecific(id uint, newRD randomdata.RandomData) error
Replace `Randomdata` in db with given id with a new one. Does not affect `DateCreated`
Click to show internal directories.
Click to hide internal directories.