Documentation
¶
Index ¶
- Variables
- func AddAuthBasic[T any](api *API, pathUser, pathPass string)
- func AddAuthBasicName[T any](api *API, name, pathUser, pathPass string)
- func AddAuthBearer[T any](api *API, pathToken string)
- func AddAuthBearerName[T any](api *API, name, pathToken string)
- func ApplyFilters[T any](list []T, opts *ListOpts) ([]T, error)
- func ApplySorts[T any](list []T, opts *ListOpts) ([]T, error)
- func ApplyWindow[T any](list []T, opts *ListOpts) ([]T, error)
- func Create[T any](ctx context.Context, api *API, obj *T) (*T, error)
- func CreateName[T any](ctx context.Context, api *API, name string, obj *T) (*T, error)
- func Delete[T any](ctx context.Context, api *API, id string, opts *UpdateOpts) error
- func DeleteName[T any](ctx context.Context, api *API, name, id string, opts *UpdateOpts) error
- func EventHookAuthBasic(ctx context.Context, ev *event.Event)
- func EventHookAuthBearer(ctx context.Context, ev *event.Event)
- func EventHookSpanID(ctx context.Context, ev *event.Event)
- func FieldChanged[T any](obj *T, prev *T, p string) bool
- func Find[T any](ctx context.Context, api *API, shortID string) (*T, error)
- func FindName[T any](ctx context.Context, api *API, name, shortID string) (*T, error)
- func Get[T any](ctx context.Context, api *API, id string, opts *GetOpts) (*T, error)
- func GetName[T any](ctx context.Context, api *API, name, id string, opts *GetOpts) (*T, error)
- func IsCreate[T any](obj *T, prev *T) bool
- func IsDelete[T any](obj *T, prev *T) bool
- func IsUpdate[T any](obj *T, prev *T) bool
- func List[T any](ctx context.Context, api *API, opts *ListOpts) ([]*T, error)
- func ListName[T any](ctx context.Context, api *API, name string, opts *ListOpts) ([]*T, error)
- func OpenAPIHookAuthBasic(_ context.Context, t *OpenAPI)
- func OpenAPIHookAuthBearer(_ context.Context, t *OpenAPI)
- func P[T any](v T) *T
- func Register[T any](api *API)
- func RegisterName[T any](api *API, apiName, camelName string)
- func Replace[T any](ctx context.Context, api *API, id string, obj *T, opts *UpdateOpts) (*T, error)
- func ReplaceName[T any](ctx context.Context, api *API, name, id string, obj *T, opts *UpdateOpts) (*T, error)
- func ReplicateIn[TIn, TOut any](ctx context.Context, api *API, in <-chan []*TIn, ...) error
- func ReplicateInName[TIn, TOut any](ctx context.Context, api *API, name string, in <-chan []*TIn, ...) error
- func ReplicateInNameOnce[TIn, TOut any](ctx context.Context, api *API, name string, in <-chan []*TIn, ...) error
- func ReplicateInOnce[TIn, TOut any](ctx context.Context, api *API, in <-chan []*TIn, ...) error
- func SetListHook[T any](api *API, hook ListHook)
- func SetListHookName[T any](api *API, name string, hook ListHook)
- func SyncList[T any](ctx context.Context, api *API, list []*T, opts *ListOpts) error
- func SyncListName[T any](ctx context.Context, api *API, name string, list []*T, opts *ListOpts) error
- func Update[T any](ctx context.Context, api *API, id string, obj *T, opts *UpdateOpts) (*T, error)
- func UpdateMap[T any](ctx context.Context, api *API, id string, patch map[string]any, ...) (*T, error)
- func UpdateName[T any](ctx context.Context, api *API, name, id string, obj *T, opts *UpdateOpts) (*T, error)
- func UpdateNameMap[T any](ctx context.Context, api *API, name, id string, patch map[string]any, ...) (*T, error)
- type API
- func (api *API) AddOpenAPIHook(hook OpenAPIHook)
- func (api *API) AddRequestHook(hook RequestHook)
- func (api *API) Addr() *net.TCPAddr
- func (api *API) CheckSafe()
- func (api *API) EventClient() *event.Client
- func (api *API) Handle(method, path string, handler httprouter.Handle)
- func (api *API) Handler(method, path string, handler http.Handler)
- func (api *API) HandlerFunc(method, path string, handler http.HandlerFunc)
- func (api *API) IsSafe() error
- func (api *API) ListenInsecure(bind string) error
- func (api *API) ListenSelfCert(bind string) error
- func (api *API) ListenTLS(bind, certFile, keyFile string) error
- func (api *API) Log(ctx context.Context, vals ...any)
- func (api *API) Serve() error
- func (api *API) ServeFiles(path string, fs http.FileSystem)
- func (api *API) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (api *API) SetEventData(ctx context.Context, vals ...any)
- func (api *API) SetOpenAPIInfo(info *OpenAPIInfo)
- func (api *API) SetStripPrefix(prefix string)
- func (api *API) Shutdown(ctx context.Context) error
- type ContextKey
- type DebugInfo
- type Filter
- type GetOpts
- type GetStream
- type HTTPInfo
- type IPInfo
- type ListHook
- type ListOpts
- type ListStream
- type Metadata
- type OpenAPI
- type OpenAPIHook
- type OpenAPIInfo
- type RequestHook
- type ServerInfo
- type TLSInfo
- type UpdateOpts
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBuildInfoFailed = errors.New("failed to read build info") ErrHeaderValueMissingQuotes = errors.New("header missing quotes") ErrUnknownAcceptType = errors.New("unknown Accept type") )
View Source
var ( ErrInvalidIfNoneMatch = errors.New("invalid If-None-Match") ErrIfNoneMatchUnknownType = fmt.Errorf("unknown type (%w)", ErrInvalidIfNoneMatch) ErrIfNoneMatchInvalidGeneration = fmt.Errorf("invalid generation (%w)", ErrInvalidIfNoneMatch) )
View Source
var ( ErrInvalidFilterOp = errors.New("invalid filter operator") ErrInvalidSort = errors.New("invalid _sort") ErrInvalidStreamFormat = errors.New("invalid _stream") )
View Source
var ErrEndOfStream = fmt.Errorf("end of stream")
View Source
var ErrMissingAuthCheck = errors.New("missing auth check")
View Source
var ErrStreamingNotSupported = errors.New("streaming not supported")
Functions ¶
func AddAuthBasic ¶
func AddAuthBasicName ¶
func AddAuthBearer ¶
func AddAuthBearerName ¶
func ApplyFilters ¶
func ApplySorts ¶
func ApplyWindow ¶
func CreateName ¶
func DeleteName ¶
func FieldChanged ¶
func OpenAPIHookAuthBasic ¶
func OpenAPIHookAuthBearer ¶
func RegisterName ¶
func ReplaceName ¶
func ReplicateIn ¶
func ReplicateInName ¶
func ReplicateInNameOnce ¶
func ReplicateInOnce ¶
func SetListHook ¶
func SyncListName ¶
func UpdateName ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) AddOpenAPIHook ¶
func (api *API) AddOpenAPIHook(hook OpenAPIHook)
func (*API) AddRequestHook ¶
func (api *API) AddRequestHook(hook RequestHook)
func (*API) EventClient ¶
func (*API) HandlerFunc ¶
func (api *API) HandlerFunc(method, path string, handler http.HandlerFunc)
func (*API) ListenInsecure ¶
func (*API) ListenSelfCert ¶
func (*API) ServeFiles ¶
func (api *API) ServeFiles(path string, fs http.FileSystem)
func (*API) SetOpenAPIInfo ¶
func (api *API) SetOpenAPIInfo(info *OpenAPIInfo)
func (*API) SetStripPrefix ¶
type ContextKey ¶
type ContextKey int
const ( ContextStub ContextKey = iota ContextAuthBasicLookup ContextAuthBearerLookup ContextReplicate ContextAuthBearer ContextAuthBasic ContextWriteID ContextWriteGeneration ContextSpanID ContextEvent )
type DebugInfo ¶
type DebugInfo struct { Server *ServerInfo `json:"server"` IP *IPInfo `json:"ip"` HTTP *HTTPInfo `json:"http"` TLS *TLSInfo `json:"tls"` }
type GetOpts ¶
type GetOpts struct { IfNoneMatch []httpheader.EntityTag // This is "any" because making GetOpts generic complicates too many things Prev any }
type GetStream ¶
type GetStream[T any] struct { // contains filtered or unexported fields }
func StreamGetName ¶
type ListStream ¶
type ListStream[T any] struct { // contains filtered or unexported fields }
func StreamList ¶
func StreamListName ¶
func (*ListStream[T]) Chan ¶
func (ls *ListStream[T]) Chan() <-chan []*T
func (*ListStream[T]) Close ¶
func (ls *ListStream[T]) Close()
func (*ListStream[T]) Error ¶
func (ls *ListStream[T]) Error() error
func (*ListStream[T]) Read ¶
func (ls *ListStream[T]) Read() []*T
type OpenAPIHook ¶
type OpenAPIInfo ¶
type RequestHook ¶
type ServerInfo ¶
type ServerInfo struct {
Hostname string `json:"hostname"`
}
type UpdateOpts ¶
type UpdateOpts struct { IfMatch []httpheader.EntityTag // This is "any" because making UpdateOpts generic complicates too many things Prev any }
Click to show internal directories.
Click to hide internal directories.