service2

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 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 Gateway added in v0.3.0

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

Gateway ...

func (*Gateway) GetPersonByID added in v0.3.0

func (r *Gateway) GetPersonByID(ctx context.Context, id int64) (Person, error)

GetPersonByID ...

func (*Gateway) RegisterPerson added in v0.3.0

func (r *Gateway) RegisterPerson(ctx context.Context, p Person) (Person, error)

RegisterPerson ...

type MockDB

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

MockDB ...

func NewMockDB

func NewMockDB() *MockDB

NewMockDB ...s

type MockGateway added in v0.3.0

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

MockGateway ...

func (*MockGateway) GetPersonByID added in v0.3.0

func (r *MockGateway) GetPersonByID(ctx context.Context, id int64) (Person, error)

GetPersonByID ...

func (*MockGateway) RegisterPerson added in v0.3.0

func (r *MockGateway) RegisterPerson(ctx context.Context, p Person) (Person, error)

RegisterPerson ...

type Person

type Person struct {
	ID    int64  `db:"kokoha"`
	Name  string `db:"tekitode"` // sql.NullString はインフラに結合するので使わない
	Email string `db:"yoiyo"`
}

Person ...

type Provider

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

Provider ...

func NewProvider

func NewProvider(r Repository) *Provider

NewProvider ...

func (*Provider) GetPersonByID

func (p *Provider) GetPersonByID(ctx context.Context, id int64) (Person, error)

GetPersonByID ...

func (*Provider) RegisterPerson

func (p *Provider) RegisterPerson(ctx context.Context, name, email string) (Person, error)

RegisterPerson ...

type Repository

type Repository interface {
	RegisterPerson(context.Context, Person) (Person, error)
	GetPersonByID(context.Context, int64) (Person, error)
}

Repository ...

func NewGateway added in v0.3.0

func NewGateway(db *sqlx.DB) Repository

NewGateway ...

func NewMockGateway added in v0.3.0

func NewMockGateway(db *MockDB) Repository

NewMockGateway ...

Jump to

Keyboard shortcuts

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