Documentation
¶
Index ¶
Constants ¶
View Source
const ( ContextKeyUser contextKey = "user" ContextKeySession contextKey = "session" ContextKeyOrganization contextKey = "organization" )
Variables ¶
View Source
var ( // ErrUserNotFound errors. ErrUserNotFound = errs.New("user not found") ErrUserAlreadyExists = errs.New("user already exists") ErrEmailAlreadyExists = errs.New("email already exists") ErrInvalidCredentials = errs.New("invalid credentials") // ErrSessionNotFound errors. ErrSessionNotFound = errs.New("session not found") ErrSessionExpired = errs.New("session expired") ErrInvalidSession = errs.New("invalid session") // ErrUnauthorized errors. ErrForbidden = errs.New("forbidden") ErrEmailNotVerified = errs.New("email not verified") // ErrOrganizationNotFound errors. ErrOrganizationNotFound = errs.New("organization not found") ErrNotOrganizationMember = errs.New("not an organization member") // ErrInvalidInput errors. ErrInvalidInput = errs.New("invalid input") ErrInternalError = errs.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"
}
PaginationOptions 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.