Documentation
¶
Index ¶
- type Database
- func (db *Database) Close() error
- func (db *Database) CreateNote(n *entity.Note) error
- func (db *Database) CreateTodo(t *entity.Todo) error
- func (db *Database) CreateUser(u *entity.User) error
- func (db *Database) DeleteTodo(id string) error
- func (db *Database) DeleteUser(id string) error
- func (db *Database) GetAllNotes(userId string) (*[]entity.Note, error)
- func (db *Database) GetAllPendingTodos(userId string) (*[]entity.Todo, error)
- func (db *Database) GetNote(id string, userId string) (*[]entity.Note, error)
- func (db *Database) GetUser(email string) (*entity.User, error)
- func (db *Database) Initialize(dataSourceName string) error
- func (db *Database) InsertLog(l *entity.Log) error
- func (db *Database) UpdateNote(n *entity.Note) error
- func (db *Database) UpdateTodo(t *entity.Todo) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database contains the connection pool of SQL. Server should call Initialize before usage. Thanks to Go maintainers, the concurrency support is inbuilt so we do not need to manage connections on our own.
func (*Database) Close ¶
Close is meant to free up resources, to be called when the server wants to shut down.
func (*Database) CreateNote ¶
CreateNote will create a new note in the database with a new UUID.
func (*Database) CreateTodo ¶
CreateTodo will create a new todo in the database with a new UUID.
func (*Database) CreateUser ¶
CreateUser will create a new user in the database and will have a newly generated UUID.
func (*Database) DeleteTodo ¶
DeleteTodo will delete a todo from the database.
func (*Database) DeleteUser ¶
DeleteUser will delete a user specified by userId.
func (*Database) GetAllNotes ¶
GetAllNotes will fetch you a list of notes based on given userId
func (*Database) GetAllPendingTodos ¶
GetAllTodos will return all todos for a given user using userId.
func (*Database) Initialize ¶
Initialize will open a database at given dataSourceName.
func (*Database) UpdateNote ¶
UpdateNote will update a note in the database.