callgo

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldsFromContext added in v0.8.0

func FieldsFromContext[T any](ctx context.Context) (*T, error)

func Handle added in v0.3.0

func Handle(i any) *handlerFunc

func NewFailedValidationError added in v0.7.0

func NewFailedValidationError(collection, field, message string) error

func NewInvalidError added in v0.7.0

func NewInvalidError(message string) error

func NewServer added in v0.6.0

func NewServer(opts ...ServerOption) (string, http.Handler)

func PingFn added in v0.5.0

func PingFn(ctx context.Context) (string, error)

PingFn is the default ping implementation.

Types

type Accountability

type Accountability struct {
	User      string `json:"user"`
	Role      string `json:"role"`
	Admin     bool   `json:"admin"`
	App       bool   `json:"app"`
	IP        string `json:"ip"`
	UserAgent string `json:"userAgent"`
	Origin    string `json:"origin"`
}

func AccountabilityFromContext

func AccountabilityFromContext(ctx context.Context) *Accountability

type ErrorReporter added in v0.6.0

type ErrorReporter interface {
	ReportError(ctx context.Context, err error)
	ReportPanics(ctx context.Context)
}

type Partial added in v0.9.0

type Partial[T any] struct {
	Value  *T
	Fields map[string]any
}

Partial reads the inner object fields and stores the unknown ones in a map. When marshaled again the unknown fields will be kept and any known fields with the same name will override them.

func (*Partial[T]) MarshalJSON added in v0.9.0

func (obj *Partial[T]) MarshalJSON() ([]byte, error)

func (*Partial[T]) UnmarshalJSON added in v0.9.0

func (obj *Partial[T]) UnmarshalJSON(data []byte) error

type RawTrigger

type RawTrigger struct {
	Event      string
	Keys       []TriggerKey
	Collection string
	Payload    json.RawMessage

	// Path is the URL path of a manual invokation.
	Path string
	// contains filtered or unexported fields
}

func RawTriggerFromContext

func RawTriggerFromContext(ctx context.Context) *RawTrigger

type ServerOption added in v0.6.0

type ServerOption func(r *serverOpts)

func WithErrorReporter added in v0.6.0

func WithErrorReporter(reporter ErrorReporter) ServerOption

func WithLogger

func WithLogger(logger *slog.Logger) ServerOption

func WithSecurityToken

func WithSecurityToken(token string) ServerOption

type Trigger

type Trigger[Payload any] struct {
	Event      string
	Keys       []TriggerKey
	Collection string
	Payload    Payload

	// Path is the URL path of a manual invokation.
	Path string
}

func TriggerFromContext

func TriggerFromContext[T any](ctx context.Context) (*Trigger[T], error)

type TriggerKey

type TriggerKey struct {
	Value        string
	NumericValue int64
}

func (*TriggerKey) IsEmpty added in v0.5.0

func (n *TriggerKey) IsEmpty() bool

func (*TriggerKey) String

func (n *TriggerKey) String() string

func (*TriggerKey) UnmarshalJSON

func (n *TriggerKey) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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