service2

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 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 MockDB

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

MockDB ...

func NewMockDB

func NewMockDB() *MockDB

NewMockDB ...s

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 ...

type RepositoryImpl

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

RepositoryImpl ...

func NewRepositoryImpl

func NewRepositoryImpl(db *sqlx.DB) *RepositoryImpl

NewRepositoryImpl ...

func (*RepositoryImpl) GetPersonByID

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

GetPersonByID ...

func (*RepositoryImpl) RegisterPerson

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

RegisterPerson ...

type RepositoryImplMock

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

RepositoryImplMock ...

func NewRepositoryImplMock

func NewRepositoryImplMock(db *MockDB) *RepositoryImplMock

NewRepositoryImplMock ...

func (*RepositoryImplMock) GetPersonByID

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

GetPersonByID ...

func (*RepositoryImplMock) RegisterPerson

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

RegisterPerson ...

Jump to

Keyboard shortcuts

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