Documentation ¶
Index ¶
- Constants
- Variables
- func Connect(path ...route.PathValue) route.Config
- func CreateMigrationsConnections(config config.Databases) map[string]*quirk.DB
- func CreateUsersTable(q *quirk.Quirk, customFields ...quirk.Field)
- func Delete(path ...route.PathValue) route.Config
- func DropUsersTable(q *quirk.Quirk)
- func Get(path ...route.PathValue) route.Config
- func Handler(fn handler.Fn) route.Config
- func Head(path ...route.PathValue) route.Config
- func Interface[T any]() string
- func IsFirstCharUpper(v string) bool
- func Layout(name string) route.Config
- func Localize() route.Config
- func Method(methods ...route.Config) route.Config
- func Name(name string) route.Config
- func Options(path ...route.PathValue) route.Config
- func Patch(path ...route.PathValue) route.Config
- func Path(path route.PathValue) route.Config
- func Post(path ...route.PathValue) route.Config
- func Provide[T any](c Control, name ...string) *T
- func Put(path ...route.PathValue) route.Config
- func Query[T any](c Control, key string) T
- func Route(configs ...route.Config) *route.Builder
- func Trace(path ...route.PathValue) route.Config
- func Var[T any](c Control, key string) T
- type AddFlashMessage
- type Auth
- type AuthIn
- type Cache
- type Component
- type Control
- type Controller
- type Controllers
- type Cookie
- type Core
- type Create
- type Csrf
- type Dependency
- type Email
- type Error
- type ErrorHandler
- type FlashMessage
- type FlashMessenger
- type Form
- type Generator
- type HxGenerator
- type LinkGenerator
- type Map
- type Module
- type Provider
- type Request
- type Response
- type Result
- type Routes
- type SessionManager
- type StateManager
- type TfaManager
- type Token
- type Ui
- type UrlGenerator
- type User
- type UserField
- type UserManager
Constants ¶
View Source
const ( FlashMessageTypeSuccess = "success" FlashMessageTypeWarning = "warning" FlashMessageTypeError = "error" )
View Source
const ( UserActive = "active" UserRoles = "roles" UserEmail = "email" UserPassword = "password" UserTfa = "tfa" UserTfaSecret = "tfa_secret" UserTfaCodes = "tfa_codes" UserTfaUrl = "tfa_url" UserLastActivity = "last_activity" )
Variables ¶
View Source
var ( ErrorInvalidCredentials = errors.New("invalid credentials") ErrorInvalidDatabase = errors.New("invalid database") ErrorForbidden = errors.New("insufficient rights") )
View Source
var ( ErrorMissingUser = errors.New("user doesn't exist") ErrorMismatchPassword = errors.New("passwords aren't equal") ErrorHash = errors.New("hash failed") )
View Source
var (
FlashMessageExpiration = time.Hour
)
Functions ¶
func CreateUsersTable ¶ added in v0.1.3
func DropUsersTable ¶ added in v0.1.3
func IsFirstCharUpper ¶
Types ¶
type AddFlashMessage ¶ added in v0.1.4
type Auth ¶
type Auth interface { Session() SessionManager Tfa() TfaManager User(dbname ...string) UserManager CustomUser(id int, email string, dbname ...string) UserManager In(email, password string) AuthIn Out() }
type Control ¶
type Control interface { Assets() assets.Assets Auth() Auth Cache() Cache Continue() Result Cookie() Cookie Config() config.Config Create() Create Csrf() Csrf DB(name ...string) *quirk.Quirk Dev() dev.Dev Email() Email Error() ErrorHandler File() filesystem.Filesystem Flash() FlashMessenger Generate() Generator Link(name string, arg ...Map) string Page() page.Page Request() Request Response() Response State() StateManager Translate(key string, args ...map[string]any) string }
type Controller ¶
type Controllers ¶
type Controllers []Controller
type Core ¶
type Dependency ¶
type Dependency struct {
// contains filtered or unexported fields
}
func Register ¶
func Register(provider Provider) *Dependency
func (*Dependency) Name ¶
func (d *Dependency) Name(name string) *Dependency
func (*Dependency) Singleton ¶
func (d *Dependency) Singleton() *Dependency
type Email ¶
type Email interface { Attachment(name string, data []byte) Email Body(nodes ...gox.Node) Email Bytes() []byte Copy(values ...string) Email From(from string) Email HiddenCopy(values ...string) Email Subject(subject string) Email Title(title string) Email To(to ...string) Email Send() String() string }
type ErrorHandler ¶
type ErrorHandler interface { Check(err error) Throw() Message(message string, params ...map[string]any) ErrorHandler Internal() ErrorHandler BadRequest() ErrorHandler Forbidden() ErrorHandler NotFound() ErrorHandler }
type FlashMessage ¶ added in v0.1.4
type FlashMessenger ¶ added in v0.1.4
type FlashMessenger interface { Get() []FlashMessage Add() AddFlashMessage }
type Generator ¶
type Generator interface { Hx() HxGenerator Link() LinkGenerator Query(arg Map) string Url() UrlGenerator }
type HxGenerator ¶ added in v0.2.4
type LinkGenerator ¶
type Module ¶
type Module interface { Controllers() Controllers Name() string }
type Request ¶
type Request interface { ContentType() string Form() requester.Form Header() http.Header Host() string Ip() string Is() requester.Is Lang() string Method() string Path() string Protocol() string Query(key string, defaultValue ...string) string Raw() *http.Request Route() string UserAgent() string Var(key string, defaultValue ...string) string }
type Response ¶
type Response interface { Error(err error) Result File(name string, data []byte) Result Json(value any) Result Header() http.Header Hx() hx.Response Raw() http.ResponseWriter Redirect(name string, arg ...Map) Result Refresh() Result Render(nodes ...gox.Node) Result Status(statusCode int) Response Text(text string) Result Empty() Result }
type SessionManager ¶
type StateManager ¶
type TfaManager ¶
type UrlGenerator ¶
type User ¶
type User struct { Id int `json:"id"` Active bool `json:"active"` Roles []string `json:"roles"` Email string `json:"email"` Password string `json:"password"` Tfa bool `json:"tfa"` TfaSecret sql.NullString `json:"tfaSecret"` TfaCodes sql.NullString `json:"tfaCodes"` TfaUrl sql.NullString `json:"tfaUrl"` LastActivity time.Time `json:"lastActivity"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` // contains filtered or unexported fields }
type UserManager ¶
type UserManager interface { Get(id ...int) User Create(r User) int Update(r User, columns ...string) UpdatePassword(actualPassword, newPassword string) error ForceUpdatePassword(newPassword string) error Enable(id ...int) Disable(id ...int) }
func CreateUserManager ¶
func CreateUserManager(db *quirk.DB, id int, email string) UserManager
Source Files ¶
- assets-reader.go
- auth.go
- cache.go
- component.go
- control.go
- controller.go
- cookie.go
- core.go
- create.go
- csrf.go
- db-migration.go
- di.go
- email.go
- error-handler.go
- flash-message.go
- form.go
- generator.go
- lifecycle.go
- middleware.go
- module.go
- query.go
- request.go
- response.go
- route.go
- router.go
- server-handler.go
- session.go
- shared.go
- state.go
- tfa.go
- ui.go
- user.go
- util.go
- var.go
Click to show internal directories.
Click to hide internal directories.