sqlstorage

package
v0.0.0-...-b856a18 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestDb

func TestDb(t *testing.T, databaseURL string) (*sql.DB, func(...string))

test example of db with teardown func

Types

type Storage

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

struct wrapper for db

func New

func New(db *sql.DB) *Storage

create new Storage

func (*Storage) User

func (st *Storage) User() storage.UserRepository

create userrepo

type UserRepository

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

UserRepository

func (*UserRepository) Create

func (r *UserRepository) Create(u *model.User) error

Create new users table colon in db

func (*UserRepository) Find

func (r *UserRepository) Find(id int) (*model.User, error)

func (*UserRepository) FindByEmail

func (r *UserRepository) FindByEmail(email string) (*model.User, error)

find user in db by email

Jump to

Keyboard shortcuts

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