Documentation ¶
Overview ¶
This package is wrapper for sqlite3 db connections. To use it with your own structs, you have to add an column-tag to your structs and an ID field.
This package is currently in a BETA-state.
Index ¶
- type SQLite3
- func (sql3 *SQLite3) CheckConnection() error
- func (sql3 *SQLite3) Connect()
- func (sql3 SQLite3) DB() *sql.DB
- func (sql3 SQLite3) DeleteObject(tblName string, obj interface{}) (err error)
- func (sql3 SQLite3) Disconnect() error
- func (sql3 SQLite3) InsertObject(tblName string, objPointer, obj interface{}) (err error)
- func (sql3 SQLite3) SelectObject(tblName string, objPointer, obj interface{}) (err error)
- func (sql3 SQLite3) SelectObjects(tblName string, objPointer interface{}) (err error)
- func (sql3 SQLite3) SpecificSelectObject(sqlStatement string, objPointer interface{}) (err error)
- func (sql3 SQLite3) SpecificSelectObjects(sqlStatement string, objPointer interface{}) (err error)
- func (sql3 SQLite3) UpdateObject(tblName string, objPointer, obj interface{}) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SQLite3 ¶
type SQLite3 struct { Destination string `json:"destination"` // contains filtered or unexported fields }
sqlite3 struct to group informations, json ready
func (*SQLite3) CheckConnection ¶
check connection to dbfile
func (SQLite3) DeleteObject ¶
this function generates an "delete" statement, where the given struct is used to delete the object from the given table. The function requires the object struct to have an "ID" field with a valid value.
Parameters:
- `tblName` : string > the name of the table, where tho object is estimated
- `obj` : interface{} | struct > the object with an ID-field and an valid value
func (SQLite3) Disconnect ¶
disconnect from the currently connected file
func (SQLite3) InsertObject ¶
this function generates an "insert" statement, where the given struct is inserted into the given table. The function requires the object struct to have an "ID" field, so the struct receives the new id.
Parameters:
- `tblName` : string > the name of the table, where tho object is estimated
- `objPointer` : interface{} | *struct > pointer to the object, is used to get the struct-informations
- `obj` : interface{} | struct > the same object, but not as a pointer, is used to get the struct-informations
func (SQLite3) SelectObject ¶
this function generates a "select" statement, where the estimated object is exactly one object, not from a list. The function requires the object- struct to have an "ID" field.
Parameters:
- `tblName` : string > the name of the table, where tho object is estimated
- `objPointer` : interface{} | *struct > pointer to the object, is used to get the struct-informations
- `obj` : interface{} | struct > the same object, but not as a pointer, where the data should be stored
func (SQLite3) SelectObjects ¶
this function generates a "select" statement, where the estimated object is a list of objects. The function does not require the object struct to have an "ID" field.
Parameters:
- `tblName` : string > the name of the table, where tho object is estimated
- `objPointer` : interface{} | *[]struct > contains the list of the array
func (SQLite3) SpecificSelectObject ¶ added in v1.3.0
this function uses a specified sql-statement to select multiple objects. the statement will be given through the variable sqlStatement <string>
Parameters:
- `sqlStatement` : string > the sql stateent, which is used to receive the objects
- `objPointer` : interface{} | *struct > contains the pointer to the object -> *[]struct
func (SQLite3) SpecificSelectObjects ¶ added in v1.3.0
this function uses a specified sql-statement to select multiple objects. the statement will be given through the variable sqlStatement <string>
Parameters:
- `sqlStatement` : string > the sql stateent, which is used to receive the objects
- `objPointer` : interface{} | *[]struct > contains the list of the objects
func (SQLite3) UpdateObject ¶
this function generates an "update" statement, where the given struct updates the values in the given table. The function requires the object struct to have an "ID" field, so the table receives the new values.
Parameters:
- `tblName` : string > the name of the table, where tho object is estimated
- `objPointer` : interface{} | *struct > pointer to the object, is used to store the values
- `obj` : interface{} | struct > the same object, but not as a pointer, is used to get the struct-informations