Documentation
¶
Overview ¶
Package models implements various services used for request data validation and applying changes to existing DB models through the app Dao.
Index ¶
- type AdminLogin
- type AdminPasswordResetConfirm
- type AdminPasswordResetRequest
- type AdminUpsert
- type CollectionUpsert
- type InterceptorFunc
- type InterceptorNextFunc
- type RealtimeSubscribe
- type RecordUpsert
- type SettingsUpsert
- type UserEmailChangeConfirm
- type UserEmailChangeRequest
- type UserEmailLogin
- type UserOauth2Login
- type UserPasswordResetConfirm
- type UserPasswordResetRequest
- type UserUpsert
- type UserVerificationConfirm
- type UserVerificationRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminLogin ¶
type AdminLogin struct {
Email string `form:"email" json:"email"`
Password string `form:"password" json:"password"`
// contains filtered or unexported fields
}
AdminLogin defines an admin email/pass login form.
func NewAdminLogin ¶
func NewAdminLogin(app core.App) *AdminLogin
NewAdminLogin creates new admin login form for the provided app.
func (*AdminLogin) Submit ¶
func (form *AdminLogin) Submit() (*models.Admin, error)
Submit validates and submits the admin form. On success returns the authorized admin model.
func (*AdminLogin) Validate ¶
func (form *AdminLogin) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type AdminPasswordResetConfirm ¶
type AdminPasswordResetConfirm struct {
Token string `form:"token" json:"token"`
Password string `form:"password" json:"password"`
PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"`
// contains filtered or unexported fields
}
AdminPasswordResetConfirm defines an admin password reset confirmation form.
func NewAdminPasswordResetConfirm ¶
func NewAdminPasswordResetConfirm(app core.App) *AdminPasswordResetConfirm
NewAdminPasswordResetConfirm creates new admin password reset confirmation form.
func (*AdminPasswordResetConfirm) Submit ¶
func (form *AdminPasswordResetConfirm) Submit() (*models.Admin, error)
Submit validates and submits the admin password reset confirmation form. On success returns the updated admin model associated to `form.Token`.
func (*AdminPasswordResetConfirm) Validate ¶
func (form *AdminPasswordResetConfirm) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type AdminPasswordResetRequest ¶
type AdminPasswordResetRequest struct {
Email string `form:"email" json:"email"`
// contains filtered or unexported fields
}
AdminPasswordResetRequest defines an admin password reset request form.
func NewAdminPasswordResetRequest ¶
func NewAdminPasswordResetRequest(app core.App) *AdminPasswordResetRequest
NewAdminPasswordResetRequest creates new admin password reset request form.
func (*AdminPasswordResetRequest) Submit ¶
func (form *AdminPasswordResetRequest) Submit() error
Submit validates and submits the form. On success sends a password reset email to the `form.Email` admin.
func (*AdminPasswordResetRequest) Validate ¶
func (form *AdminPasswordResetRequest) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
This method doesn't verify that admin with `form.Email` exists (this is done on Submit).
type AdminUpsert ¶
type AdminUpsert struct {
Avatar int `form:"avatar" json:"avatar"`
Email string `form:"email" json:"email"`
Password string `form:"password" json:"password"`
PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"`
// contains filtered or unexported fields
}
AdminUpsert defines an admin upsert (create/update) form.
func NewAdminUpsert ¶
func NewAdminUpsert(app core.App, admin *models.Admin) *AdminUpsert
NewAdminUpsert creates new upsert form for the provided admin model (pass an empty admin model instance (`&models.Admin{}`) for create).
func (*AdminUpsert) Submit ¶
func (form *AdminUpsert) Submit(interceptors ...InterceptorFunc) error
Submit validates the form and upserts the form admin model.
You can optionally provide a list of InterceptorFunc to further modify the form behavior before persisting it.
func (*AdminUpsert) Validate ¶
func (form *AdminUpsert) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type CollectionUpsert ¶
type CollectionUpsert struct {
Name string `form:"name" json:"name"`
System bool `form:"system" json:"system"`
Schema schema.Schema `form:"schema" json:"schema"`
ListRule *string `form:"listRule" json:"listRule"`
ViewRule *string `form:"viewRule" json:"viewRule"`
CreateRule *string `form:"createRule" json:"createRule"`
UpdateRule *string `form:"updateRule" json:"updateRule"`
DeleteRule *string `form:"deleteRule" json:"deleteRule"`
// contains filtered or unexported fields
}
CollectionUpsert defines a collection upsert (create/update) form.
func NewCollectionUpsert ¶
func NewCollectionUpsert(app core.App, collection *models.Collection) *CollectionUpsert
NewCollectionUpsert creates new collection upsert form for the provided Collection model (pass an empty Collection model instance (`&models.Collection{}`) for create).
func (*CollectionUpsert) Submit ¶
func (form *CollectionUpsert) Submit(interceptors ...InterceptorFunc) error
Submit validates the form and upserts the form's Collection model.
On success the related record table schema will be auto updated.
You can optionally provide a list of InterceptorFunc to further modify the form behavior before persisting it.
func (*CollectionUpsert) Validate ¶
func (form *CollectionUpsert) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type InterceptorFunc ¶ added in v0.2.4
type InterceptorFunc func(next InterceptorNextFunc) InterceptorNextFunc
InterceptorFunc defines a single interceptor function that will execute the provided next func handler.
type InterceptorNextFunc ¶ added in v0.2.4
type InterceptorNextFunc = func() error
InterceptorNextFunc is a interceptor handler function. Usually used in combination with InterceptorFunc.
type RealtimeSubscribe ¶
type RealtimeSubscribe struct {
ClientId string `form:"clientId" json:"clientId"`
Subscriptions []string `form:"subscriptions" json:"subscriptions"`
}
RealtimeSubscribe defines a RealtimeSubscribe request form.
func NewRealtimeSubscribe ¶
func NewRealtimeSubscribe() *RealtimeSubscribe
NewRealtimeSubscribe creates new RealtimeSubscribe request form.
func (*RealtimeSubscribe) Validate ¶
func (form *RealtimeSubscribe) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type RecordUpsert ¶
type RecordUpsert struct {
Data map[string]any `json:"data"`
// contains filtered or unexported fields
}
RecordUpsert defines a Record upsert form.
func NewRecordUpsert ¶
func NewRecordUpsert(app core.App, record *models.Record) *RecordUpsert
NewRecordUpsert creates a new Record upsert form. (pass a new Record model instance (`models.NewRecord(...)`) for create).
func (*RecordUpsert) DrySubmit ¶
func (form *RecordUpsert) DrySubmit(callback func(txDao *daos.Dao) error) error
DrySubmit performs a form submit within a transaction and reverts it. For actual record persistence, check the `form.Submit()` method.
This method doesn't handle file uploads/deletes or trigger any app events!
func (*RecordUpsert) LoadData ¶
func (form *RecordUpsert) LoadData(r *http.Request) error
LoadData loads and normalizes json OR multipart/form-data request data.
File upload is supported only via multipart/form-data.
To REPLACE previously uploaded file(s) you can suffix the field name with the file index (eg. `myfile.0`) and set the new value. For single file upload fields, you can skip the index and directly assign the file value to the field name (eg. `myfile`).
To DELETE previously uploaded file(s) you can suffix the field name with the file index (eg. `myfile.0`) and set it to null or empty string. For single file upload fields, you can skip the index and directly reset the field using its field name (eg. `myfile`).
func (*RecordUpsert) Submit ¶
func (form *RecordUpsert) Submit(interceptors ...InterceptorFunc) error
Submit validates the form and upserts the form Record model.
You can optionally provide a list of InterceptorFunc to further modify the form behavior before persisting it.
func (*RecordUpsert) Validate ¶
func (form *RecordUpsert) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type SettingsUpsert ¶
SettingsUpsert defines app settings upsert form.
func NewSettingsUpsert ¶
func NewSettingsUpsert(app core.App) *SettingsUpsert
NewSettingsUpsert creates new settings upsert form from the provided app.
func (*SettingsUpsert) Submit ¶
func (form *SettingsUpsert) Submit(interceptors ...InterceptorFunc) error
Submit validates the form and upserts the loaded settings.
On success the app settings will be refreshed with the form ones.
You can optionally provide a list of InterceptorFunc to further modify the form behavior before persisting it.
func (*SettingsUpsert) Validate ¶
func (form *SettingsUpsert) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type UserEmailChangeConfirm ¶
type UserEmailChangeConfirm struct {
Token string `form:"token" json:"token"`
Password string `form:"password" json:"password"`
// contains filtered or unexported fields
}
UserEmailChangeConfirm defines a user email change confirmation form.
func NewUserEmailChangeConfirm ¶
func NewUserEmailChangeConfirm(app core.App) *UserEmailChangeConfirm
NewUserEmailChangeConfirm creates new user email change confirmation form.
func (*UserEmailChangeConfirm) Submit ¶
func (form *UserEmailChangeConfirm) Submit() (*models.User, error)
Submit validates and submits the user email change confirmation form. On success returns the updated user model associated to `form.Token`.
func (*UserEmailChangeConfirm) Validate ¶
func (form *UserEmailChangeConfirm) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type UserEmailChangeRequest ¶
type UserEmailChangeRequest struct {
NewEmail string `form:"newEmail" json:"newEmail"`
// contains filtered or unexported fields
}
UserEmailChangeRequest defines a user email change request form.
func NewUserEmailChangeRequest ¶
func NewUserEmailChangeRequest(app core.App, user *models.User) *UserEmailChangeRequest
NewUserEmailChangeRequest creates a new user email change request form.
func (*UserEmailChangeRequest) Submit ¶
func (form *UserEmailChangeRequest) Submit() error
Submit validates and sends the change email request.
func (*UserEmailChangeRequest) Validate ¶
func (form *UserEmailChangeRequest) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type UserEmailLogin ¶
type UserEmailLogin struct {
Email string `form:"email" json:"email"`
Password string `form:"password" json:"password"`
// contains filtered or unexported fields
}
UserEmailLogin defines a user email/pass login form.
func NewUserEmailLogin ¶
func NewUserEmailLogin(app core.App) *UserEmailLogin
NewUserEmailLogin creates a new user email/pass login form.
func (*UserEmailLogin) Submit ¶
func (form *UserEmailLogin) Submit() (*models.User, error)
Submit validates and submits the form. On success returns the authorized user model.
func (*UserEmailLogin) Validate ¶
func (form *UserEmailLogin) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type UserOauth2Login ¶
type UserOauth2Login struct {
// The name of the OAuth2 client provider (eg. "google")
Provider string `form:"provider" json:"provider"`
// The authorization code returned from the initial request.
Code string `form:"code" json:"code"`
// The code verifier sent with the initial request as part of the code_challenge.
CodeVerifier string `form:"codeVerifier" json:"codeVerifier"`
// The redirect url sent with the initial request.
RedirectUrl string `form:"redirectUrl" json:"redirectUrl"`
// contains filtered or unexported fields
}
UserOauth2Login defines a user Oauth2 login form.
func NewUserOauth2Login ¶
func NewUserOauth2Login(app core.App) *UserOauth2Login
NewUserOauth2Login creates a new user Oauth2 login form.
func (*UserOauth2Login) Submit ¶
Submit validates and submits the form. On success returns the authorized user model and the fetched provider's data.
func (*UserOauth2Login) Validate ¶
func (form *UserOauth2Login) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type UserPasswordResetConfirm ¶
type UserPasswordResetConfirm struct {
Token string `form:"token" json:"token"`
Password string `form:"password" json:"password"`
PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"`
// contains filtered or unexported fields
}
UserPasswordResetConfirm defines a user password reset confirmation form.
func NewUserPasswordResetConfirm ¶
func NewUserPasswordResetConfirm(app core.App) *UserPasswordResetConfirm
NewUserPasswordResetConfirm creates new user password reset confirmation form.
func (*UserPasswordResetConfirm) Submit ¶
func (form *UserPasswordResetConfirm) Submit() (*models.User, error)
Submit validates and submits the form. On success returns the updated user model associated to `form.Token`.
func (*UserPasswordResetConfirm) Validate ¶
func (form *UserPasswordResetConfirm) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type UserPasswordResetRequest ¶
type UserPasswordResetRequest struct {
Email string `form:"email" json:"email"`
// contains filtered or unexported fields
}
UserPasswordResetRequest defines a user password reset request form.
func NewUserPasswordResetRequest ¶
func NewUserPasswordResetRequest(app core.App) *UserPasswordResetRequest
NewUserPasswordResetRequest creates new user password reset request form.
func (*UserPasswordResetRequest) Submit ¶
func (form *UserPasswordResetRequest) Submit() error
Submit validates and submits the form. On success sends a password reset email to the `form.Email` user.
func (*UserPasswordResetRequest) Validate ¶
func (form *UserPasswordResetRequest) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
This method doesn't checks whether user with `form.Email` exists (this is done on Submit).
type UserUpsert ¶
type UserUpsert struct {
Email string `form:"email" json:"email"`
Password string `form:"password" json:"password"`
PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"`
// contains filtered or unexported fields
}
UserUpsert defines a user upsert (create/update) form.
func NewUserUpsert ¶
func NewUserUpsert(app core.App, user *models.User) *UserUpsert
NewUserUpsert creates new upsert form for the provided user model (pass an empty user model instance (`&models.User{}`) for create).
func (*UserUpsert) Submit ¶
func (form *UserUpsert) Submit(interceptors ...InterceptorFunc) error
Submit validates the form and upserts the form user model.
You can optionally provide a list of InterceptorFunc to further modify the form behavior before persisting it.
func (*UserUpsert) Validate ¶
func (form *UserUpsert) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type UserVerificationConfirm ¶
type UserVerificationConfirm struct {
Token string `form:"token" json:"token"`
// contains filtered or unexported fields
}
UserVerificationConfirm defines a user email confirmation form.
func NewUserVerificationConfirm ¶
func NewUserVerificationConfirm(app core.App) *UserVerificationConfirm
NewUserVerificationConfirm creates a new user email confirmation form.
func (*UserVerificationConfirm) Submit ¶
func (form *UserVerificationConfirm) Submit() (*models.User, error)
Submit validates and submits the form. On success returns the verified user model associated to `form.Token`.
func (*UserVerificationConfirm) Validate ¶
func (form *UserVerificationConfirm) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type UserVerificationRequest ¶
type UserVerificationRequest struct {
Email string `form:"email" json:"email"`
// contains filtered or unexported fields
}
UserVerificationRequest defines a user email verification request form.
func NewUserVerificationRequest ¶
func NewUserVerificationRequest(app core.App) *UserVerificationRequest
NewUserVerificationRequest creates a new user email verification request form.
func (*UserVerificationRequest) Submit ¶
func (form *UserVerificationRequest) Submit() error
Submit validates and sends a verification request email to the `form.Email` user.
func (*UserVerificationRequest) Validate ¶
func (form *UserVerificationRequest) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
// This method doesn't verify that user with `form.Email` exists (this is done on Submit).
Source Files
¶
- admin_login.go
- admin_password_reset_confirm.go
- admin_password_reset_request.go
- admin_upsert.go
- base.go
- collection_upsert.go
- realtime_subscribe.go
- record_upsert.go
- settings_upsert.go
- user_email_change_confirm.go
- user_email_change_request.go
- user_email_login.go
- user_oauth2_login.go
- user_password_reset_confirm.go
- user_password_reset_request.go
- user_upsert.go
- user_verification_confirm.go
- user_verification_request.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package validators implements custom shared PocketBase validators.
|
Package validators implements custom shared PocketBase validators. |