Documentation ¶
Index ¶
- func CreatePostgresDbInstance(host string, port int, user string, password string, dbname string) (*sql.DB, error)
- func CreateSqliteDbInstance(name string) *sql.DB
- func GetSqliteDriverVersion() (string, int, string)
- type AdvancedApi
- func (api *AdvancedApi) DeleteAllBy(cond string) error
- func (api *AdvancedApi) DeleteById(id int) error
- func (api *AdvancedApi) DropTable() error
- func (api *AdvancedApi) GetComponentVersion() string
- func (api *AdvancedApi) InsertWithId(values []string) error
- func (api *AdvancedApi) SelectAll() (*sql.Rows, error)
- func (api *AdvancedApi) SelectById(id int) *sql.Row
- func (api *AdvancedApi) Sync() error
- func (api *AdvancedApi) UpdateById(id int, updates string) error
- type Api
- func (api *Api) DeleteAllBy(cond string) error
- func (api *Api) DeleteById(id int) error
- func (api *Api) DropTable() error
- func (api *Api) GetComponentVersion() string
- func (api *Api) Insert(cols string, values string) error
- func (api *Api) SelectAll() *sql.Rows
- func (api *Api) SelectById(id int) *sql.Row
- func (api *Api) Sync(cols string) error
- func (api *Api) UpdateById(id int, updates string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateSqliteDbInstance ¶
func GetSqliteDriverVersion ¶
Types ¶
type AdvancedApi ¶
type AdvancedApi struct { core.DbApi Cols map[string]string FuncOnError func(err error) IsImportant bool }
AdvancedApi just has more automation Cols is a map with all columns example:
map[string]string{ "id": "INTEGER PRIMARY KEY AUTOINCREMENT", "name": "TEXT" }
WARNING: do not put ',' or ')' no need in it FuncOnError is a custom function that will be called on error if isImportant is true
func NewAdvancedApi ¶
func (*AdvancedApi) DeleteAllBy ¶
func (api *AdvancedApi) DeleteAllBy(cond string) error
func (*AdvancedApi) DeleteById ¶
func (api *AdvancedApi) DeleteById(id int) error
func (*AdvancedApi) DropTable ¶
func (api *AdvancedApi) DropTable() error
func (*AdvancedApi) GetComponentVersion ¶
func (api *AdvancedApi) GetComponentVersion() string
func (*AdvancedApi) InsertWithId ¶
func (api *AdvancedApi) InsertWithId(values []string) error
func (*AdvancedApi) SelectById ¶
func (api *AdvancedApi) SelectById(id int) *sql.Row
func (*AdvancedApi) Sync ¶
func (api *AdvancedApi) Sync() error
func (*AdvancedApi) UpdateById ¶
func (api *AdvancedApi) UpdateById(id int, updates string) error
type Api ¶
Api structure is a structure that will interact with sqlite
func (*Api) DeleteAllBy ¶
it will delete all rows in db with specified condition
example: name="muka" AND id=1
func (*Api) DeleteById ¶
func (*Api) GetComponentVersion ¶
func (*Api) Insert ¶
argument 'cols' is a string where you put all columns in which values will be inserted example: name, email argument 'values' is a string with values that will be inserted example: "muka", "cringer@asd.dq"
func (*Api) SelectAll ¶
if you need to get all rows just use it WARNING: it's returns *sql.Rows that means that other work you need to do on your own