interfaces

package
v0.0.0-...-c8e0725 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Info(v ...interface{})
	Infof(format string, v ...interface{})
	Debug(v ...interface{})
	Debugf(format string, v ...interface{})
	Error(v ...interface{})
	Errorf(format string, v ...interface{})
}

type Result

type Result interface {
	LastInsertId() (int64, error)
	RowsAffected() (int64, error)
}

type Row

type Row interface {
	Scan(...interface{}) error
	Next() bool
	Close() error
	Err() error
}

type SQLHandler

type SQLHandler interface {
	Begin() (Tx, error)
	Query(string, ...interface{}) (Row, error)
	Exec(string, ...interface{}) (Result, error)
}

type Tx

type Tx interface {
	Commit() error
	Rollback() error
	Exec(string, ...interface{}) (Result, error)
}

type UserHandler

type UserHandler struct {
	UserInteractor *usecases.UserInteractor
	Logger         Logger
	Validator      Validator
}

func NewUserHandler

func NewUserHandler(logger Logger, validator Validator, sqlHandler SQLHandler) *UserHandler

func (*UserHandler) Create

func (uh *UserHandler) Create(w http.ResponseWriter, r *http.Request)

func (*UserHandler) Get

func (uh *UserHandler) Get(w http.ResponseWriter, r *http.Request)

func (*UserHandler) List

func (uh *UserHandler) List(w http.ResponseWriter, r *http.Request)

type UserRepository

type UserRepository struct {
	SQLHandler
}

func (*UserRepository) FindAll

func (ur *UserRepository) FindAll() (entities.Users, error)

func (*UserRepository) FindByID

func (ur *UserRepository) FindByID(id int64) (*entities.User, error)

func (*UserRepository) Save

func (ur *UserRepository) Save(u *entities.User) (int64, error)

type Validator

type Validator interface {
	Struct(s interface{}) error
}

Jump to

Keyboard shortcuts

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