service

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB() *memdb.MemDB

NewDB initializes the DB.

Types

type HealthImpl

type HealthImpl struct{}

HealthImpl implements the HealthServer interface (see health.pb.go file).

func (*HealthImpl) Check

Check returns SERVING.

func (*HealthImpl) Watch

Watch is not implemented for now.

type UserImpl

type UserImpl struct {
	DB *memdb.MemDB
}

UserImpl implements my users-grpc service. If I also wanted to be able to trace my service (e.g. using jaeger), I would also make sure to store opentracing.Tracer there.

func NewUserImpl

func NewUserImpl() *UserImpl

NewUserImpl returns a new server.

func (*UserImpl) Create

func (svc *UserImpl) Create(ctx context.Context, req *pb.CreateReq) (*pb.CreateResp, error)

Create a user. If the given user has no id, generate one.

func (*UserImpl) GetByEmail

func (svc *UserImpl) GetByEmail(ctx context.Context, req *pb.GetByEmailReq) (*pb.GetByEmailResp, error)

GetByEmail returns a user by its email.

func (*UserImpl) List

func (svc *UserImpl) List(ctx context.Context, req *pb.ListReq) (*pb.SearchResp, error)

List all users.

func (*UserImpl) LoadSampleUsers

func (svc *UserImpl) LoadSampleUsers() error

LoadSampleUsers loads some hard-coded users into database.

func (*UserImpl) SearchAge

func (svc *UserImpl) SearchAge(ctx context.Context, req *pb.SearchAgeReq) (*pb.SearchResp, error)

SearchAge searches all users in the range [from, to_included].

func (*UserImpl) SearchName

func (svc *UserImpl) SearchName(ctx context.Context, req *pb.SearchNameReq) (*pb.SearchResp, error)

SearchName searches a user by a part of its first or last name.

Jump to

Keyboard shortcuts

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