Documentation
¶
Index ¶
- func EnforceResourceVisibility(ctx context.Context, resourceVisibility db_model.ResourceVisibility) error
- func InternalError(op string, err error) error
- func MethodHandleFunc[T any](fn func(req *http.Request) (*T, error)) http.Handler
- func NewErrorResponseStatus[T any](err error, code int) *model.Response[T]
- func NewHandler(dbconn *sql.DB) http.Handler
- func NewResponse[T any](data *T, err error) *model.Response[T]
- func ParseGenericJSON[T any](req *http.Request) (T, error)
- func ParseUUID(val string) (uuid.UUID, error)
- func ParseUUIDSet(val string) (uuid.UUIDs, error)
- func ResourceVisibilityFilter(ctx context.Context, idFilter uuid.UUIDs) db_model.ResourceVisibilities
- func RespondWithError(wrt http.ResponseWriter, err error)
- func SliceQueriedPage[T any](entres []T, page PagePointers) []T
- func UnwrapSearchIndex(index map[uuid.UUID]int, page PagePointers) []uuid.UUID
- type Page
- type PagePointers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnforceResourceVisibility ¶
func EnforceResourceVisibility(ctx context.Context, resourceVisibility db_model.ResourceVisibility) error
func InternalError ¶
func MethodHandleFunc ¶
func NewErrorResponseStatus ¶
func RespondWithError ¶
func RespondWithError(wrt http.ResponseWriter, err error)
func SliceQueriedPage ¶
func SliceQueriedPage[T any](entres []T, page PagePointers) []T
func UnwrapSearchIndex ¶
Types ¶
type Page ¶
type Page[T any] struct { PagePointers Entries []T `json:"entries"` HasNext bool `json:"has_next"` }
func TransformPage ¶
func TransformPage[E any, R any](page PagePointers, entries []E, transformer func(E) R) *Page[R]
func WrapPage ¶
func WrapPage[T any](page PagePointers, entries []T) *Page[T]
type PagePointers ¶
func Pagination ¶
func Pagination(req *http.Request) PagePointers
func (*PagePointers) QueryLimit ¶
func (pptr *PagePointers) QueryLimit() int64
func (*PagePointers) QueryOffset ¶
func (pptr *PagePointers) QueryOffset() int64
Click to show internal directories.
Click to hide internal directories.