db_pb

package
v0.0.0-...-ab7124e Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package db_pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_entry_db_db_pb_db_proto protoreflect.FileDescriptor

Functions

func RegisterDbGinServer

func RegisterDbGinServer(r gin.IRouter, server DbServer)

func RegisterDbHandler

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

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

func RegisterDbHandlerClient

func RegisterDbHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DbClient) error

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

func RegisterDbHandlerFromEndpoint

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

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

func RegisterDbHandlerServer

func RegisterDbHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DbServer) error

RegisterDbHandlerServer registers the http handlers for service Db to "mux". UnaryRPC :call DbServer 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 RegisterDbHandlerFromEndpoint instead.

func RegisterDbServer

func RegisterDbServer(s grpc.ServiceRegistrar, srv DbServer)

Types

type CountRequest

type CountRequest struct {

	// specify the table name
	Table string `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"`
	// contains filtered or unexported fields
}

Count records in a table

func (*CountRequest) Descriptor deprecated

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

Deprecated: Use CountRequest.ProtoReflect.Descriptor instead.

func (*CountRequest) GetTable

func (x *CountRequest) GetTable() string

func (*CountRequest) ProtoMessage

func (*CountRequest) ProtoMessage()

func (*CountRequest) ProtoReflect

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

func (*CountRequest) Reset

func (x *CountRequest) Reset()

func (*CountRequest) String

func (x *CountRequest) String() string

func (*CountRequest) Validate

func (this *CountRequest) Validate() error

type CountResponse

type CountResponse struct {

	// the number of records in the table
	Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
	// contains filtered or unexported fields
}

func (*CountResponse) Descriptor deprecated

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

Deprecated: Use CountResponse.ProtoReflect.Descriptor instead.

func (*CountResponse) GetCount

func (x *CountResponse) GetCount() int32

func (*CountResponse) ProtoMessage

func (*CountResponse) ProtoMessage()

func (*CountResponse) ProtoReflect

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

func (*CountResponse) Reset

func (x *CountResponse) Reset()

func (*CountResponse) String

func (x *CountResponse) String() string

func (*CountResponse) Validate

func (this *CountResponse) Validate() error

type CreateRequest

type CreateRequest struct {

	// Optional table name. Defaults to 'default'
	Table string `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"`
	// JSON encoded record or records (can be array or object)
	Record *structpb.Struct `protobuf:"bytes,2,opt,name=record,proto3" json:"record,omitempty"`
	// contains filtered or unexported fields
}

Create a record in the database. Optionally include an "id" field otherwise it's set automatically.

func (*CreateRequest) Descriptor deprecated

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

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetRecord

func (x *CreateRequest) GetRecord() *structpb.Struct

func (*CreateRequest) GetTable

func (x *CreateRequest) GetTable() string

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

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

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

func (*CreateRequest) Validate

func (this *CreateRequest) Validate() error

type CreateResponse

type CreateResponse struct {

	// The id of the record (either specified or automatically created)
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateResponse) Descriptor deprecated

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

Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.

func (*CreateResponse) GetId

func (x *CreateResponse) GetId() string

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) ProtoReflect

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

func (*CreateResponse) Reset

func (x *CreateResponse) Reset()

func (*CreateResponse) String

func (x *CreateResponse) String() string

func (*CreateResponse) Validate

func (this *CreateResponse) Validate() error

type DbClient

DbClient is the client API for Db 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 GetDbClient

func GetDbClient(srv string, opts ...func(cfg *grpcc.Cfg)) DbClient

func NewDbClient

func NewDbClient(cc grpc.ClientConnInterface) DbClient

type DbServer

DbServer is the server API for Db service. All implementations should embed UnimplementedDbServer for forward compatibility

type DeleteRequest

type DeleteRequest struct {

	// Optional table name. Defaults to 'default'
	Table string `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"`
	// id of the record
	Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

Delete a record in the database by id.

func (*DeleteRequest) Descriptor deprecated

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

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetId

func (x *DeleteRequest) GetId() string

func (*DeleteRequest) GetTable

func (x *DeleteRequest) GetTable() string

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

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

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

func (*DeleteRequest) Validate

func (this *DeleteRequest) Validate() error

type DeleteResponse

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

func (*DeleteResponse) Descriptor deprecated

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

Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) ProtoReflect

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

func (*DeleteResponse) Reset

func (x *DeleteResponse) Reset()

func (*DeleteResponse) String

func (x *DeleteResponse) String() string

func (*DeleteResponse) Validate

func (this *DeleteResponse) Validate() error

type DropTableRequest

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

Drop a table in the DB

func (*DropTableRequest) Descriptor deprecated

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

Deprecated: Use DropTableRequest.ProtoReflect.Descriptor instead.

func (*DropTableRequest) GetTable

func (x *DropTableRequest) GetTable() string

func (*DropTableRequest) ProtoMessage

func (*DropTableRequest) ProtoMessage()

func (*DropTableRequest) ProtoReflect

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

func (*DropTableRequest) Reset

