db

package
v0.0.0-...-53ae9e6 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Conn

func Conn() *sqlx.DB

Conn - gives a connection to database if it is initialized, otherwise returns nil

func Connect

func Connect(opts *ConnOpts) error

Connect - using the given options, connects to a database

Types

type ConnOpts

type ConnOpts struct {
	Host     string
	Port     int
	User     string
	Password string
	Database string
}

ConnOpts - options for connecting to a postgres instance

func (*ConnOpts) String

func (co *ConnOpts) String() string

String - converts ConnOpts to appropriate connection string

type PostgresStorage

type PostgresStorage struct {
}

PostgresStorage -

func (*PostgresStorage) Add

func (pg *PostgresStorage) Add(ti *todo.TaskItem) error

Add -

func (*PostgresStorage) Bulk

func (pg *PostgresStorage) Bulk(op todo.BulkOp) (err error)

Bulk -

func (*PostgresStorage) Init

func (pg *PostgresStorage) Init() error

Init -

func (*PostgresStorage) Name

func (pg *PostgresStorage) Name() string

Name -

func (*PostgresStorage) Remove

func (pg *PostgresStorage) Remove(id int) error

Remove -

func (*PostgresStorage) Retrieve

func (pg *PostgresStorage) Retrieve(id int) (*todo.TaskItem, error)

Retrieve -

func (*PostgresStorage) RetrieveAll

func (pg *PostgresStorage) RetrieveAll(offset, limit int) (
	[]*todo.TaskItem, error)

RetrieveAll -

func (*PostgresStorage) Update

func (pg *PostgresStorage) Update(item *todo.TaskItem) error

Update -

Jump to

Keyboard shortcuts

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