Documentation
¶
Index ¶
- func CollectionFor(t reflect.Type) string
- func ContextWithDatabaseConfig(ctx context.Context, cnf DatabaseConfig) context.Context
- func Create(ctx context.Context, val interface{}, comm *Common) ([]string, error)
- func Delete(ctx context.Context, item interface{}, comm *Common) error
- func List(ctx context.Context, offset, count int, out interface{}, comm *Common) (int, error)
- func ListKeys(ctx context.Context, keys []string, out interface{}, comm *Common) error
- func NewConnection() *connection
- func NewGraph(comm *Common) *graph
- func Read(ctx context.Context, key string, out interface{}, comm *Common) error
- func Update(ctx context.Context, key string, item interface{}, comm *Common) error
- func WriteErrorResponse(w http.ResponseWriter, status int, err error)
- func WriteJSONResponse(w http.ResponseWriter, status int, data interface{})
- func WriteResponse(w http.ResponseWriter, status int, data []byte)
- func WriteSuccessResponse(w http.ResponseWriter, status int)
- type Common
- type DatabaseConfig
- type Event
- type IConnection
- type IObserver
- type Observer
- type Processor
- type SourceID
- type Topic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithDatabaseConfig ¶
func ContextWithDatabaseConfig(ctx context.Context, cnf DatabaseConfig) context.Context
ContextWithDatabaseConfig ...
func WriteErrorResponse ¶
func WriteErrorResponse(w http.ResponseWriter, status int, err error)
func WriteJSONResponse ¶
func WriteJSONResponse(w http.ResponseWriter, status int, data interface{})
func WriteResponse ¶ added in v0.0.2
func WriteResponse(w http.ResponseWriter, status int, data []byte)
func WriteSuccessResponse ¶
func WriteSuccessResponse(w http.ResponseWriter, status int)
Types ¶
type Common ¶
type Common struct { Observer IObserver[Topic] Connection IConnection }
type DatabaseConfig ¶
type DatabaseConfig struct { // Name ... Name string }
DatabaseConfig ...
func DatabaseConfigFromContext ¶
func DatabaseConfigFromContext(ctx context.Context) (*DatabaseConfig, error)
DatabaseConfigFromContext ...
type Event ¶
type Event[T comparable] struct { // Topic ... Topic T // Payload ... Payload protoreflect.ProtoMessage // Timestamp ... Timestamp time.Time }
Event ...
type IConnection ¶
type IConnection interface { // GetDatabase ... GetDatabase(ctx context.Context) (driver.Database, error) // GetCollection ... GetCollection(ctx context.Context, elem reflect.Type) (driver.Collection, error) }
IConnection ...
type IObserver ¶
type IObserver[T comparable] interface { // Subscribe ... Subscribe(t T, p Processor[T]) SourceID // Unsubscribe ... Unsubscribe(s SourceID) // Emit ... Emit(e *Event[T]) error }
IObserver ...
type Observer ¶
type Observer[T comparable] struct { // contains filtered or unexported fields }
Observer ...
Source Files
¶
Click to show internal directories.
Click to hide internal directories.