Help us shape the future of Go! Take the 2026 Go Developer Survey

pb

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Kashi_CreateUser_FullMethodName     = "/pb.Kashi/CreateUser"
	Kashi_LoginUser_FullMethodName      = "/pb.Kashi/LoginUser"
	Kashi_CreateInvetory_FullMethodName = "/pb.Kashi/CreateInvetory"
)

Variables

View Source
var (
	InventoryType_name = map[int32]string{
		0: "INVENTORY_TYPE_UNSPECIFIED",
		1: "INVENTORY_TYPE_WAREHOUSE",
		2: "INVENTORY_TYPE_STORE",
	}
	InventoryType_value = map[string]int32{
		"INVENTORY_TYPE_UNSPECIFIED": 0,
		"INVENTORY_TYPE_WAREHOUSE":   1,
		"INVENTORY_TYPE_STORE":       2,
	}
)

Enum value maps for InventoryType.

View Source
var File_inventory_proto protoreflect.FileDescriptor
View Source
var File_rpc_create_inventory_proto protoreflect.FileDescriptor
View Source
var File_rpc_create_user_proto protoreflect.FileDescriptor
View Source
var File_rpc_login_user_proto protoreflect.FileDescriptor
View Source
var File_service_kashi_proto protoreflect.FileDescriptor
View Source
var Kashi_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "pb.Kashi",
	HandlerType: (*KashiServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateUser",
			Handler:    _Kashi_CreateUser_Handler,
		},
		{
			MethodName: "LoginUser",
			Handler:    _Kashi_LoginUser_Handler,
		},
		{
			MethodName: "CreateInvetory",
			Handler:    _Kashi_CreateInvetory_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "service_kashi.proto",
}

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

Functions

func RegisterKashiHandler

func RegisterKashiHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterKashiHandler registers the http handlers for service Kashi to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterKashiHandlerClient

func RegisterKashiHandlerClient(ctx context.Context, mux *runtime.ServeMux, client KashiClient) error

RegisterKashiHandlerClient registers the http handlers for service Kashi to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "KashiClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "KashiClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "KashiClient" to call the correct interceptors. This client ignores the HTTP middlewares.

func RegisterKashiHandlerFromEndpoint

func RegisterKashiHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterKashiHandlerFromEndpoint is same as RegisterKashiHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterKashiHandlerServer

func RegisterKashiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server KashiServer) error

RegisterKashiHandlerServer registers the http handlers for service Kashi to "mux". UnaryRPC :call KashiServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterKashiHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterKashiServer

func RegisterKashiServer(s grpc.ServiceRegistrar, srv KashiServer)

Types

type CreateInventoryRequest

type CreateInventoryRequest struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateInventoryRequest) Descriptor deprecated

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

Deprecated: Use CreateInventoryRequest.ProtoReflect.Descriptor instead.

func (*CreateInventoryRequest) GetCode

func (x *CreateInventoryRequest) GetCode() string

func (*CreateInventoryRequest) GetName

func (x *CreateInventoryRequest) GetName() string

func (*CreateInventoryRequest) GetType

func (x *CreateInventoryRequest) GetType() string

func (*CreateInventoryRequest) ProtoMessage

func (*CreateInventoryRequest) ProtoMessage()

func (*CreateInventoryRequest) ProtoReflect

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

func (*CreateInventoryRequest) Reset

func (x *CreateInventoryRequest) Reset()

func (*CreateInventoryRequest) String

func (x *CreateInventoryRequest) String() string

type CreateInventoryResponse

