Documentation ¶
Overview ¶
Package pb is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func DefaultDeleteExample(ctx context.Context, in *Example, db *gorm.DB) error
- func DefaultDeleteExampleSet(ctx context.Context, in []*Example, db *gorm.DB) error
- func RegisterApiServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterApiServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ApiServiceClient) error
- func RegisterApiServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterApiServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ApiServiceServer) error
- func RegisterApiServiceServer(s grpc.ServiceRegistrar, srv ApiServiceServer)
- type ApiServiceClient
- type ApiServiceServer
- type Empty
- type Example
- func DefaultApplyFieldMaskExample(ctx context.Context, patchee *Example, patcher *Example, ...) (*Example, error)
- func DefaultCreateExample(ctx context.Context, in *Example, db *gorm.DB) (*Example, error)
- func DefaultListExample(ctx context.Context, db *gorm.DB) ([]*Example, error)
- func DefaultPatchExample(ctx context.Context, in *Example, updateMask *field_mask.FieldMask, ...) (*Example, error)
- func DefaultPatchSetExample(ctx context.Context, objects []*Example, updateMasks []*field_mask.FieldMask, ...) ([]*Example, error)
- func DefaultReadExample(ctx context.Context, in *Example, db *gorm.DB) (*Example, error)
- func DefaultStrictUpdateExample(ctx context.Context, in *Example, db *gorm.DB) (*Example, error)
- func (*Example) Descriptor() ([]byte, []int)deprecated
- func (x *Example) GetCratedAt() *timestamppb.Timestamp
- func (x *Example) GetDeletedAt() *timestamppb.Timestamp
- func (x *Example) GetId() uint64
- func (x *Example) GetUpdatedAt() *timestamppb.Timestamp
- func (*Example) ProtoMessage()
- func (x *Example) ProtoReflect() protoreflect.Message
- func (x *Example) Reset()
- func (x *Example) String() string
- func (m *Example) ToORM(ctx context.Context) (ExampleORM, error)
- type ExampleORM
- type ExampleORMWithAfterCreate_
- type ExampleORMWithAfterDeleteSet
- type ExampleORMWithAfterDelete_
- type ExampleORMWithAfterListFind
- type ExampleORMWithAfterReadFind
- type ExampleORMWithAfterStrictUpdateSave
- type ExampleORMWithBeforeCreate_
- type ExampleORMWithBeforeDeleteSet
- type ExampleORMWithBeforeDelete_
- type ExampleORMWithBeforeListApplyQuery
- type ExampleORMWithBeforeListFind
- type ExampleORMWithBeforeReadApplyQuery
- type ExampleORMWithBeforeReadFind
- type ExampleORMWithBeforeStrictUpdateCleanup
- type ExampleORMWithBeforeStrictUpdateSave
- type ExampleWithAfterPatchSave
- type ExampleWithAfterToORM
- type ExampleWithAfterToPB
- type ExampleWithBeforePatchApplyFieldMask
- type ExampleWithBeforePatchRead
- type ExampleWithBeforePatchSave
- type ExampleWithBeforeToORM
- type ExampleWithBeforeToPB
- type HelloResponse
- func (*HelloResponse) Descriptor() ([]byte, []int)deprecated
- func (x *HelloResponse) GetHttpStatus() *StandardResponse
- func (x *HelloResponse) GetMessage() string
- func (*HelloResponse) ProtoMessage()
- func (x *HelloResponse) ProtoReflect() protoreflect.Message
- func (x *HelloResponse) Reset()
- func (x *HelloResponse) String() string
- type StandardResponse
- func (*StandardResponse) Descriptor() ([]byte, []int)deprecated
- func (x *StandardResponse) GetCode() uint64
- func (x *StandardResponse) GetMessage() string
- func (x *StandardResponse) GetSuccess() bool
- func (*StandardResponse) ProtoMessage()
- func (x *StandardResponse) ProtoReflect() protoreflect.Message
- func (x *StandardResponse) Reset()
- func (x *StandardResponse) String() string
- type UnimplementedApiServiceServer
- type UnsafeApiServiceServer
Constants ¶
This section is empty.
Variables ¶
var ApiService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "responsetimesimulation.service.ApiService", HandlerType: (*ApiServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Hello", Handler: _ApiService_Hello_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "api.proto", }
ApiService_ServiceDesc is the grpc.ServiceDesc for ApiService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_api_proto protoreflect.FileDescriptor
var File_gorm_proto protoreflect.FileDescriptor
Functions ¶
func DefaultDeleteExample ¶
func DefaultDeleteExampleSet ¶
func RegisterApiServiceHandler ¶
func RegisterApiServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterApiServiceHandler registers the http handlers for service ApiService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterApiServiceHandlerClient ¶
func RegisterApiServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ApiServiceClient) error
RegisterApiServiceHandlerClient registers the http handlers for service ApiService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ApiServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ApiServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ApiServiceClient" to call the correct interceptors.
func RegisterApiServiceHandlerFromEndpoint ¶
func RegisterApiServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterApiServiceHandlerFromEndpoint is same as RegisterApiServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterApiServiceHandlerServer ¶
func RegisterApiServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ApiServiceServer) error
RegisterApiServiceHandlerServer registers the http handlers for service ApiService to "mux". UnaryRPC :call ApiServiceServer 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 RegisterApiServiceHandlerFromEndpoint instead.
func RegisterApiServiceServer ¶
func RegisterApiServiceServer(s grpc.ServiceRegistrar, srv ApiServiceServer)
Types ¶
type ApiServiceClient ¶
type ApiServiceClient interface {
Hello(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*HelloResponse, error)
}
ApiServiceClient is the client API for ApiService 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 NewApiServiceClient ¶
func NewApiServiceClient(cc grpc.ClientConnInterface) ApiServiceClient
type ApiServiceServer ¶
type ApiServiceServer interface { Hello(context.Context, *Empty) (*HelloResponse, error) // contains filtered or unexported methods }
ApiServiceServer is the server API for ApiService service. All implementations must embed UnimplementedApiServiceServer for forward compatibility
type Empty ¶
type Empty struct {
// contains filtered or unexported fields
}
func (*Empty) Descriptor
deprecated
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) ProtoReflect ¶
func (x *Empty) ProtoReflect() protoreflect.Message
type Example ¶
type Example struct { Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` CratedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=cratedAt,proto3" json:"cratedAt,omitempty"` UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` DeletedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=deletedAt,proto3" json:"deletedAt,omitempty"` // contains filtered or unexported fields }
func DefaultApplyFieldMaskExample ¶
func DefaultApplyFieldMaskExample(ctx context.Context, patchee *Example, patcher *Example, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*Example, error)
DefaultApplyFieldMaskExample patches an pbObject with patcher according to a field mask.
func DefaultCreateExample ¶
DefaultCreateExample executes a basic gorm create call
func DefaultListExample ¶
DefaultListExample executes a gorm list call
func DefaultPatchExample ¶
func DefaultPatchExample(ctx context.Context, in *Example, updateMask *field_mask.FieldMask, db *gorm.DB) (*Example, error)
DefaultPatchExample executes a basic gorm update call with patch behavior
func DefaultPatchSetExample ¶
func DefaultPatchSetExample(ctx context.Context, objects []*Example, updateMasks []*field_mask.FieldMask, db *gorm.DB) ([]*Example, error)
DefaultPatchSetExample executes a bulk gorm update call with patch behavior
func DefaultReadExample ¶
func DefaultStrictUpdateExample ¶
DefaultStrictUpdateExample clears / replaces / appends first level 1:many children and then executes a gorm update call
func (*Example) Descriptor
deprecated
func (*Example) GetCratedAt ¶
func (x *Example) GetCratedAt() *timestamppb.Timestamp
func (*Example) GetDeletedAt ¶
func (x *Example) GetDeletedAt() *timestamppb.Timestamp
func (*Example) GetUpdatedAt ¶
func (x *Example) GetUpdatedAt() *timestamppb.Timestamp
func (*Example) ProtoMessage ¶
func (*Example) ProtoMessage()
func (*Example) ProtoReflect ¶
func (x *Example) ProtoReflect() protoreflect.Message
type ExampleORM ¶
type ExampleORM struct { CratedAt *time.Time DeletedAt *time.Time Id uint64 `gorm:"primary_key;not null"` UpdatedAt *time.Time }
func (ExampleORM) TableName ¶
func (ExampleORM) TableName() string
TableName overrides the default tablename generated by GORM
type ExampleWithAfterToORM ¶
type ExampleWithAfterToORM interface {
AfterToORM(context.Context, *ExampleORM) error
}
ExampleAfterToORM called after default ToORM code
type ExampleWithAfterToPB ¶
ExampleAfterToPB called after default ToPB code
type ExampleWithBeforeToORM ¶
type ExampleWithBeforeToORM interface {
BeforeToORM(context.Context, *ExampleORM) error
}
ExampleBeforeToORM called before default ToORM code
type ExampleWithBeforeToPB ¶
ExampleBeforeToPB called before default ToPB code
type HelloResponse ¶
type HelloResponse struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` HttpStatus *StandardResponse `protobuf:"bytes,2,opt,name=http_status,json=httpStatus,proto3" json:"http_status,omitempty"` // contains filtered or unexported fields }
func (*HelloResponse) Descriptor
deprecated
func (*HelloResponse) Descriptor() ([]byte, []int)
Deprecated: Use HelloResponse.ProtoReflect.Descriptor instead.
func (*HelloResponse) GetHttpStatus ¶
func (x *HelloResponse) GetHttpStatus() *StandardResponse
func (*HelloResponse) GetMessage ¶
func (x *HelloResponse) GetMessage() string
func (*HelloResponse) ProtoMessage ¶
func (*HelloResponse) ProtoMessage()
func (*HelloResponse) ProtoReflect ¶
func (x *HelloResponse) ProtoReflect() protoreflect.Message
func (*HelloResponse) Reset ¶
func (x *HelloResponse) Reset()
func (*HelloResponse) String ¶
func (x *HelloResponse) String() string
type StandardResponse ¶
type StandardResponse struct { Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` Code uint64 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"` Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
func (*StandardResponse) Descriptor
deprecated
func (*StandardResponse) Descriptor() ([]byte, []int)
Deprecated: Use StandardResponse.ProtoReflect.Descriptor instead.
func (*StandardResponse) GetCode ¶
func (x *StandardResponse) GetCode() uint64
func (*StandardResponse) GetMessage ¶
func (x *StandardResponse) GetMessage() string
func (*StandardResponse) GetSuccess ¶
func (x *StandardResponse) GetSuccess() bool
func (*StandardResponse) ProtoMessage ¶
func (*StandardResponse) ProtoMessage()
func (*StandardResponse) ProtoReflect ¶
func (x *StandardResponse) ProtoReflect() protoreflect.Message
func (*StandardResponse) Reset ¶
func (x *StandardResponse) Reset()
func (*StandardResponse) String ¶
func (x *StandardResponse) String() string
type UnimplementedApiServiceServer ¶
type UnimplementedApiServiceServer struct { }
UnimplementedApiServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedApiServiceServer) Hello ¶
func (UnimplementedApiServiceServer) Hello(context.Context, *Empty) (*HelloResponse, error)
type UnsafeApiServiceServer ¶
type UnsafeApiServiceServer interface {
// contains filtered or unexported methods
}
UnsafeApiServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ApiServiceServer will result in compilation errors.