Documentation ¶
Index ¶
- Constants
- Variables
- func Address(host string, port int) string
- func ErrorToNullString(err error) sql.NullString
- func FileExists(filePath string) (bool, error)
- func First(s ...string) string
- func FlagChannel(c chan<- struct{})
- func IgnoreError[T any](data T, err error) T
- func Int64ToNullInt64(i int64) sql.NullInt64
- func IsFieldErrors(err error) bool
- func IsForbidden(err error) bool
- func IsNotFound(err error) bool
- func NewNullInt64(i int64) sql.NullInt64
- func NewNullString(s string) sql.NullString
- func NewTimeRange(start, end time.Time) (models.TimeRange, error)
- func SplitAddress(address string) (host string, port string)
- func StringToNullString(s string) sql.NullString
- func ValidateStruct(ctx context.Context, s any) error
- func ValidateStructPartial(ctx context.Context, s any, fields ...string) error
- func WithPublicActor(ctx context.Context) context.Context
- func WithSystemActor(ctx context.Context) context.Context
- func WithUserActor(ctx context.Context, userID int64, admin bool) context.Context
- type Actor
- type ActorType
- type FieldError
- type FieldErrors
- type LockStore
- type LockUnlockFunc
- type MultiReadCloser
Constants ¶
View Source
const ( ActorTypeSystem = "system" ActorTypeUser = "user" ActorTypePublic = "public" )
Variables ¶
View Source
var ( ErrNotFound = fmt.Errorf("not found") ErrForbidden = fmt.Errorf("forbidden") )
View Source
var ErrLockResourceLocked = fmt.Errorf("resource locked")
View Source
var Locations []string = []string{} /* 598 elements not displayed */
View Source
var RuntimeToken string
RuntimeToken is a token that is generated at runtime to authenticate the application with itself.
Functions ¶
func ErrorToNullString ¶
func ErrorToNullString(err error) sql.NullString
func FileExists ¶
func FlagChannel ¶
func FlagChannel(c chan<- struct{})
func IgnoreError ¶
func Int64ToNullInt64 ¶
func IsFieldErrors ¶
func IsForbidden ¶
func IsNotFound ¶
func NewNullInt64 ¶
func NewNullString ¶
func NewNullString(s string) sql.NullString
func SplitAddress ¶
func StringToNullString ¶
func StringToNullString(s string) sql.NullString
func ValidateStructPartial ¶
func WithPublicActor ¶
WithPublicActor sets actor to public.
func WithSystemActor ¶
WithSystemActor sets actor to system.
Types ¶
type FieldError ¶
type FieldError struct { Field string // contains filtered or unexported fields }
func NewFieldError ¶
func NewFieldError(field, message string) FieldError
func ToFieldError ¶
func ToFieldError(field, err validator.FieldError) FieldError
func (FieldError) Error ¶
func (e FieldError) Error() string
func (FieldError) Message ¶
func (e FieldError) Message() string
type FieldErrors ¶
type FieldErrors []FieldError
func AsFieldErrors ¶
func AsFieldErrors(err error) (FieldErrors, bool)
func (FieldErrors) Error ¶
func (e FieldErrors) Error() string
type LockStore ¶
type LockStore[T comparable] struct { // contains filtered or unexported fields }
LockStore handles concurrent resource locking.
func NewLockStore ¶
func NewLockStore[T comparable]() *LockStore[T]
func (*LockStore[T]) Lock ¶
func (s *LockStore[T]) Lock(ctx context.Context, slug T) (LockUnlockFunc, error)
Lock blocks until it is able to lock the resource.
func (*LockStore[T]) TryLock ¶
func (s *LockStore[T]) TryLock(slug T) (LockUnlockFunc, error)
TryLock tries to lock the resource if it is available.
type LockUnlockFunc ¶
type LockUnlockFunc = func()
type MultiReadCloser ¶
func (MultiReadCloser) Close ¶
func (c MultiReadCloser) Close() error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.