db

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: Apache-2.0 Imports: 12 Imported by: 3 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_proto_db_proto protoreflect.FileDescriptor

Functions

func NewDbEndpoints

func NewDbEndpoints() []*api.Endpoint

func RegisterDbHandler

func RegisterDbHandler(s server.Server, hdlr DbHandler, opts ...server.HandlerOption) error

Types

type CreateRequest

type CreateRequest struct {

	// Table name is optional
	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 its 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

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

type DbService

type DbService interface {
	Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error)
	Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
	Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error)
	Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
	Truncate(ctx context.Context, in *TruncateRequest, opts ...client.CallOption) (*TruncateResponse, error)
}

func NewDbService

func NewDbService(name string, c client.Client) DbService

type DeleteRequest

type DeleteRequest struct {

	// Table name is optional
	Table string `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"`
	// id or ids, eg. 'user-1', or comma separated ids 'user-1,user-2'
	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

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

type ReadRequest

type ReadRequest struct {

	// Table name is optional
	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"`
	// 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

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

type TruncateRequest

type TruncateRequest struct {

	// Table name is optional
	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

type TruncateResponse

type TruncateResponse struct {

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

func (*TruncateResponse) Descriptor deprecated

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

Deprecated: Use TruncateResponse.ProtoReflect.Descriptor instead.

func (*TruncateResponse) GetTable

func (x *TruncateResponse) GetTable() string

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

type UpdateRequest

type UpdateRequest struct {

	// Table name is optional
	Table string `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"`
	// The id 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

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

Jump to

Keyboard shortcuts

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