Exemple #1
0
func (s Store) AddEntry(
	t db.Transaction, entry *vsafe.Entry) error {
	return sqlite_db.ToDoer(s.db, t).Do(func(conn *sqlite.Conn) error {
		return sqlite_db.AddRow(
			conn, &rawEntry{}, entry, &entry.Id, kSQLAddEntry)
	})
}
Exemple #2
0
func (s Store) Users(
	t db.Transaction, consumer functional.Consumer) error {
	return sqlite_db.ToDoer(s.db, t).Do(func(conn *sqlite.Conn) error {
		return sqlite_db.ReadMultiple(
			conn,
			&rawUser{},
			consumer,
			kSQLUsers)
	})
}
Exemple #3
0
func (s Store) EntriesByOwner(
	t db.Transaction, owner int64, consumer functional.Consumer) error {
	return sqlite_db.ToDoer(s.db, t).Do(func(conn *sqlite.Conn) error {
		return sqlite_db.ReadMultiple(
			conn,
			&rawEntry{},
			consumer,
			kSQLEntryByOwner,
			owner)
	})
}
Exemple #4
0
func (s Store) UserByName(
	t db.Transaction, name string, user *vsafe.User) error {
	return sqlite_db.ToDoer(s.db, t).Do(func(conn *sqlite.Conn) error {
		return sqlite_db.ReadSingle(
			conn,
			&rawUser{},
			vsafedb.ErrNoSuchId,
			user,
			kSQLUserByName,
			name)
	})
}
Exemple #5
0
func (s Store) EntryByIdWithEtag(
	t db.Transaction, id int64, entry *vsafe.EntryWithEtag) error {
	return sqlite_db.ToDoer(s.db, t).Do(func(conn *sqlite.Conn) error {
		return sqlite_db.ReadSingle(
			conn,
			&rawEntry{},
			vsafedb.ErrNoSuchId,
			entry,
			kSQLEntryById,
			id)
	})
}
Exemple #6
0
func (s Store) RemoveUser(
	t db.Transaction, name string) error {
	return sqlite_db.ToDoer(s.db, t).Do(func(conn *sqlite.Conn) error {
		return conn.Exec(kSQLRemoveUser, name)
	})
}
Exemple #7
0
func (s Store) UpdateUser(
	t db.Transaction, user *vsafe.User) error {
	return sqlite_db.ToDoer(s.db, t).Do(func(conn *sqlite.Conn) error {
		return sqlite_db.UpdateRow(conn, &rawUser{}, user, kSQLUpdateUser)
	})
}
Exemple #8
0
func (s Store) AddUser(
	t db.Transaction, user *vsafe.User) error {
	return sqlite_db.ToDoer(s.db, t).Do(func(conn *sqlite.Conn) error {
		return sqlite_db.AddRow(conn, &rawUser{}, user, &user.Id, kSQLAddUser)
	})
}
Exemple #9
0
func (s Store) RemoveEntry(t db.Transaction, id, owner int64) error {
	return sqlite_db.ToDoer(s.db, t).Do(func(conn *sqlite.Conn) error {
		return conn.Exec(kSQLRemoveEntry, id, owner)
	})
}
Exemple #10
0
func (s Store) UpdateEntry(t db.Transaction, entry *vsafe.Entry) error {
	return sqlite_db.ToDoer(s.db, t).Do(func(conn *sqlite.Conn) error {
		return sqlite_db.UpdateRow(conn, &rawEntry{}, entry, kSQLUpdateEntry)
	})
}