backend

package
v0.0.0-...-e403533 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterBackendServer

func RegisterBackendServer(s *grpc.Server, srv BackendServer)

func RunServer

func RunServer()

Types

type Animal

type Animal struct {
	Id                   uint32   `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Name                 string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Age                  int32    `protobuf:"varint,3,opt,name=age,proto3" json:"age,omitempty"`
	PhotoUrl             string   `protobuf:"bytes,4,opt,name=photo_url,json=photoUrl,proto3" json:"photo_url,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Animal) Descriptor

func (*Animal) Descriptor() ([]byte, []int)

func (*Animal) GetAge

func (m *Animal) GetAge() int32

func (*Animal) GetId

func (m *Animal) GetId() uint32

func (*Animal) GetName

func (m *Animal) GetName() string

func (*Animal) GetPhotoUrl

func (m *Animal) GetPhotoUrl() string

func (*Animal) ProtoMessage

func (*Animal) ProtoMessage()

func (*Animal) Reset

func (m *Animal) Reset()

func (*Animal) String

func (m *Animal) String() string

func (*Animal) XXX_DiscardUnknown

func (m *Animal) XXX_DiscardUnknown()

func (*Animal) XXX_Marshal

func (m *Animal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Animal) XXX_Merge

func (m *Animal) XXX_Merge(src proto.Message)

func (*Animal) XXX_Size

func (m *Animal) XXX_Size() int

func (*Animal) XXX_Unmarshal

func (m *Animal) XXX_Unmarshal(b []byte) error

type BackendClient

type BackendClient interface {
	CreateAnimal(ctx context.Context, in *CreateAnimalRequest, opts ...grpc.CallOption) (*CreateAnimalResponse, error)
	GetAnimal(ctx context.Context, in *GetAnimalRequest, opts ...grpc.CallOption) (*GetAnimalResponse, error)
	UpdateAnimal(ctx context.Context, in *UpdateAnimalRequest, opts ...grpc.CallOption) (*UpdateAnimalResponse, error)
	DeleteAnimal(ctx context.Context, in *DeleteAnimalRequest, opts ...grpc.CallOption) (*DeleteAnimalResponse, error)
}

BackendClient is the client API for Backend service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewBackendClient

func NewBackendClient(cc *grpc.ClientConn) BackendClient

type BackendServer

BackendServer is the server API for Backend service.

type CreateAnimalRequest

type CreateAnimalRequest struct {
	Animal               *Animal  `protobuf:"bytes,1,opt,name=animal,proto3" json:"animal,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CreateAnimalRequest) Descriptor

func (*CreateAnimalRequest) Descriptor() ([]byte, []int)

func (*CreateAnimalRequest) GetAnimal

func (m *CreateAnimalRequest) GetAnimal() *Animal

func (*CreateAnimalRequest) ProtoMessage

func (*CreateAnimalRequest) ProtoMessage()

func (*CreateAnimalRequest) Reset

func (m *CreateAnimalRequest) Reset()

func (*CreateAnimalRequest) String

func (m *CreateAnimalRequest) String() string

func (*CreateAnimalRequest) XXX_DiscardUnknown

func (m *CreateAnimalRequest) XXX_DiscardUnknown()

func (*CreateAnimalRequest) XXX_Marshal

func (m *CreateAnimalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CreateAnimalRequest) XXX_Merge

func (m *CreateAnimalRequest) XXX_Merge(src proto.Message)

func (*CreateAnimalRequest) XXX_Size

func (m *CreateAnimalRequest) XXX_Size() int

func (*CreateAnimalRequest) XXX_Unmarshal

func (m *CreateAnimalRequest) XXX_Unmarshal(b []byte) error

type CreateAnimalResponse

type CreateAnimalResponse struct {
	Created              *Animal  `protobuf:"bytes,1,opt,name=created,proto3" json:"created,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CreateAnimalResponse) Descriptor

func (*CreateAnimalResponse) Descriptor() ([]byte, []int)

func (*CreateAnimalResponse) GetCreated

func (m *CreateAnimalResponse) GetCreated() *Animal

func (*CreateAnimalResponse) ProtoMessage

func (*CreateAnimalResponse) ProtoMessage()

func (*CreateAnimalResponse) Reset

func (m *CreateAnimalResponse) Reset()

func (*CreateAnimalResponse) String

func (m *CreateAnimalResponse) String() string

func (*CreateAnimalResponse) XXX_DiscardUnknown

func (m *CreateAnimalResponse) XXX_DiscardUnknown()

func (*CreateAnimalResponse) XXX_Marshal

func (m *CreateAnimalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CreateAnimalResponse) XXX_Merge

func (m *CreateAnimalResponse) XXX_Merge(src proto.Message)

func (*CreateAnimalResponse) XXX_Size

func (m *CreateAnimalResponse) XXX_Size() int

func (*CreateAnimalResponse) XXX_Unmarshal

func (m *CreateAnimalResponse) XXX_Unmarshal(b []byte) error

type DeleteAnimalRequest

type DeleteAnimalRequest struct {
	Id                   uint32   `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DeleteAnimalRequest) Descriptor

func (*DeleteAnimalRequest) Descriptor() ([]byte, []int)

func (*DeleteAnimalRequest) GetId

func (m *DeleteAnimalRequest) GetId() uint32

func (*DeleteAnimalRequest) ProtoMessage

func (*DeleteAnimalRequest) ProtoMessage()

func (*DeleteAnimalRequest) Reset

func (m *DeleteAnimalRequest) Reset()

func (*DeleteAnimalRequest) String

func (m *DeleteAnimalRequest) String() string

func (*DeleteAnimalRequest) XXX_DiscardUnknown

func (m *DeleteAnimalRequest) XXX_DiscardUnknown()

func (*DeleteAnimalRequest) XXX_Marshal

func (m *DeleteAnimalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeleteAnimalRequest) XXX_Merge

func (m *DeleteAnimalRequest) XXX_Merge(src proto.Message)

func (*DeleteAnimalRequest) XXX_Size

func (m *DeleteAnimalRequest) XXX_Size() int

func (*DeleteAnimalRequest) XXX_Unmarshal

func (m *DeleteAnimalRequest) XXX_Unmarshal(b []byte) error

type DeleteAnimalResponse

type DeleteAnimalResponse struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DeleteAnimalResponse) Descriptor

func (*DeleteAnimalResponse) Descriptor() ([]byte, []int)

func (*DeleteAnimalResponse) ProtoMessage

func (*DeleteAnimalResponse) ProtoMessage()

func (*DeleteAnimalResponse) Reset

func (m *DeleteAnimalResponse) Reset()

func (*DeleteAnimalResponse) String

func (m *DeleteAnimalResponse) String() string

func (*DeleteAnimalResponse) XXX_DiscardUnknown

func (m *DeleteAnimalResponse) XXX_DiscardUnknown()

func (*DeleteAnimalResponse) XXX_Marshal

func (m *DeleteAnimalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeleteAnimalResponse) XXX_Merge

func (m *DeleteAnimalResponse) XXX_Merge(src proto.Message)

func (*DeleteAnimalResponse) XXX_Size

func (m *DeleteAnimalResponse) XXX_Size() int

func (*DeleteAnimalResponse) XXX_Unmarshal

func (m *DeleteAnimalResponse) XXX_Unmarshal(b []byte) error

type GetAnimalRequest

type GetAnimalRequest struct {
	Id                   uint32   `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetAnimalRequest) Descriptor

func (*GetAnimalRequest) Descriptor() ([]byte, []int)

func (*GetAnimalRequest) GetId

func (m *GetAnimalRequest) GetId() uint32

func (*GetAnimalRequest) ProtoMessage

func (*GetAnimalRequest) ProtoMessage()

func (*GetAnimalRequest) Reset

func (m *GetAnimalRequest) Reset()

func (*GetAnimalRequest) String

func (m *GetAnimalRequest) String() string

func (*GetAnimalRequest) XXX_DiscardUnknown

func (m *GetAnimalRequest) XXX_DiscardUnknown()

func (*GetAnimalRequest) XXX_Marshal

func (m *GetAnimalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetAnimalRequest) XXX_Merge

func (m *GetAnimalRequest) XXX_Merge(src proto.Message)

func (*GetAnimalRequest) XXX_Size

func (m *GetAnimalRequest) XXX_Size() int

func (*GetAnimalRequest) XXX_Unmarshal

func (m *GetAnimalRequest) XXX_Unmarshal(b []byte) error

type GetAnimalResponse

type GetAnimalResponse struct {
	Animal               *Animal  `protobuf:"bytes,1,opt,name=animal,proto3" json:"animal,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetAnimalResponse) Descriptor

func (*GetAnimalResponse) Descriptor() ([]byte, []int)

func (*GetAnimalResponse) GetAnimal

func (m *GetAnimalResponse) GetAnimal() *Animal

func (*GetAnimalResponse) ProtoMessage

func (*GetAnimalResponse) ProtoMessage()

func (*GetAnimalResponse) Reset

func (m *GetAnimalResponse) Reset()

func (*GetAnimalResponse) String

func (m *GetAnimalResponse) String() string

func (*GetAnimalResponse) XXX_DiscardUnknown

func (m *GetAnimalResponse) XXX_DiscardUnknown()

func (*GetAnimalResponse) XXX_Marshal

func (m *GetAnimalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetAnimalResponse) XXX_Merge

func (m *GetAnimalResponse) XXX_Merge(src proto.Message)

func (*GetAnimalResponse) XXX_Size

func (m *GetAnimalResponse) XXX_Size() int

func (*GetAnimalResponse) XXX_Unmarshal

func (m *GetAnimalResponse) XXX_Unmarshal(b []byte) error

type PostgreStorage

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

func NewPostgreStorage

func NewPostgreStorage(uri string) (*PostgreStorage, error)

func (*PostgreStorage) Connect

func (storage *PostgreStorage) Connect() error

func (*PostgreStorage) CreateAnimal

func (storage *PostgreStorage) CreateAnimal(in *Animal) (*Animal, error)

func (*PostgreStorage) DeleteAnimal

func (storage *PostgreStorage) DeleteAnimal(id uint32) error

func (*PostgreStorage) GetAnimal

func (storage *PostgreStorage) GetAnimal(id uint32) (*Animal, error)

func (*PostgreStorage) UpdateAnimal

func (storage *PostgreStorage) UpdateAnimal(updated *Animal) (*Animal, error)

type Server

type Server struct {
	UnimplementedBackendServer
	// contains filtered or unexported fields
}

func NewServerFromConfig

func NewServerFromConfig(cfg ServerConfig) *Server

func (*Server) AuthFuncOverride

func (s *Server) AuthFuncOverride(ctx context.Context, fullMethodName string) (context.Context, error)

func (*Server) Cleanup

func (s *Server) Cleanup()

func (*Server) CreateAnimal

func (s *Server) CreateAnimal(ctx context.Context, req *CreateAnimalRequest) (*CreateAnimalResponse, error)

func (*Server) DeleteAnimal

func (s *Server) DeleteAnimal(ctx context.Context, req *DeleteAnimalRequest) (*DeleteAnimalResponse, error)

func (*Server) GetAnimal

func (s *Server) GetAnimal(ctx context.Context, req *GetAnimalRequest) (*GetAnimalResponse, error)

func (*Server) UpdateAnimal

func (s *Server) UpdateAnimal(ctx context.Context, req *UpdateAnimalRequest) (*UpdateAnimalResponse, error)

type ServerConfig

type ServerConfig struct {
	ListenAddr  string `yaml:"listen_on"`
	DatabaseURI string `yaml:"db_uri"`

	MaxMessageSizeBytes int `yaml:"max_message_size_bytes"`

	ServerCert string `yaml:"server_cert"`
	ServerKey  string `yaml:"server_key"`
	CACert     string `yaml:"ca_cert"`
}

func LoadConfig

func LoadConfig() ServerConfig

type UnimplementedBackendServer

type UnimplementedBackendServer struct {
}

UnimplementedBackendServer can be embedded to have forward compatible implementations.

func (*UnimplementedBackendServer) CreateAnimal

func (*UnimplementedBackendServer) DeleteAnimal

func (*UnimplementedBackendServer) GetAnimal

func (*UnimplementedBackendServer) UpdateAnimal

type UpdateAnimalRequest

type UpdateAnimalRequest struct {
	Updated              *Animal  `protobuf:"bytes,1,opt,name=updated,proto3" json:"updated,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*UpdateAnimalRequest) Descriptor

func (*UpdateAnimalRequest) Descriptor() ([]byte, []int)

func (*UpdateAnimalRequest) GetUpdated

func (m *UpdateAnimalRequest) GetUpdated() *Animal

func (*UpdateAnimalRequest) ProtoMessage

func (*UpdateAnimalRequest) ProtoMessage()

func (*UpdateAnimalRequest) Reset

func (m *UpdateAnimalRequest) Reset()

func (*UpdateAnimalRequest) String

func (m *UpdateAnimalRequest) String() string

func (*UpdateAnimalRequest) XXX_DiscardUnknown

func (m *UpdateAnimalRequest) XXX_DiscardUnknown()

func (*UpdateAnimalRequest) XXX_Marshal

func (m *UpdateAnimalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UpdateAnimalRequest) XXX_Merge

func (m *UpdateAnimalRequest) XXX_Merge(src proto.Message)

func (*UpdateAnimalRequest) XXX_Size

func (m *UpdateAnimalRequest) XXX_Size() int

func (*UpdateAnimalRequest) XXX_Unmarshal

func (m *UpdateAnimalRequest) XXX_Unmarshal(b []byte) error

type UpdateAnimalResponse

type UpdateAnimalResponse struct {
	Result               *Animal  `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*UpdateAnimalResponse) Descriptor

func (*UpdateAnimalResponse) Descriptor() ([]byte, []int)

func (*UpdateAnimalResponse) GetResult

func (m *UpdateAnimalResponse) GetResult() *Animal

func (*UpdateAnimalResponse) ProtoMessage

func (*UpdateAnimalResponse) ProtoMessage()

func (*UpdateAnimalResponse) Reset

func (m *UpdateAnimalResponse) Reset()

func (*UpdateAnimalResponse) String

func (m *UpdateAnimalResponse) String() string

func (*UpdateAnimalResponse) XXX_DiscardUnknown

func (m *UpdateAnimalResponse) XXX_DiscardUnknown()

func (*UpdateAnimalResponse) XXX_Marshal

func (m *UpdateAnimalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UpdateAnimalResponse) XXX_Merge

func (m *UpdateAnimalResponse) XXX_Merge(src proto.Message)

func (*UpdateAnimalResponse) XXX_Size

func (m *UpdateAnimalResponse) XXX_Size() int

func (*UpdateAnimalResponse) XXX_Unmarshal

func (m *UpdateAnimalResponse) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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