pb

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
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)

Functions

func DefaultDeleteExample

func DefaultDeleteExample(ctx context.Context, in *Example, db *gorm.DB) error

func DefaultDeleteExampleSet

func DefaultDeleteExampleSet(ctx context.Context, in []*Example, db *gorm.DB) error

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) Descriptor() ([]byte, []int)

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

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

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

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

func DefaultCreateExample(ctx context.Context, in *Example, db *gorm.DB) (*Example, error)

DefaultCreateExample executes a basic gorm create call

func DefaultListExample

func DefaultListExample(ctx context.Context, db *gorm.DB) ([]*Example, error)

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 DefaultReadExample(ctx context.Context, in *Example, db *gorm.DB) (*Example, error)

func DefaultStrictUpdateExample

func DefaultStrictUpdateExample(ctx context.Context, in *Example, db *gorm.DB) (*Example, error)

DefaultStrictUpdateExample clears / replaces / appends first level 1:many children and then executes a gorm update call

func (*Example) Descriptor deprecated

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

Deprecated: Use Example.ProtoReflect.Descriptor instead.

func (*Example) GetCratedAt

func (x *Example) GetCratedAt() *timestamppb.Timestamp

func (*Example) GetDeletedAt

func (x *Example) GetDeletedAt() *timestamppb.Timestamp

func (*Example) GetId

func (x *Example) GetId() uint64

func (*Example) GetUpdatedAt

func (x *Example) GetUpdatedAt() *timestamppb.Timestamp

func (*Example) ProtoMessage

func (*Example) ProtoMessage()

func (*Example) ProtoReflect

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

func (*Example) Reset

func (x *Example) Reset()

func (*Example) String

func (x *Example) String() string

func (*Example) ToORM

func (m *Example) ToORM(ctx context.Context) (ExampleORM, error)

ToORM runs the BeforeToORM hook if present, converts the fields of this object to ORM format, runs the AfterToORM hook, then returns the ORM object

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

func (*ExampleORM) ToPB

func (m *ExampleORM) ToPB(ctx context.Context) (Example, error)

ToPB runs the BeforeToPB hook if present, converts the fields of this object to PB format, runs the AfterToPB hook, then returns the PB object

type ExampleORMWithAfterCreate_

type ExampleORMWithAfterCreate_ interface {
	AfterCreate_(context.Context, *gorm.DB) error
}

type ExampleORMWithAfterDeleteSet

type ExampleORMWithAfterDeleteSet interface {
	AfterDeleteSet(context.Context, []*Example, *gorm.DB) error
}

type ExampleORMWithAfterDelete_

type ExampleORMWithAfterDelete_ interface {
	AfterDelete_(context.Context, *gorm.DB) error
}

type ExampleORMWithAfterListFind

type ExampleORMWithAfterListFind interface {
	AfterListFind(context.Context, *gorm.DB, *[]ExampleORM) error
}

type ExampleORMWithAfterReadFind

type ExampleORMWithAfterReadFind interface {
	AfterReadFind(context.Context, *gorm.DB) error
}

type ExampleORMWithAfterStrictUpdateSave

type ExampleORMWithAfterStrictUpdateSave interface {
	AfterStrictUpdateSave(context.Context, *gorm.DB) error
}

type ExampleORMWithBeforeCreate_

type ExampleORMWithBeforeCreate_ interface {
	BeforeCreate_(context.Context, *gorm.DB) (*gorm.DB, error)
}

type ExampleORMWithBeforeDeleteSet

type ExampleORMWithBeforeDeleteSet interface {
	BeforeDeleteSet(context.Context, []*Example, *gorm.DB) (*gorm.DB, error)
}

type ExampleORMWithBeforeDelete_

type ExampleORMWithBeforeDelete_ interface {
	BeforeDelete_(context.Context, *gorm.DB) (*gorm.DB, error)
}

type ExampleORMWithBeforeListApplyQuery

type ExampleORMWithBeforeListApplyQuery interface {
	BeforeListApplyQuery(context.Context, *gorm.DB) (*gorm.DB, error)
}

type ExampleORMWithBeforeListFind

type ExampleORMWithBeforeListFind interface {
	BeforeListFind(context.Context, *gorm.DB) (*gorm.DB, error)
}

type ExampleORMWithBeforeReadApplyQuery

type ExampleORMWithBeforeReadApplyQuery interface {
	BeforeReadApplyQuery(context.Context, *gorm.DB) (*gorm.DB, error)
}

type ExampleORMWithBeforeReadFind

type ExampleORMWithBeforeReadFind interface {
	BeforeReadFind(context.Context, *gorm.DB) (*gorm.DB, error)
}

type ExampleORMWithBeforeStrictUpdateCleanup

type ExampleORMWithBeforeStrictUpdateCleanup interface {
	BeforeStrictUpdateCleanup(context.Context, *gorm.DB) (*gorm.DB, error)
}

type ExampleORMWithBeforeStrictUpdateSave

type ExampleORMWithBeforeStrictUpdateSave interface {
	BeforeStrictUpdateSave(context.Context, *gorm.DB) (*gorm.DB, error)
}

type ExampleWithAfterPatchSave

type ExampleWithAfterPatchSave interface {
	AfterPatchSave(context.Context, *Example, *field_mask.FieldMask, *gorm.DB) error
}

type ExampleWithAfterToORM

type ExampleWithAfterToORM interface {
	AfterToORM(context.Context, *ExampleORM) error
}

ExampleAfterToORM called after default ToORM code

type ExampleWithAfterToPB

type ExampleWithAfterToPB interface {
	AfterToPB(context.Context, *Example) error
}

ExampleAfterToPB called after default ToPB code

type ExampleWithBeforePatchApplyFieldMask

type ExampleWithBeforePatchApplyFieldMask interface {
	BeforePatchApplyFieldMask(context.Context, *Example, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error)
}

type ExampleWithBeforePatchRead

type ExampleWithBeforePatchRead interface {
	BeforePatchRead(context.Context, *Example, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error)
}

type ExampleWithBeforePatchSave

type ExampleWithBeforePatchSave interface {
	BeforePatchSave(context.Context, *Example, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error)
}

type ExampleWithBeforeToORM

type ExampleWithBeforeToORM interface {
	BeforeToORM(context.Context, *ExampleORM) error
}

ExampleBeforeToORM called before default ToORM code

type ExampleWithBeforeToPB

type ExampleWithBeforeToPB interface {
	BeforeToPB(context.Context, *Example) error
}

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

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.

Jump to

Keyboard shortcuts

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