func (x *DropTableRequest) Reset()

func (*DropTableRequest) String

func (x *DropTableRequest) String() string

func (*DropTableRequest) Validate

func (this *DropTableRequest) Validate() error

type DropTableResponse

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

func (*DropTableResponse) Descriptor deprecated

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

Deprecated: Use DropTableResponse.ProtoReflect.Descriptor instead.

func (*DropTableResponse) ProtoMessage

func (*DropTableResponse) ProtoMessage()

func (*DropTableResponse) ProtoReflect

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

func (*DropTableResponse) Reset

func (x *DropTableResponse) Reset()

func (*DropTableResponse) String

func (x *DropTableResponse) String() string

func (*DropTableResponse) Validate

func (this *DropTableResponse) Validate() error

type ListTablesRequest

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

List tables in the DB

func (*ListTablesRequest) Descriptor deprecated

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

Deprecated: Use ListTablesRequest.ProtoReflect.Descriptor instead.

func (*ListTablesRequest) ProtoMessage

func (*ListTablesRequest) ProtoMessage()

func (*ListTablesRequest) ProtoReflect

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

func (*ListTablesRequest) Reset

func (x *ListTablesRequest) Reset()

func (*ListTablesRequest) String

func (x *ListTablesRequest) String() string

func (*ListTablesRequest) Validate

func (this *ListTablesRequest) Validate() error

type ListTablesResponse

type ListTablesResponse struct {

	// list of tables
	Tables []string `protobuf:"bytes,1,rep,name=tables,proto3" json:"tables,omitempty"`
	// contains filtered or unexported fields
}

func (*ListTablesResponse) Descriptor deprecated

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

Deprecated: Use ListTablesResponse.ProtoReflect.Descriptor instead.

func (*ListTablesResponse) GetTables

func (x *ListTablesResponse) GetTables() []string

func (*ListTablesResponse) ProtoMessage

func (*ListTablesResponse) ProtoMessage()

func (*ListTablesResponse) ProtoReflect

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

func (*ListTablesResponse) Reset

func (x *ListTablesResponse) Reset()

func (*ListTablesResponse) String

func (x *ListTablesResponse) String() string

func (*ListTablesResponse) Validate

func (this *ListTablesResponse) Validate() error

type ReadRequest

type ReadRequest struct {

	// Optional table name. Defaults to 'default'
	Table string `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"`
	// Read by id. Equivalent to 'id == "your-id"'
	Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	// Examples: 'age >= 18', 'age >= 18 and verified == true'
	// Comparison operators: '==', '!=', '<', '>', '<=', '>='
	// Logical operator: 'and'
	// Dot access is supported, eg: 'user.age == 11'
	// Accessing list elements is not supported yet.
	Query  string `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"`
	Offset int32  `protobuf:"varint,4,opt,name=offset,proto3" json:"offset,omitempty"`
	// Maximum number of records to return. Default limit is 25.
	// Maximum limit is 1000. Anything higher will return an error.
	Limit int32 `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"`
	// field name to order by
	OrderBy string `protobuf:"bytes,6,opt,name=orderBy,proto3" json:"orderBy,omitempty"`
	// 'asc' (default), 'desc'
	Order string `protobuf:"bytes,7,opt,name=order,proto3" json:"order,omitempty"`
	// contains filtered or unexported fields
}

Read data from a table. Lookup can be by ID or via querying any field in the record.

func (*ReadRequest) Descriptor deprecated

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

Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.

func (*ReadRequest) GetId

func (x *ReadRequest) GetId() string

func (*ReadRequest) GetLimit

func (x *ReadRequest) GetLimit() int32

func (*ReadRequest) GetOffset

func (x *ReadRequest) GetOffset() int32

func (*ReadRequest) GetOrder

func (x *ReadRequest) GetOrder() string

func (*ReadRequest) GetOrderBy

func (x *ReadRequest) GetOrderBy() string

func (*ReadRequest) GetQuery

func (x *ReadRequest) GetQuery() string

func (*ReadRequest) GetTable

func (x *ReadRequest) GetTable() string

func (*ReadRequest) ProtoMessage

func (*ReadRequest) ProtoMessage()

func (*ReadRequest) ProtoReflect

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

func (*ReadRequest) Reset

func (x *ReadRequest) Reset()

func (*ReadRequest) String

func (x *ReadRequest) String() string

func (*ReadRequest) Validate

func (this *ReadRequest) Validate() error

type ReadResponse

type ReadResponse struct {

	// JSON encoded records
	Records []*structpb.Struct `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadResponse) Descriptor deprecated

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

Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead.

func (*ReadResponse) GetRecords

func (x *ReadResponse) GetRecords() []*structpb.Struct

func (*ReadResponse) ProtoMessage

func (*ReadResponse) ProtoMessage()

func (*ReadResponse) ProtoReflect

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

func (*ReadResponse) Reset

func (x *ReadResponse) Reset()

func (*ReadResponse) String

func (x *ReadResponse) String() string

func (*ReadResponse) Validate

func (this *ReadResponse) Validate() error

type RenameTableRequest

type RenameTableRequest struct {

	// current table name
	From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
	// new table name
	To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"`
	// contains filtered or unexported fields
}

