crud

package
v0.0.0-...-bd4aac7 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDatabase

func CreateDatabase(dbName string) (*sqlx.DB, error)

CreateDatabase attempts to create a database, if database already exists the error will be ignored

func CreateTable

func CreateTable(dbName string) (*sqlx.DB, error)

func Database

func Database() (*sqlx.DB, error)

Database creates a new sqlx.DB object from the environment variables to manage and maintain database connections

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB is the database layer for work database

func NewDB

func NewDB(db *sqlx.DB) *DB

NewDB creates a new instance of DB

func (*DB) Insert

func (db *DB) Insert(ctx context.Context, task task.Task) error

Insert inserts a new row in the tasks table

func (*DB) Read

func (db *DB) Read(ctx context.Context) (task.Task, error)

Read takes a task id and returns a task

Jump to

Keyboard shortcuts

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