if you dont have mattn/go-sqlite3:
go get github.com/mattn/go-sqlite3
go get github.com/MikhailBatsin-code/sqlgo
WARNING:
if you use lib versions that older than v0.1.1 than you will need to import api package and use just Api structure or AdvancedApi after update
SqliteApi usage
import in your file needed api
example: import "github.com/MikhailBatsin-code/sqlgo/sqlite"
than create api instance: sapi := sqlite.CreateSqliteApi(db, "someTable")
You can create or open db by sqlite.OpenOrCreateDb("test.db")
Wait for manual to get more information. In these versions just read source code to get some info about usage
The manual
1. SqliteApi
Create a SqliteApi struct instance:
sapi := sqlite.CreateSqliteApi(db, "someTable")
than create the table if not exists with specified columns:
sapi.Sync("id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT")
Inserting:
use create SqliteApi instance for it:
err := sapi.Insert("name", "muka")
If you need to drop table use sapi.DropTable() method
If you want to select all rows from database use sapi.SelectAll() it will return *sql.Rows
If yow want to delete all rows with one condition use sapi.DeleteAllBy(name = "muka" AND id = 1) it will return to you error if something went wrong
If you want delete only by id use sapi.DeleteById(1)
If you want to get one row by id use sapi.SelectById(1) it will return *sql.Row
If you want to update by id use sapi.UpdateById(1, name = "not muka")
If you want to getComponentVersion then use function sapi.GetComponentVersion() it will return a string