Documentation ¶
Overview ¶
databeat v0.1.0 05b62e4c87147149adb52dd13fe2de8c53a3c72f -- Code generated by webrpc-gen@v0.14.0-dev with golang generator. DO NOT EDIT.
webrpc-gen -schema=databeat.ridl -target=golang -pkg=proto -client -out=./clients/databeat.gen.go
Index ¶
- Constants
- Variables
- func HTTPRequestHeaders(ctx context.Context) (http.Header, bool)
- func MethodNameFromContext(ctx context.Context) string
- func RequestFromContext(ctx context.Context) *http.Request
- func ServiceNameFromContext(ctx context.Context) string
- func WebRPCSchemaHash() string
- func WebRPCSchemaVersion() string
- func WebRPCVersion() string
- func WithHTTPRequestHeaders(ctx context.Context, h http.Header) (context.Context, error)
- type App
- type Databeat
- type DatabeatAdmin
- type DatabeatQuery
- type Device
- type Event
- type EventType
- type HTTPClient
- type Ident
- type RawEvent
- type RuntimeStatus
- type SinkStats
- type Version
- type WebRPCError
Constants ¶
View Source
const DatabeatAdminPathPrefix = "/rpc/DatabeatAdmin/"
View Source
const DatabeatPathPrefix = "/rpc/Databeat/"
View Source
const DatabeatQueryPathPrefix = "/rpc/DatabeatQuery/"
Variables ¶
View Source
var ( HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"} HTTPRequestCtxKey = &contextKey{"HTTPRequest"} ServiceNameCtxKey = &contextKey{"ServiceName"} MethodNameCtxKey = &contextKey{"MethodName"} )
View Source
var ( ErrWebrpcEndpoint = WebRPCError{Code: 0, Name: "WebrpcEndpoint", Message: "endpoint error", HTTPStatus: 400} ErrWebrpcRequestFailed = WebRPCError{Code: -1, Name: "WebrpcRequestFailed", Message: "request failed", HTTPStatus: 400} ErrWebrpcBadRoute = WebRPCError{Code: -2, Name: "WebrpcBadRoute", Message: "bad route", HTTPStatus: 404} ErrWebrpcBadMethod = WebRPCError{Code: -3, Name: "WebrpcBadMethod", Message: "bad method", HTTPStatus: 405} ErrWebrpcBadRequest = WebRPCError{Code: -4, Name: "WebrpcBadRequest", Message: "bad request", HTTPStatus: 400} ErrWebrpcBadResponse = WebRPCError{Code: -5, Name: "WebrpcBadResponse", Message: "bad response", HTTPStatus: 500} ErrWebrpcServerPanic = WebRPCError{Code: -6, Name: "WebrpcServerPanic", Message: "server panic", HTTPStatus: 500} ErrWebrpcInternalError = WebRPCError{Code: -7, Name: "WebrpcInternalError", Message: "internal error", HTTPStatus: 500} )
Webrpc errors
View Source
var ( ErrPermissionDenied = WebRPCError{Code: 2000, Name: "PermissionDenied", Message: "Permission denied", HTTPStatus: 403} ErrSessionExpired = WebRPCError{Code: 2001, Name: "SessionExpired", Message: "Session expired", HTTPStatus: 403} ErrNotFound = WebRPCError{Code: 3000, Name: "NotFound", Message: "Resource not found", HTTPStatus: 404} ErrInvalidAppKey = WebRPCError{Code: 4000, Name: "InvalidAppKey", Message: "Invalid app key", HTTPStatus: 400} ErrQueryFailed = WebRPCError{Code: 4001, Name: "QueryFailed", Message: "DB query failed", HTTPStatus: 400} )
Schema errors
View Source
var EventType_name = map[uint32]string{
0: "INIT",
1: "VIEW",
2: "REQUEST",
}
View Source
var EventType_value = map[string]uint32{
"INIT": 0,
"VIEW": 1,
"REQUEST": 2,
}
View Source
var Ident_name = map[uint8]string{
0: "ANONYMOUS",
1: "PRIVATE",
2: "USER",
3: "SERVICE",
}
View Source
var Ident_value = map[string]uint8{
"ANONYMOUS": 0,
"PRIVATE": 1,
"USER": 2,
"SERVICE": 3,
}
View Source
var WebRPCServices = map[string][]string{
"Databeat": {
"Ping",
"Version",
"RuntimeStatus",
"Tick",
"RawEvents",
},
"DatabeatAdmin": {
"ListApps",
"CreateApp",
"GetApp",
"UpdateApp",
"DisableApp",
},
"DatabeatQuery": {
"QueryDateRange",
},
}
Functions ¶
func MethodNameFromContext ¶ added in v0.6.0
func RequestFromContext ¶ added in v0.6.0
func ServiceNameFromContext ¶ added in v0.6.0
Types ¶
type Databeat ¶
type Databeat interface { Ping(ctx context.Context) (bool, error) Version(ctx context.Context) (*Version, error) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) Tick(ctx context.Context, events []*Event) (bool, error) RawEvents(ctx context.Context, events []*RawEvent) (bool, error) }
func NewDatabeatClient ¶
func NewDatabeatClient(addr string, client HTTPClient) Databeat
type DatabeatAdmin ¶ added in v0.3.0
type DatabeatAdmin interface { ListApps(ctx context.Context) ([]*App, error) CreateApp(ctx context.Context, uid string, name string, domains []string) (*App, error) GetApp(ctx context.Context, appUid string) (*App, error) UpdateApp(ctx context.Context, app *App) (bool, error) DisableApp(ctx context.Context, appUid string, disabled bool) (bool, error) }
func NewDatabeatAdminClient ¶ added in v0.3.0
func NewDatabeatAdminClient(addr string, client HTTPClient) DatabeatAdmin
type DatabeatQuery ¶ added in v0.3.0
type DatabeatQuery interface {
QueryDateRange(ctx context.Context, appUid string, event string, from time.Time, to time.Time) (interface{}, error)
}
func NewDatabeatQueryClient ¶ added in v0.3.0
func NewDatabeatQueryClient(addr string, client HTTPClient) DatabeatQuery
type Event ¶
type Event struct { Event string `json:"event"` ProjectID uint64 `json:"projectId"` Source string `json:"source"` Ident uint8 `json:"ident"` UserID *string `json:"userId"` SessionID *string `json:"sessionId"` Device *Device `json:"device"` CountryCode *string `json:"countryCode"` Props map[string]string `json:"props"` Nums map[string]float64 `json:"nums"` Etc map[string]interface{} `json:"-" ch:"-"` }
type EventType ¶ added in v0.2.0
type EventType uint32
func (EventType) MarshalText ¶ added in v0.6.0
func (*EventType) UnmarshalText ¶ added in v0.6.0
type HTTPClient ¶
HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.
type Ident ¶ added in v0.6.0
type Ident uint8
func (Ident) MarshalText ¶ added in v0.6.0
func (*Ident) UnmarshalText ¶ added in v0.6.0
type RawEvent ¶ added in v0.2.0
type RawEvent struct { App *string `json:"app" ch:"app"` TS *time.Time `json:"ts" ch:"ts"` Event string `json:"event" ch:"event"` ProjectID uint64 `json:"projectId" ch:"project_id"` Source string `json:"source" ch:"source"` Ident uint8 `json:"ident" ch:"ident"` UserID *string `json:"userId" ch:"user_id"` SessionID *string `json:"sessionId" ch:"session_id"` CountryCode *string `json:"countryCode" ch:"country"` DeviceType *string `json:"deviceType" ch:"device_type"` DeviceOS *string `json:"deviceOs" ch:"device_os"` DeviceOSVersion *string `json:"deviceOsVersion" ch:"device_os_ver"` DeviceBrowser *string `json:"deviceBrowser" ch:"device_browser"` DeviceBrowserVersion *string `json:"deviceBrowserVersion" ch:"device_browser_ver"` Props map[string]string `json:"props" ch:"props"` Nums map[string]float64 `json:"nums" ch:"nums"` Etc map[string]interface{} `json:"-" ch:"-"` }
type RuntimeStatus ¶
type RuntimeStatus struct { HealthOK bool `json:"healthOK"` StartTime time.Time `json:"startTime"` Uptime uint64 `json:"uptime"` Ver string `json:"ver"` Branch string `json:"branch"` CommitHash string `json:"commitHash"` SinkStats *SinkStats `json:"sinkStats"` PipelineStats map[string]interface{} `json:"pipelineStats"` GcpPubSub bool `json:"gcpPubSub"` }
type WebRPCError ¶ added in v0.3.0
type WebRPCError struct { Name string `json:"error"` Code int `json:"code"` Message string `json:"msg"` Cause string `json:"cause,omitempty"` HTTPStatus int `json:"status"` // contains filtered or unexported fields }
func ErrorWithCause
deprecated
added in
v0.3.0
func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError
Deprecated: Use .WithCause() method on WebRPCError.
func (WebRPCError) Error ¶ added in v0.3.0
func (e WebRPCError) Error() string
func (WebRPCError) Is ¶ added in v0.3.0
func (e WebRPCError) Is(target error) bool
func (WebRPCError) Unwrap ¶ added in v0.3.0
func (e WebRPCError) Unwrap() error
func (WebRPCError) WithCause ¶ added in v0.6.0
func (e WebRPCError) WithCause(cause error) WebRPCError
Click to show internal directories.
Click to hide internal directories.