Documentation
¶
Index ¶
Constants ¶
View Source
const ( ContextKeyUser contextKey = "user" ContextKeySession contextKey = "session" ContextKeyOrganization contextKey = "organization" )
Variables ¶
View Source
var ( // User errors ErrUserNotFound = errors.New("user not found") ErrUserAlreadyExists = errors.New("user already exists") ErrEmailAlreadyExists = errors.New("email already exists") ErrInvalidCredentials = errors.New("invalid credentials") // Session errors ErrSessionNotFound = errors.New("session not found") ErrSessionExpired = errors.New("session expired") ErrInvalidSession = errors.New("invalid session") // Auth errors ErrForbidden = errors.New("forbidden") ErrEmailNotVerified = errors.New("email not verified") // Organization errors ErrOrganizationNotFound = errors.New("organization not found") ErrNotOrganizationMember = errors.New("not an organization member") // Generic errors ErrInvalidInput = errors.New("invalid input") ErrInternalError = errors.New("internal error") )
Common errors
Functions ¶
func SetAuthContext ¶
func SetAuthContext(ctx context.Context, authCtx *AuthContext) context.Context
SetAuthContext sets auth context in context
Types ¶
type AuthContext ¶
AuthContext contains authentication context
func GetAuthContext ¶
func GetAuthContext(ctx context.Context) (*AuthContext, bool)
GetAuthContext retrieves auth context from context
type PaginatedResult ¶
PaginatedResult represents a paginated result
type PaginationOptions ¶
type PaginationOptions struct {
Page int
PageSize int
OrderBy string
OrderDir string // "asc" or "desc"
}
Pagination options
func DefaultPagination ¶
func DefaultPagination() PaginationOptions
DefaultPagination returns default pagination options
type ValidationError ¶
ValidationError represents a validation error
func NewValidationError ¶
func NewValidationError(field, message string) *ValidationError
NewValidationError creates a new validation error
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Click to show internal directories.
Click to hide internal directories.