models

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartRPCServer

func StartRPCServer(port int) error

Types

type Client

type Client struct {
	TodoClient
}

func NewClient

func NewClient(port int) (*Client, error)

type CreateTodoReq

type CreateTodoReq struct {
	Ctx  context.Context
	Data Todo
}

type CreateTodoRes

type CreateTodoRes struct {
	Err error
}

type DeleteTodoReq

type DeleteTodoReq struct {
	ID uuid.UUID
}

type DeleteTodoRes

type DeleteTodoRes struct {
	Err error
}

type GetTodoReq

type GetTodoReq struct {
	ID uuid.UUID
}

type GetTodoRes

type GetTodoRes struct {
	Data Todo
}

type Todo

type Todo struct {
	ID          uuid.UUID
	Name        string
	Description string
	Permalink   string
}

Todo is a model

func (Todo) GetAge

func (t Todo) GetAge() int

type TodoClient

type TodoClient struct {
	RPC *rpc.Client
}

func (*TodoClient) Get

func (cl *TodoClient) Get(id uuid.UUID) (*Todo, error)

type TodoServer

type TodoServer struct{}

func NewTodoServer

func NewTodoServer() *TodoServer

func (*TodoServer) Create

func (srv *TodoServer) Create(req CreateTodoReq, res *CreateTodoRes) error

func (*TodoServer) Delete

func (srv *TodoServer) Delete(req DeleteTodoReq, res *DeleteTodoRes) error

func (*TodoServer) Get

func (srv *TodoServer) Get(req GetTodoReq, res *GetTodoRes) error

func (*TodoServer) Update

func (srv *TodoServer) Update(req UpdateTodoReq, res *UpdateTodoRes) error

type UpdateTodoReq

type UpdateTodoReq struct {
	ID  uuid.UUID
	New Todo
}

type UpdateTodoRes

type UpdateTodoRes struct {
	Err error
}

Jump to

Keyboard shortcuts

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