postgres

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(db, user, password, addr string) (*sqlx.DB, error)

NewDB creates new postgress db connection pool

Types

type Account

type Account struct {
	// Embed tx.SQL for a default sql tx.Transactional implementation
	// This step is optional, and you can implement tx.Transactional yourself
	// or embed tx.SQL and override any of the three methods (RunTx usually)
	tx.SQL
}

Account represents account repo postrgres implementation

func NewAccount

func NewAccount(db *sql.DB) *Account

NewAccount instantiates new Account postgres repository

func (*Account) ByID

func (a *Account) ByID(ctx context.Context, id int64) (*example.Account, error)

ByID fetches new account for a given id

func (*Account) Save

func (a *Account) Save(ctx context.Context, acc *example.Account) error

Save saves account to the db

Jump to

Keyboard shortcuts

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