Beispiel #1
0
func (this *Transaction) AddItem(id types.Id) error {
	idString, err := id.ToString()
	if err != nil {
		return err
	}
	_, err = this.tx.Exec("INSERT INTO items (id) VALUES (?)", idString)
	return err
}
Beispiel #2
0
func (this *Index) AddItem(id types.Id) (lastInsertId int64, err error) {
	idString, err := id.ToString()
	if err != nil {
		return -1, err
	}
	result, err := this.DB.Exec("INSERT INTO items (id) VALUES (?)", idString)
	if err != nil {
		return -1, err
	}
	return result.LastInsertId()
}