SQLite statement generator
type ATable struct {
ID int64
Type string
AValue string
}
func (a *ATable) GetTableName() string {
return "ATable"
}
func (a *ATable) GetIDFields() []string {
return []string{"ID", "Type"}
}
func (a *ATable) AutoIncrementPK() bool {
return false
}
sqliteutils.GenerateCreateStmt(&ATable{})
// CREATE TABLE IF NOT EXISTS MuitiPK( ID integer, Type TEXT, AValue TEXT, PRIMARY KEY(ID, Type));
sqliteutils.GenerateInsertStmt(&ATable{ID: 10, Type: "Test", AValue: "ATest"})
//INSERT INTO MuitiPK(ID, Type, AValue) VALUES (10, 'Test', 'ATest');