db

package
v0.0.0-...-988f1de Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package that interfaces with the sqlite database

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitUser

func CommitUser(db *sql.DB, user *user.User) error

CommitUser commits the given user to the given database. No santization of inputs is used, be warned.

func CreateSkelDB

func CreateSkelDB(filename string) error

CreateSkelDB creates a skeleton database with one user table and no users.

func DeleteUser

func DeleteUser(db *sql.DB, id int) (int64, error)

deleteUser deletes a given user by id. It returns error on database error (like no such user with given id). Otherwise, it returns the number of users deleted.

func FindUsersBy

func FindUsersBy(db *sql.DB, filters map[string]string) ([]user.User, error)

FindUsersBy takes in a database connection and map of filters. It searches the database for the users matching the filters and returns a slice of results. valid filters are of the form: map{ "name": "john", "age": "23", "id": 7} (Or any subset of those keys). A blank filter map will select all users. No santization of inputs is used, be warned.

func OpenDB

func OpenDB(filename string) (*sql.DB, error)

openDB opens the given sqlite database by filepath.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL