proto

package
v0.0.0-...-90a23b5 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package proto provides helper functions related to protocol buffers

Index

Constants

This section is empty.

Variables

View Source
var Accounts_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.Accounts",
	HandlerType: (*AccountsServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "AddAccount",
			Handler:    _Accounts_AddAccount_Handler,
		},
		{
			MethodName: "FetchAccount",
			Handler:    _Accounts_FetchAccount_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "internal/proto/goapi.proto",
}

Accounts_ServiceDesc is the grpc.ServiceDesc for Accounts service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_internal_proto_goapi_proto protoreflect.FileDescriptor

Functions

func CoreAccount

func CoreAccount(account *Account) (*goapi.Account, error)

CoreAccount converts a proto account struct to goapi.Account

func RegisterAccountsServer

func RegisterAccountsServer(s grpc.ServiceRegistrar, srv AccountsServer)

Types

type Account

type Account struct {
	Id          string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	CreatedTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_time,json=createdTime,proto3" json:"created_time,omitempty"`
	UpdatedTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_time,json=updatedTime,proto3" json:"updated_time,omitempty"`
	FirstName   string                 `protobuf:"bytes,4,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"`
	LastName    string                 `protobuf:"bytes,5,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"`
	Gender      string                 `protobuf:"bytes,7,opt,name=gender,proto3" json:"gender,omitempty"`
	PassHash    string                 `protobuf:"bytes,8,opt,name=pass_hash,json=passHash,proto3" json:"pass_hash,omitempty"`
	Email       string                 `protobuf:"bytes,9,opt,name=email,proto3" json:"email,omitempty"`
	// contains filtered or unexported fields
}

func AccountProto

func AccountProto(account *goapi.Account) (*Account, error)

func (*Account) Descriptor deprecated

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

Deprecated: Use Account.ProtoReflect.Descriptor instead.

func (*Account) GetCreatedTime

func (x *Account) GetCreatedTime() *timestamppb.Timestamp

func (*Account) GetEmail

func (x *Account) GetEmail() string

func (*Account) GetFirstName

func (x *Account) GetFirstName() string

func (*Account) GetGender

func (x *Account) GetGender() string

func (*Account) GetId

func (x *Account) GetId() string

func (*Account) GetLastName

func (x *Account) GetLastName() string

func (*Account) GetPassHash

func (x *Account) GetPassHash() string

func (*Account) GetUpdatedTime

func (x *Account) GetUpdatedTime() *timestamppb.Timestamp

func (*Account) ProtoMessage

func (*Account) ProtoMessage()

func (*Account) ProtoReflect

func (x *Account) ProtoReflect() protoreflect.Message

func (*Account) Reset

func (x *Account) Reset()

func (*Account) String

func (x *Account) String() string

type AccountID

type AccountID struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*AccountID) Descriptor deprecated

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

Deprecated: Use AccountID.ProtoReflect.Descriptor instead.

func (*AccountID) GetId

func (x *AccountID) GetId() string

func (*AccountID) ProtoMessage

func (*AccountID) ProtoMessage()

func (*AccountID) ProtoReflect

func (x *AccountID) ProtoReflect() protoreflect.Message

func (*AccountID) Reset

func (x *AccountID) Reset()

func (*AccountID) String

func (x *AccountID) String() string

type AccountsClient

type AccountsClient interface {
	AddAccount(ctx context.Context, in *AddAccountMessage, opts ...grpc.CallOption) (*Account, error)
	FetchAccount(ctx context.Context, in *AccountID, opts ...grpc.CallOption) (*Account, error)
}

AccountsClient is the client API for Accounts service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewAccountsClient

func NewAccountsClient(cc grpc.ClientConnInterface) AccountsClient

type AccountsServer

type AccountsServer interface {
	AddAccount(context.Context, *AddAccountMessage) (*Account, error)
	FetchAccount(context.Context, *AccountID) (*Account, error)
	// contains filtered or unexported methods
}

AccountsServer is the server API for Accounts service. All implementations must embed UnimplementedAccountsServer for forward compatibility

type AddAccountMessage

type AddAccountMessage struct {
	FirstName string `protobuf:"bytes,1,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"`
	LastName  string `protobuf:"bytes,2,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"`
	Gender    string `protobuf:"bytes,4,opt,name=gender,proto3" json:"gender,omitempty"`
	Password  string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"`
	Email     string `protobuf:"bytes,6,opt,name=email,proto3" json:"email,omitempty"`
	// contains filtered or unexported fields
}

func (*AddAccountMessage) Descriptor deprecated

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

Deprecated: Use AddAccountMessage.ProtoReflect.Descriptor instead.

func (*AddAccountMessage) GetEmail

func (x *AddAccountMessage) GetEmail() string

func (*AddAccountMessage) GetFirstName

func (x *AddAccountMessage) GetFirstName() string

func (*AddAccountMessage) GetGender

func (x *AddAccountMessage) GetGender() string

func (*AddAccountMessage) GetLastName

func (x *AddAccountMessage) GetLastName() string

func (*AddAccountMessage) GetPassword

func (x *AddAccountMessage) GetPassword() string

func (*AddAccountMessage) ProtoMessage

func (*AddAccountMessage) ProtoMessage()

func (*AddAccountMessage) ProtoReflect

func (x *AddAccountMessage) ProtoReflect() protoreflect.Message

func (*AddAccountMessage) Reset

func (x *AddAccountMessage) Reset()

func (*AddAccountMessage) String

func (x *AddAccountMessage) String() string

func (*AddAccountMessage) ToCoreAccount

func (a *AddAccountMessage) ToCoreAccount() *goapi.Account

ToCoreAccount converts AddAccountMessage to goapim.Account

type Model

type Model struct {
	Id          string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	CreatedTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_time,json=createdTime,proto3" json:"created_time,omitempty"`
	UpdatedTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_time,json=updatedTime,proto3" json:"updated_time,omitempty"`
	// contains filtered or unexported fields
}

func (*Model) Descriptor deprecated

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

Deprecated: Use Model.ProtoReflect.Descriptor instead.

func (*Model) GetCreatedTime

func (x *Model) GetCreatedTime() *timestamppb.Timestamp

func (*Model) GetId

func (x *Model) GetId() string

func (*Model) GetUpdatedTime

func (x *Model) GetUpdatedTime() *timestamppb.Timestamp

func (*Model) ProtoMessage

func (*Model) ProtoMessage()

func (*Model) ProtoReflect

func (x *Model) ProtoReflect() protoreflect.Message

func (*Model) Reset

func (x *Model) Reset()

func (*Model) String

func (x *Model) String() string

type UnimplementedAccountsServer

type UnimplementedAccountsServer struct {
}

UnimplementedAccountsServer must be embedded to have forward compatible implementations.

func (UnimplementedAccountsServer) AddAccount

func (UnimplementedAccountsServer) FetchAccount

type UnsafeAccountsServer

type UnsafeAccountsServer interface {
	// contains filtered or unexported methods
}

UnsafeAccountsServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AccountsServer will result in compilation errors.

Jump to

Keyboard shortcuts

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