Documentation ¶
Overview ¶
Package super is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func Create(ctx context.Context, items []*Dope, db *mongo.Database) error
- func Delete(ctx context.Context, user string, items []*Dope, db *mongo.Database) error
- func RegisterDopeServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterDopeServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DopeServiceClient) error
- func RegisterDopeServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterDopeServiceServer(s *grpc.Server, srv DopeServiceServer)
- func Update(ctx context.Context, user string, filter bson.D, items []*Dope, ...) error
- type Dope
- func (*Dope) Descriptor() ([]byte, []int)
- func (m *Dope) GetDope_1() string
- func (m *Dope) GetDope_2() int32
- func (m *Dope) GetDope_3() []string
- func (m *Dope) GetDope_4() bool
- func (m *Dope) GetId() string
- func (m *Dope) GetRecordInfo() *RecordInfo
- func (*Dope) ProtoMessage()
- func (m *Dope) Reset()
- func (m *Dope) String() string
- func (m *Dope) XXX_DiscardUnknown()
- func (m *Dope) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Dope) XXX_Merge(src proto.Message)
- func (m *Dope) XXX_Size() int
- func (m *Dope) XXX_Unmarshal(b []byte) error
- type DopeRequest
- func (*DopeRequest) Descriptor() ([]byte, []int)
- func (m *DopeRequest) GetId() string
- func (m *DopeRequest) GetPayload() []*Dope
- func (m *DopeRequest) GetRequestId() string
- func (m *DopeRequest) GetUsername() string
- func (*DopeRequest) ProtoMessage()
- func (m *DopeRequest) Reset()
- func (m *DopeRequest) String() string
- func (m *DopeRequest) XXX_DiscardUnknown()
- func (m *DopeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *DopeRequest) XXX_Merge(src proto.Message)
- func (m *DopeRequest) XXX_Size() int
- func (m *DopeRequest) XXX_Unmarshal(b []byte) error
- type DopeResponse
- func (*DopeResponse) Descriptor() ([]byte, []int)
- func (m *DopeResponse) GetPayload() []*Dope
- func (m *DopeResponse) GetRequestId() string
- func (*DopeResponse) ProtoMessage()
- func (m *DopeResponse) Reset()
- func (m *DopeResponse) String() string
- func (m *DopeResponse) XXX_DiscardUnknown()
- func (m *DopeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *DopeResponse) XXX_Merge(src proto.Message)
- func (m *DopeResponse) XXX_Size() int
- func (m *DopeResponse) XXX_Unmarshal(b []byte) error
- type DopeServer
- func (s *DopeServer) Create(ctx context.Context, req *DopeRequest) (*Empty, error)
- func (s *DopeServer) Delete(ctx context.Context, req *DopeRequest) (*Empty, error)
- func (s *DopeServer) Retrieve(ctx context.Context, req *DopeRequest) (*DopeResponse, error)
- func (s *DopeServer) Update(ctx context.Context, req *DopeRequest) (*DopeResponse, error)
- type DopeServiceClient
- type DopeServiceServer
- type Empty
- func (*Empty) Descriptor() ([]byte, []int)
- func (m *Empty) GetRequestId() string
- func (*Empty) ProtoMessage()
- func (m *Empty) Reset()
- func (m *Empty) String() string
- func (m *Empty) XXX_DiscardUnknown()
- func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Empty) XXX_Merge(src proto.Message)
- func (m *Empty) XXX_Size() int
- func (m *Empty) XXX_Unmarshal(b []byte) error
- type RecordInfo
- func (*RecordInfo) Descriptor() ([]byte, []int)
- func (m *RecordInfo) GetCreated() *timestamp.Timestamp
- func (m *RecordInfo) GetCreatedBy() string
- func (m *RecordInfo) GetStatus() RecordInfo_Status
- func (m *RecordInfo) GetUpdated() *timestamp.Timestamp
- func (m *RecordInfo) GetUpdatedBy() string
- func (*RecordInfo) ProtoMessage()
- func (m *RecordInfo) Reset()
- func (m *RecordInfo) String() string
- func (m *RecordInfo) XXX_DiscardUnknown()
- func (m *RecordInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *RecordInfo) XXX_Merge(src proto.Message)
- func (m *RecordInfo) XXX_Size() int
- func (m *RecordInfo) XXX_Unmarshal(b []byte) error
- type RecordInfo_Status
- type UnimplementedDopeServiceServer
- func (*UnimplementedDopeServiceServer) Create(ctx context.Context, req *DopeRequest) (*Empty, error)
- func (*UnimplementedDopeServiceServer) Delete(ctx context.Context, req *DopeRequest) (*Empty, error)
- func (*UnimplementedDopeServiceServer) Retrieve(ctx context.Context, req *DopeRequest) (*DopeResponse, error)
- func (*UnimplementedDopeServiceServer) Update(ctx context.Context, req *DopeRequest) (*DopeResponse, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrImmutableValue = errors.New("attempting to edit immutable value") ErrInvalidRecordInfo = errors.New("invalid record info") ErrInvalidCreatedBy = errors.New("invalid created by value") ErrInvalidUpdatedBy = errors.New("invalid updated by value") ErrDuplicateRecord = errors.New("duplicate record for provided id") ErrNotFound = errors.New("no valid record for provided id") ErrInvalidId = errors.New("no valid id for provided record") ErrInvalidUsername = errors.New("no valid username provided") ErrIncompleteAction = errors.New("not all records were properly acted on") ErrMutlipleRecordsReturned = errors.New("multiple records returned") ErrNoMongoClient = errors.New("no valid mongo client") )
var RecordInfo_Status_name = map[int32]string{
0: "draft",
1: "active",
2: "archived",
3: "invalid",
}
var RecordInfo_Status_value = map[string]int32{
"draft": 0,
"active": 1,
"archived": 2,
"invalid": 3,
}
Functions ¶
func Create ¶
Create will validate fields for the provided records and attempt to create new Dope records in the datastore
func RegisterDopeServiceHandler ¶
func RegisterDopeServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterDopeServiceHandler registers the http handlers for service DopeService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterDopeServiceHandlerClient ¶
func RegisterDopeServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DopeServiceClient) error
RegisterDopeServiceHandlerClient registers the http handlers for service DopeService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DopeServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DopeServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "DopeServiceClient" to call the correct interceptors.
func RegisterDopeServiceHandlerFromEndpoint ¶
func RegisterDopeServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterDopeServiceHandlerFromEndpoint is same as RegisterDopeServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterDopeServiceServer ¶
func RegisterDopeServiceServer(s *grpc.Server, srv DopeServiceServer)
Types ¶
type Dope ¶
type Dope struct { // standard record values RecordInfo *RecordInfo `protobuf:"bytes,1,opt,name=record_info,json=recordInfo,proto3" json:"record_info,omitempty"` // unique identifier Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty" bson:"_id"` // super dope field 1 Dope_1 string `protobuf:"bytes,3,opt,name=dope_1,json=dope1,proto3" json:"dope_1,omitempty"` // super dope field 2 Dope_2 int32 `protobuf:"varint,4,opt,name=dope_2,json=dope2,proto3" json:"dope_2,omitempty"` // super dope field 3 Dope_3 []string `protobuf:"bytes,5,rep,name=dope_3,json=dope3,proto3" json:"dope_3,omitempty"` // super dope field 4 Dope_4 bool `protobuf:"varint,6,opt,name=dope_4,json=dope4,proto3" json:"dope_4,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func RetrieveOne ¶
RetrieveOne ...
func (*Dope) Descriptor ¶
func (*Dope) GetRecordInfo ¶
func (m *Dope) GetRecordInfo() *RecordInfo
func (*Dope) ProtoMessage ¶
func (*Dope) ProtoMessage()
func (*Dope) XXX_DiscardUnknown ¶
func (m *Dope) XXX_DiscardUnknown()
func (*Dope) XXX_Unmarshal ¶
type DopeRequest ¶
type DopeRequest struct { // unique identifier to help troubleshoot each request RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` // username of the one making the request Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // unique identifier of the super.Dope Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` // dataset to process Payload []*Dope `protobuf:"bytes,4,rep,name=payload,proto3" json:"payload,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*DopeRequest) Descriptor ¶
func (*DopeRequest) Descriptor() ([]byte, []int)
func (*DopeRequest) GetId ¶
func (m *DopeRequest) GetId() string
func (*DopeRequest) GetPayload ¶
func (m *DopeRequest) GetPayload() []*Dope
func (*DopeRequest) GetRequestId ¶
func (m *DopeRequest) GetRequestId() string
func (*DopeRequest) GetUsername ¶
func (m *DopeRequest) GetUsername() string
func (*DopeRequest) ProtoMessage ¶
func (*DopeRequest) ProtoMessage()
func (*DopeRequest) Reset ¶
func (m *DopeRequest) Reset()
func (*DopeRequest) String ¶
func (m *DopeRequest) String() string
func (*DopeRequest) XXX_DiscardUnknown ¶
func (m *DopeRequest) XXX_DiscardUnknown()
func (*DopeRequest) XXX_Marshal ¶
func (m *DopeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*DopeRequest) XXX_Merge ¶
func (m *DopeRequest) XXX_Merge(src proto.Message)
func (*DopeRequest) XXX_Size ¶
func (m *DopeRequest) XXX_Size() int
func (*DopeRequest) XXX_Unmarshal ¶
func (m *DopeRequest) XXX_Unmarshal(b []byte) error
type DopeResponse ¶
type DopeResponse struct { // unique identifier of the original incoming request to help troubleshoot RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` Payload []*Dope `protobuf:"bytes,2,rep,name=payload,proto3" json:"payload,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*DopeResponse) Descriptor ¶
func (*DopeResponse) Descriptor() ([]byte, []int)
func (*DopeResponse) GetPayload ¶
func (m *DopeResponse) GetPayload() []*Dope
func (*DopeResponse) GetRequestId ¶
func (m *DopeResponse) GetRequestId() string
func (*DopeResponse) ProtoMessage ¶
func (*DopeResponse) ProtoMessage()
func (*DopeResponse) Reset ¶
func (m *DopeResponse) Reset()
func (*DopeResponse) String ¶
func (m *DopeResponse) String() string
func (*DopeResponse) XXX_DiscardUnknown ¶
func (m *DopeResponse) XXX_DiscardUnknown()
func (*DopeResponse) XXX_Marshal ¶
func (m *DopeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*DopeResponse) XXX_Merge ¶
func (m *DopeResponse) XXX_Merge(src proto.Message)
func (*DopeResponse) XXX_Size ¶
func (m *DopeResponse) XXX_Size() int
func (*DopeResponse) XXX_Unmarshal ¶
func (m *DopeResponse) XXX_Unmarshal(b []byte) error
type DopeServer ¶
type DopeServer struct {
// contains filtered or unexported fields
}
func (*DopeServer) Create ¶
func (s *DopeServer) Create(ctx context.Context, req *DopeRequest) (*Empty, error)
func (*DopeServer) Delete ¶
func (s *DopeServer) Delete(ctx context.Context, req *DopeRequest) (*Empty, error)
func (*DopeServer) Retrieve ¶
func (s *DopeServer) Retrieve(ctx context.Context, req *DopeRequest) (*DopeResponse, error)
func (*DopeServer) Update ¶
func (s *DopeServer) Update(ctx context.Context, req *DopeRequest) (*DopeResponse, error)
type DopeServiceClient ¶
type DopeServiceClient interface { // create new Dope item(s) Create(ctx context.Context, in *DopeRequest, opts ...grpc.CallOption) (*Empty, error) // retrieve a list of Dope items Retrieve(ctx context.Context, in *DopeRequest, opts ...grpc.CallOption) (*DopeResponse, error) // update Dope item(s) Update(ctx context.Context, in *DopeRequest, opts ...grpc.CallOption) (*DopeResponse, error) // delete Dope item(s) Delete(ctx context.Context, in *DopeRequest, opts ...grpc.CallOption) (*Empty, error) }
DopeServiceClient is the client API for DopeService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewDopeServiceClient ¶
func NewDopeServiceClient(cc *grpc.ClientConn) DopeServiceClient
type DopeServiceServer ¶
type DopeServiceServer interface { // create new Dope item(s) Create(context.Context, *DopeRequest) (*Empty, error) // retrieve a list of Dope items Retrieve(context.Context, *DopeRequest) (*DopeResponse, error) // update Dope item(s) Update(context.Context, *DopeRequest) (*DopeResponse, error) // delete Dope item(s) Delete(context.Context, *DopeRequest) (*Empty, error) }
DopeServiceServer is the server API for DopeService service.
func NewDopeServer ¶
func NewDopeServer(cmp *config.Composition, client *mongo.Client) DopeServiceServer
type Empty ¶
type Empty struct { // unique identifier of the original incoming request to help troubleshoot RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Empty) Descriptor ¶
func (*Empty) GetRequestId ¶
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) XXX_DiscardUnknown ¶
func (m *Empty) XXX_DiscardUnknown()
func (*Empty) XXX_Marshal ¶
func (*Empty) XXX_Unmarshal ¶
type RecordInfo ¶
type RecordInfo struct { Created *timestamp.Timestamp `protobuf:"bytes,1,opt,name=created,proto3" json:"created,omitempty"` CreatedBy string `protobuf:"bytes,2,opt,name=created_by,json=createdBy,proto3" json:"created_by,omitempty"` Updated *timestamp.Timestamp `protobuf:"bytes,3,opt,name=updated,proto3" json:"updated,omitempty"` UpdatedBy string `protobuf:"bytes,4,opt,name=updated_by,json=updatedBy,proto3" json:"updated_by,omitempty"` Status RecordInfo_Status `protobuf:"varint,5,opt,name=status,proto3,enum=super.RecordInfo_Status" json:"status,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*RecordInfo) Descriptor ¶
func (*RecordInfo) Descriptor() ([]byte, []int)
func (*RecordInfo) GetCreated ¶
func (m *RecordInfo) GetCreated() *timestamp.Timestamp
func (*RecordInfo) GetCreatedBy ¶
func (m *RecordInfo) GetCreatedBy() string
func (*RecordInfo) GetStatus ¶
func (m *RecordInfo) GetStatus() RecordInfo_Status
func (*RecordInfo) GetUpdated ¶
func (m *RecordInfo) GetUpdated() *timestamp.Timestamp
func (*RecordInfo) GetUpdatedBy ¶
func (m *RecordInfo) GetUpdatedBy() string
func (*RecordInfo) ProtoMessage ¶
func (*RecordInfo) ProtoMessage()
func (*RecordInfo) Reset ¶
func (m *RecordInfo) Reset()
func (*RecordInfo) String ¶
func (m *RecordInfo) String() string
func (*RecordInfo) XXX_DiscardUnknown ¶
func (m *RecordInfo) XXX_DiscardUnknown()
func (*RecordInfo) XXX_Marshal ¶
func (m *RecordInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*RecordInfo) XXX_Merge ¶
func (m *RecordInfo) XXX_Merge(src proto.Message)
func (*RecordInfo) XXX_Size ¶
func (m *RecordInfo) XXX_Size() int
func (*RecordInfo) XXX_Unmarshal ¶
func (m *RecordInfo) XXX_Unmarshal(b []byte) error
type RecordInfo_Status ¶
type RecordInfo_Status int32
const ( RecordInfo_draft RecordInfo_Status = 0 RecordInfo_active RecordInfo_Status = 1 RecordInfo_archived RecordInfo_Status = 2 RecordInfo_invalid RecordInfo_Status = 3 )
func (RecordInfo_Status) EnumDescriptor ¶
func (RecordInfo_Status) EnumDescriptor() ([]byte, []int)
func (RecordInfo_Status) String ¶
func (x RecordInfo_Status) String() string
type UnimplementedDopeServiceServer ¶
type UnimplementedDopeServiceServer struct { }
UnimplementedDopeServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedDopeServiceServer) Create ¶
func (*UnimplementedDopeServiceServer) Create(ctx context.Context, req *DopeRequest) (*Empty, error)
func (*UnimplementedDopeServiceServer) Delete ¶
func (*UnimplementedDopeServiceServer) Delete(ctx context.Context, req *DopeRequest) (*Empty, error)
func (*UnimplementedDopeServiceServer) Retrieve ¶
func (*UnimplementedDopeServiceServer) Retrieve(ctx context.Context, req *DopeRequest) (*DopeResponse, error)
func (*UnimplementedDopeServiceServer) Update ¶
func (*UnimplementedDopeServiceServer) Update(ctx context.Context, req *DopeRequest) (*DopeResponse, error)