account

package
v0.0.0-...-5e0dbef Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2020 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenGRPC

func ListenGRPC(s Service, port int) error

Types

type Account

type Account struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Client

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

func NewClient

func NewClient(url string) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) GetAccount

func (c *Client) GetAccount(ctx context.Context, id string) (*Account, error)

func (*Client) GetAccounts

func (c *Client) GetAccounts(ctx context.Context, skip uint64, take uint64) ([]Account, error)

func (*Client) PostAccount

func (c *Client) PostAccount(ctx context.Context, name string) (*Account, error)

type Repository

type Repository interface {
	Close()
	PutAccount(ctx context.Context, a Account) error
	GetAccountByID(ctx context.Context, id string) (*Account, error)
	ListAccounts(ctx context.Context, skip uint64, take uint64) ([]Account, error)
}

func NewPostgresRepository

func NewPostgresRepository(url string) (Repository, error)

type Service

type Service interface {
	PostAccount(ctx context.Context, name string) (*Account, error)
	GetAccount(ctx context.Context, id string) (*Account, error)
	GetAccounts(ctx context.Context, skip uint64, take uint64) ([]Account, error)
}

func NewService

func NewService(r Repository) Service

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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