type CreateInventoryResponse struct {
	Inventory *Inventory `protobuf:"bytes,1,opt,name=inventory,proto3" json:"inventory,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateInventoryResponse) Descriptor deprecated

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

Deprecated: Use CreateInventoryResponse.ProtoReflect.Descriptor instead.

func (*CreateInventoryResponse) GetInventory

func (x *CreateInventoryResponse) GetInventory() *Inventory

func (*CreateInventoryResponse) ProtoMessage

func (*CreateInventoryResponse) ProtoMessage()

func (*CreateInventoryResponse) ProtoReflect

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

func (*CreateInventoryResponse) Reset

func (x *CreateInventoryResponse) Reset()

func (*CreateInventoryResponse) String

func (x *CreateInventoryResponse) String() string

type CreateUserRequest

type CreateUserRequest struct {
	Name         string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Email        string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
	HashPassword string `protobuf:"bytes,3,opt,name=hash_password,json=hashPassword,proto3" json:"hash_password,omitempty"`
	Activated    bool   `protobuf:"varint,4,opt,name=activated,proto3" json:"activated,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateUserRequest) Descriptor deprecated

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

Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead.

func (*CreateUserRequest) GetActivated

func (x *CreateUserRequest) GetActivated() bool

func (*CreateUserRequest) GetEmail

func (x *CreateUserRequest) GetEmail() string

func (*CreateUserRequest) GetHashPassword

func (x *CreateUserRequest) GetHashPassword() string

func (*CreateUserRequest) GetName

func (x *CreateUserRequest) GetName() string

func (*CreateUserRequest) ProtoMessage

func (*CreateUserRequest) ProtoMessage()

func (*CreateUserRequest) ProtoReflect

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

func (*CreateUserRequest) Reset

func (x *CreateUserRequest) Reset()

func (*CreateUserRequest) String

func (x *CreateUserRequest) String() string

type CreateUserResponse

type CreateUserResponse struct {
	User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateUserResponse) Descriptor deprecated

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

Deprecated: Use CreateUserResponse.ProtoReflect.Descriptor instead.

func (*CreateUserResponse) GetUser

func (x *CreateUserResponse) GetUser() *User

func (*CreateUserResponse) ProtoMessage

func (*CreateUserResponse) ProtoMessage()

func (*CreateUserResponse) ProtoReflect

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

func (*CreateUserResponse) Reset

func (x *CreateUserResponse) Reset()

func (*CreateUserResponse) String

func (x *CreateUserResponse) String() string

type Inventory

type Inventory struct {
	Name string        `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Code string        `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
	Type InventoryType `protobuf:"varint,3,opt,name=type,proto3,enum=pb.InventoryType" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*Inventory) Descriptor deprecated

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

Deprecated: Use Inventory.ProtoReflect.Descriptor instead.

func (*Inventory) GetCode

func (x *Inventory) GetCode() string

func (*Inventory) GetName

func (x *Inventory) GetName() string

func (*Inventory) GetType

func (x *Inventory) GetType() InventoryType

func (*Inventory) ProtoMessage

func (*Inventory) ProtoMessage()

func (*Inventory) ProtoReflect

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

func (*Inventory) Reset

func (x *Inventory) Reset()

func (*Inventory) String

func (x *Inventory) String() string

type InventoryType

type InventoryType int32
const (
	InventoryType_INVENTORY_TYPE_UNSPECIFIED InventoryType = 0
	InventoryType_INVENTORY_TYPE_WAREHOUSE   InventoryType = 1
	InventoryType_INVENTORY_TYPE_STORE       InventoryType = 2
)

func (InventoryType) Descriptor

func (InventoryType) Enum

func (x InventoryType) Enum() *InventoryType

func (InventoryType) EnumDescriptor deprecated

func (InventoryType) EnumDescriptor() ([]byte, []int)

Deprecated: Use InventoryType.Descriptor instead.

func (InventoryType) Number

func (InventoryType) String

func (x InventoryType) String() string

func (InventoryType) Type

type KashiClient

type KashiClient interface {
	CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error)
	LoginUser(ctx context.Context, in *LoginUserRequest, opts ...grpc.CallOption) (*LoginUserResponse, error)
	CreateInvetory(ctx context.Context, in *CreateInventoryRequest, opts ...grpc.CallOption) (*CreateInventoryResponse, error)
}

KashiClient is the client API for Kashi 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 NewKashiClient

func NewKashiClient(cc grpc.ClientConnInterface) KashiClient

type KashiServer

type KashiServer interface {
	CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error)
	LoginUser(context.Context, *LoginUserRequest) (*LoginUserResponse, error)
	CreateInvetory(context.Context, *CreateInventoryRequest) (*CreateInventoryResponse, error)
	// contains filtered or unexported methods
}

KashiServer is the server API for Kashi service. All implementations must embed UnimplementedKashiServer for forward compatibility.

type LoginUserRequest

type LoginUserRequest struct {
	Name     string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginUserRequest) Descriptor deprecated

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

Deprecated: Use LoginUserRequest.ProtoReflect.Descriptor instead.

func (*LoginUserRequest) GetName

func (x *LoginUserRequest) GetName() string

func (*LoginUserRequest) GetPassword

func (x *LoginUserRequest) GetPassword() string

func (*LoginUserRequest) ProtoMessage

func (*LoginUserRequest) ProtoMessage()

func (*LoginUserRequest) ProtoReflect

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

func (*LoginUserRequest) Reset

func (x *LoginUserRequest) Reset()

func (*LoginUserRequest) String

func (x *LoginUserRequest) String() string

type LoginUserResponse

type LoginUserResponse struct {
	User                  *User                  `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	SessionId             string                 `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	AccessToken           string                 `protobuf:"bytes,3,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	RefreshToken          string                 `protobuf:"bytes,4,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	AccessTokenExpiresAt  *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=access_token_expires_at,json=accessTokenExpiresAt,proto3" json:"access_token_expires_at,omitempty"`
	RefreshTokenExpiresAt *timestamppb.Timestamp `` /* 128-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*LoginUserResponse) Descriptor deprecated

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

Deprecated: Use LoginUserResponse.ProtoReflect.Descriptor instead.

func (*LoginUserResponse) GetAccessToken

func (x *LoginUserResponse) GetAccessToken() string

func (*LoginUserResponse) GetAccessTokenExpiresAt

func (x *LoginUserResponse) GetAccessTokenExpiresAt() *timestamppb.Timestamp

func (*LoginUserResponse) GetRefreshToken

func (x *LoginUserResponse) GetRefreshToken() string

func (*LoginUserResponse) GetRefreshTokenExpiresAt

func (x *LoginUserResponse) GetRefreshTokenExpiresAt() *timestamppb.Timestamp

func (*LoginUserResponse) GetSessionId

func (x *LoginUserResponse) GetSessionId() string

func (*LoginUserResponse) GetUser

func (x *LoginUserResponse) GetUser() *User

func (*LoginUserResponse) ProtoMessage

func (*LoginUserResponse) ProtoMessage()

func (*LoginUserResponse) ProtoReflect

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

func (*LoginUserResponse) Reset

func (x *LoginUserResponse) Reset()

func (*LoginUserResponse) String

func (x *LoginUserResponse) String() string

type UnimplementedKashiServer

type UnimplementedKashiServer struct{}

UnimplementedKashiServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedKashiServer) CreateInvetory

func (UnimplementedKashiServer) CreateUser

func (UnimplementedKashiServer) LoginUser

type UnsafeKashiServer

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

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

type User

type User struct {
	Name              string                 `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Password          string                 `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	Email             string                 `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	Activated         bool                   `protobuf:"varint,4,opt,name=activated,proto3" json:"activated,omitempty"`
	PasswordChangedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=password_changed_at,json=passwordChangedAt,proto3" json:"password_changed_at,omitempty"`
	CreatedAt         *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	// contains filtered or unexported fields
}

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetActivated

func (x *User) GetActivated() bool

func (*User) GetCreatedAt

func (x *User) GetCreatedAt() *timestamppb.Timestamp

func (*User) GetEmail

func (x *User) GetEmail() string

func (*User) GetName

func (x *User) GetName() string

func (*User) GetPassword

func (x *User) GetPassword() string

func (*User) GetPasswordChangedAt

func (x *User) GetPasswordChangedAt() *timestamppb.Timestamp

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

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

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

Jump to

Keyboard shortcuts

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