Rename a table

func (*RenameTableRequest) Descriptor deprecated

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

Deprecated: Use RenameTableRequest.ProtoReflect.Descriptor instead.

func (*RenameTableRequest) GetFrom

func (x *RenameTableRequest) GetFrom() string

func (*RenameTableRequest) GetTo

func (x *RenameTableRequest) GetTo() string

func (*RenameTableRequest) ProtoMessage

func (*RenameTableRequest) ProtoMessage()

func (*RenameTableRequest) ProtoReflect

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

func (*RenameTableRequest) Reset

func (x *RenameTableRequest) Reset()

func (*RenameTableRequest) String

func (x *RenameTableRequest) String() string

func (*RenameTableRequest) Validate

func (this *RenameTableRequest) Validate() error

type RenameTableResponse

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

func (*RenameTableResponse) Descriptor deprecated

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

Deprecated: Use RenameTableResponse.ProtoReflect.Descriptor instead.

func (*RenameTableResponse) ProtoMessage

func (*RenameTableResponse) ProtoMessage()

func (*RenameTableResponse) ProtoReflect

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

func (*RenameTableResponse) Reset

func (x *RenameTableResponse) Reset()

func (*RenameTableResponse) String

func (x *RenameTableResponse) String() string

func (*RenameTableResponse) Validate

func (this *RenameTableResponse) Validate() error

type TruncateRequest

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

Truncate the records in a table

func (*TruncateRequest) Descriptor deprecated

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

Deprecated: Use TruncateRequest.ProtoReflect.Descriptor instead.

func (*TruncateRequest) GetTable

func (x *TruncateRequest) GetTable() string

func (*TruncateRequest) ProtoMessage

func (*TruncateRequest) ProtoMessage()

func (*TruncateRequest) ProtoReflect

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

func (*TruncateRequest) Reset

func (x *TruncateRequest) Reset()

func (*TruncateRequest) String

func (x *TruncateRequest) String() string

func (*TruncateRequest) Validate

func (this *TruncateRequest) Validate() error

type TruncateResponse

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

func (*TruncateResponse) Descriptor deprecated

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

Deprecated: Use TruncateResponse.ProtoReflect.Descriptor instead.

func (*TruncateResponse) ProtoMessage

func (*TruncateResponse) ProtoMessage()

func (*TruncateResponse) ProtoReflect

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

func (*TruncateResponse) Reset

func (x *TruncateResponse) Reset()

func (*TruncateResponse) String

func (x *TruncateResponse) String() string

func (*TruncateResponse) Validate

func (this *TruncateResponse) Validate() error

type UnimplementedDbServer

type UnimplementedDbServer struct {
}

UnimplementedDbServer should be embedded to have forward compatible implementations.

func (UnimplementedDbServer) Count

func (UnimplementedDbServer) Create

func (UnimplementedDbServer) Delete

func (UnimplementedDbServer) DropTable

func (UnimplementedDbServer) ListTables

func (UnimplementedDbServer) Read

func (UnimplementedDbServer) RenameTable

func (UnimplementedDbServer) Truncate

func (UnimplementedDbServer) Update

type UnsafeDbServer

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

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

type UpdateRequest

type UpdateRequest struct {

	// Optional table name. Defaults to 'default'
	Table string `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"`
	// The id of the record. If not specified it is inferred from the 'id' field of the record
	Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	// record, JSON object
	Record *structpb.Struct `protobuf:"bytes,3,opt,name=record,proto3" json:"record,omitempty"`
	// contains filtered or unexported fields
}

Update a record in the database. Include an "id" in the record to update.

func (*UpdateRequest) Descriptor deprecated

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

Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.

func (*UpdateRequest) GetId

func (x *UpdateRequest) GetId() string

func (*UpdateRequest) GetRecord

func (x *UpdateRequest) GetRecord() *structpb.Struct

func (*UpdateRequest) GetTable

func (x *UpdateRequest) GetTable() string

func (*UpdateRequest) ProtoMessage

func (*UpdateRequest) ProtoMessage()

func (*UpdateRequest) ProtoReflect

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

func (*UpdateRequest) Reset

func (x *UpdateRequest) Reset()

func (*UpdateRequest) String

func (x *UpdateRequest) String() string

func (*UpdateRequest) Validate

func (this *UpdateRequest) Validate() error

type UpdateResponse

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

func (*UpdateResponse) Descriptor deprecated

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

Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead.

func (*UpdateResponse) ProtoMessage

func (*UpdateResponse) ProtoMessage()

func (*UpdateResponse) ProtoReflect

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

func (*UpdateResponse) Reset

func (x *UpdateResponse) Reset()

func (*UpdateResponse) String

func (x *UpdateResponse) String() string

func (*UpdateResponse) Validate

func (this *UpdateResponse) Validate() error

Jump to

Keyboard shortcuts

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