forms

package
v0.0.0-...-c627d9c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2023 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package models implements various services used for request data validation and applying changes to existing DB models through the app Dao.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminLogin

type AdminLogin struct {
	Identity string `form:"identity" json:"identity"`
	Password string `form:"password" json:"password"`
	// contains filtered or unexported fields
}

AdminLogin is an admin email/pass login form.

func NewAdminLogin

func NewAdminLogin(app core.App) *AdminLogin

NewAdminLogin creates a new AdminLogin form initialized with the provided core.App instance.

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*AdminLogin) SetDao

func (form *AdminLogin) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

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 is an admin password reset confirmation form.

func NewAdminPasswordResetConfirm

func NewAdminPasswordResetConfirm(app core.App) *AdminPasswordResetConfirm

NewAdminPasswordResetConfirm creates a new AdminPasswordResetConfirm form initialized with from the provided core.App instance.

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*AdminPasswordResetConfirm) SetDao

func (form *AdminPasswordResetConfirm) SetDao(dao *daos.Dao)

SetDao replaces the form Dao instance with the provided one.

This is useful if you want to use a specific transaction Dao instance instead of the default app.Dao().

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 is an admin password reset request form.

func NewAdminPasswordResetRequest

func NewAdminPasswordResetRequest(app core.App) *AdminPasswordResetRequest

NewAdminPasswordResetRequest creates a new AdminPasswordResetRequest form initialized with from the provided core.App instance.

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*AdminPasswordResetRequest) SetDao

func (form *AdminPasswordResetRequest) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

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 {
	Id              string `form:"id" json:"id"`
	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 is a models.Admin upsert (create/update) form.

func NewAdminUpsert

func NewAdminUpsert(app core.App, admin *models.Admin) *AdminUpsert

NewAdminUpsert creates a new AdminUpsert form with initializer config created from the provided core.App and models.Admin instances (for create you could pass a pointer to an empty Admin - `&models.Admin{}`).

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*AdminUpsert) SetDao

func (form *AdminUpsert) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

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 {
	Id         string        `form:"id" json:"id"`
	Type       string        `form:"type" json:"type"`
	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"`
	Options    types.JsonMap `form:"options" json:"options"`
	// contains filtered or unexported fields
}

CollectionUpsert is a models.Collection upsert (create/update) form.

func NewCollectionUpsert

func NewCollectionUpsert(app core.App, collection *models.Collection) *CollectionUpsert

NewCollectionUpsert creates a new CollectionUpsert form with initializer config created from the provided core.App and models.Collection instances (for create you could pass a pointer to an empty Collection - `&models.Collection{}`).

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*CollectionUpsert) SetDao

func (form *CollectionUpsert) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

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 CollectionsImport

type CollectionsImport struct {
	Collections   []*models.Collection `form:"collections" json:"collections"`
	DeleteMissing bool                 `form:"deleteMissing" json:"deleteMissing"`
	// contains filtered or unexported fields
}

CollectionsImport is a form model to bulk import (create, replace and delete) collections from a user provided list.

func NewCollectionsImport

func NewCollectionsImport(app core.App) *CollectionsImport

NewCollectionsImport creates a new CollectionsImport form with initialized with from the provided core.App instance.

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*CollectionsImport) SetDao

func (form *CollectionsImport) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

func (*CollectionsImport) Submit

func (form *CollectionsImport) Submit(interceptors ...InterceptorFunc) error

Submit applies the import, aka.: - imports the form collections (create or replace) - sync the collection changes with their related records table - ensures the integrity of the imported structure (aka. run validations for each collection) - if [form.DeleteMissing] is set, deletes all local collections that are not found in the imports list

All operations are wrapped in a single transaction that are rollbacked on the first encountered error.

You can optionally provide a list of InterceptorFunc to further modify the form behavior before persisting it.

func (*CollectionsImport) Validate

func (form *CollectionsImport) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type InterceptorFunc

type InterceptorFunc func(next InterceptorNextFunc) InterceptorNextFunc

InterceptorFunc defines a single interceptor function that will execute the provided next func handler.

type InterceptorNextFunc

type InterceptorNextFunc = func() error

InterceptorNextFunc is a interceptor handler function. Usually used in combination with InterceptorFunc.

type InterceptorWithRecordFunc

type InterceptorWithRecordFunc func(next InterceptorWithRecordNextFunc) InterceptorWithRecordNextFunc

InterceptorWithRecordFunc defines a single Record interceptor function that will execute the provided next func handler.

type InterceptorWithRecordNextFunc

type InterceptorWithRecordNextFunc = func(record *models.Record) error

InterceptorWithRecordNextFunc is a Record interceptor handler function. Usually used in combination with InterceptorWithRecordFunc.

type RealtimeSubscribe

type RealtimeSubscribe struct {
	ClientId      string   `form:"clientId" json:"clientId"`
	Subscriptions []string `form:"subscriptions" json:"subscriptions"`
}

RealtimeSubscribe is a realtime subscriptions 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 RecordEmailChangeConfirm

type RecordEmailChangeConfirm struct {
	Token    string `form:"token" json:"token"`
	Password string `form:"password" json:"password"`
	// contains filtered or unexported fields
}

RecordEmailChangeConfirm is an auth record email change confirmation form.

func NewRecordEmailChangeConfirm

func NewRecordEmailChangeConfirm(app core.App, collection *models.Collection) *RecordEmailChangeConfirm

NewRecordEmailChangeConfirm creates a new RecordEmailChangeConfirm form initialized with from the provided core.App and models.Collection instances.

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*RecordEmailChangeConfirm) SetDao

func (form *RecordEmailChangeConfirm) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

func (*RecordEmailChangeConfirm) Submit

func (form *RecordEmailChangeConfirm) Submit(interceptors ...InterceptorWithRecordFunc) (*models.Record, error)

Submit validates and submits the auth record email change confirmation form. On success returns the updated auth record associated to `form.Token`.

You can optionally provide a list of InterceptorWithRecordFunc to further modify the form behavior before persisting it.

func (*RecordEmailChangeConfirm) Validate

func (form *RecordEmailChangeConfirm) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type RecordEmailChangeRequest

type RecordEmailChangeRequest struct {
	NewEmail string `form:"newEmail" json:"newEmail"`
	// contains filtered or unexported fields
}

RecordEmailChangeRequest is an auth record email change request form.

func NewRecordEmailChangeRequest

func NewRecordEmailChangeRequest(app core.App, record *models.Record) *RecordEmailChangeRequest

NewRecordEmailChangeRequest creates a new RecordEmailChangeRequest form initialized with from the provided core.App and models.Record instances.

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*RecordEmailChangeRequest) SetDao

func (form *RecordEmailChangeRequest) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

func (*RecordEmailChangeRequest) Submit

func (form *RecordEmailChangeRequest) Submit(interceptors ...InterceptorWithRecordFunc) error

Submit validates and sends the change email request.

You can optionally provide a list of InterceptorWithRecordFunc to further modify the form behavior before persisting it.

func (*RecordEmailChangeRequest) Validate

func (form *RecordEmailChangeRequest) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type RecordOAuth2Login

type RecordOAuth2Login 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"`

	// Additional data that will be used for creating a new auth record
	// if an existing OAuth2 account doesn't exist.
	CreateData map[string]any `form:"createData" json:"createData"`
	// contains filtered or unexported fields
}

RecordOAuth2Login is an auth record OAuth2 login form.

func NewRecordOAuth2Login

func NewRecordOAuth2Login(app core.App, collection *models.Collection, optAuthRecord *models.Record) *RecordOAuth2Login

NewRecordOAuth2Login creates a new RecordOAuth2Login form with initialized with from the provided core.App instance.

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*RecordOAuth2Login) SetDao

func (form *RecordOAuth2Login) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

func (*RecordOAuth2Login) Submit

func (form *RecordOAuth2Login) Submit(
	beforeCreateFuncs ...func(createForm *RecordUpsert, authRecord *models.Record, authUser *auth.AuthUser) error,
) (*models.Record, *auth.AuthUser, error)

Submit validates and submits the form.

If an auth record doesn't exist, it will make an attempt to create it based on the fetched OAuth2 profile data via a local RecordUpsert form. You can intercept/modify the create form by setting the optional beforeCreateFuncs argument.

On success returns the authorized record model and the fetched provider's data.

func (*RecordOAuth2Login) Validate

func (form *RecordOAuth2Login) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type RecordPasswordLogin

type RecordPasswordLogin struct {
	Identity string `form:"identity" json:"identity"`
	Password string `form:"password" json:"password"`
	// contains filtered or unexported fields
}

RecordPasswordLogin is record username/email + password login form.

func NewRecordPasswordLogin

func NewRecordPasswordLogin(app core.App, collection *models.Collection) *RecordPasswordLogin

NewRecordPasswordLogin creates a new RecordPasswordLogin form initialized with from the provided core.App and models.Collection instance.

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*RecordPasswordLogin) SetDao

func (form *RecordPasswordLogin) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

func (*RecordPasswordLogin) Submit

func (form *RecordPasswordLogin) Submit() (*models.Record, error)

Submit validates and submits the form. On success returns the authorized record model.

func (*RecordPasswordLogin) Validate

func (form *RecordPasswordLogin) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type RecordPasswordResetConfirm

type RecordPasswordResetConfirm struct {
	Token           string `form:"token" json:"token"`
	Password        string `form:"password" json:"password"`
	PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"`
	// contains filtered or unexported fields
}

RecordPasswordResetConfirm is an auth record password reset confirmation form.

func NewRecordPasswordResetConfirm

func NewRecordPasswordResetConfirm(app core.App, collection *models.Collection) *RecordPasswordResetConfirm

NewRecordPasswordResetConfirm creates a new RecordPasswordResetConfirm form initialized with from the provided core.App instance.

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*RecordPasswordResetConfirm) SetDao

func (form *RecordPasswordResetConfirm) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

func (*RecordPasswordResetConfirm) Submit

func (form *RecordPasswordResetConfirm) Submit(interceptors ...InterceptorWithRecordFunc) (*models.Record, error)

Submit validates and submits the form. On success returns the updated auth record associated to `form.Token`.

You can optionally provide a list of InterceptorWithRecordFunc to further modify the form behavior before persisting it.

func (*RecordPasswordResetConfirm) Validate

func (form *RecordPasswordResetConfirm) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type RecordPasswordResetRequest

type RecordPasswordResetRequest struct {
	Email string `form:"email" json:"email"`
	// contains filtered or unexported fields
}

RecordPasswordResetRequest is an auth record reset password request form.

func NewRecordPasswordResetRequest

func NewRecordPasswordResetRequest(app core.App, collection *models.Collection) *RecordPasswordResetRequest

NewRecordPasswordResetRequest creates a new RecordPasswordResetRequest form initialized with from the provided core.App instance.

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*RecordPasswordResetRequest) SetDao

func (form *RecordPasswordResetRequest) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

func (*RecordPasswordResetRequest) Submit

func (form *RecordPasswordResetRequest) Submit(interceptors ...InterceptorWithRecordFunc) error

Submit validates and submits the form. On success, sends a password reset email to the `form.Email` auth record.

You can optionally provide a list of InterceptorWithRecordFunc to further modify the form behavior before persisting it.

func (*RecordPasswordResetRequest) Validate

func (form *RecordPasswordResetRequest) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

This method doesn't checks whether auth record with `form.Email` exists (this is done on Submit).

type RecordUpsert

type RecordUpsert struct {

	// base model fields
	Id string `json:"id"`

	// auth collection fields
	// ---
	Username        string `json:"username"`
	Email           string `json:"email"`
	EmailVisibility bool   `json:"emailVisibility"`
	Verified        bool   `json:"verified"`
	Password        string `json:"password"`
	PasswordConfirm string `json:"passwordConfirm"`
	OldPassword     string `json:"oldPassword"`
	// contains filtered or unexported fields
}

RecordUpsert is a models.Record upsert (create/update) form.

func NewRecordUpsert

func NewRecordUpsert(app core.App, record *models.Record) *RecordUpsert

NewRecordUpsert creates a new RecordUpsert form with initializer config created from the provided core.App and models.Record instances (for create you could pass a pointer to an empty Record - models.NewRecord(collection)).

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*RecordUpsert) AddFiles

func (form *RecordUpsert) AddFiles(key string, files ...*filesystem.File) error

AddFiles adds the provided file(s) to the specified file field.

If the file field is a SINGLE-value file field (aka. "Max Select = 1"), then the newly added file will REPLACE the existing one. In this case if you pass more than 1 files only the first one will be assigned.

If the file field is a MULTI-value file field (aka. "Max Select > 1"), then the newly added file(s) will be APPENDED to the existing one(s).

Example

f1, _ := filesystem.NewFileFromPath("/path/to/file1.txt")
f2, _ := filesystem.NewFileFromPath("/path/to/file2.txt")
form.AddFiles("documents", f1, f2)

func (*RecordUpsert) Data

func (form *RecordUpsert) Data() map[string]any

Data returns the loaded form's data.

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(requestData map[string]any) error

LoadData loads and normalizes the provided regular record data fields into the form.

To DELETE previously uploaded file(s) you can suffix the field name with the file index or filename (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 = null`).

func (*RecordUpsert) LoadRequest

func (form *RecordUpsert) LoadRequest(r *http.Request, keyPrefix string) error

LoadRequest extracts the json or multipart/form-data request data and lods it into the form.

File upload is supported only via multipart/form-data.

To DELETE previously uploaded file(s) you can suffix the field name with the file index or filename (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 = null`).

func (*RecordUpsert) RemoveFiles

func (form *RecordUpsert) RemoveFiles(key string, toDelete ...string) error

RemoveFiles removes a single or multiple file from the specified file field.

NB! If filesToDelete is not set it will remove all existing files assigned to the file field (including those assigned with AddFiles)!

Example

 // mark only only 2 files for removal
	form.AddFiles("documents", "file1_aw4bdrvws6.txt", "file2_xwbs36bafv.txt")

	// mark all "documents" files for removal
	form.AddFiles("documents")

func (*RecordUpsert) SetDao

func (form *RecordUpsert) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

func (*RecordUpsert) SetFullManageAccess

func (form *RecordUpsert) SetFullManageAccess(fullManageAccess bool)

SetFullManageAccess sets the manageAccess bool flag of the current form to enable/disable directly changing some system record fields (often used with auth collection records).

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.

func (*RecordUpsert) ValidateAndFill

func (form *RecordUpsert) ValidateAndFill() error

type RecordVerificationConfirm

type RecordVerificationConfirm struct {
	Token string `form:"token" json:"token"`
	// contains filtered or unexported fields
}

RecordVerificationConfirm is an auth record email verification confirmation form.

func NewRecordVerificationConfirm

func NewRecordVerificationConfirm(app core.App, collection *models.Collection) *RecordVerificationConfirm

NewRecordVerificationConfirm creates a new RecordVerificationConfirm form initialized with from the provided core.App instance.

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*RecordVerificationConfirm) SetDao

func (form *RecordVerificationConfirm) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

func (*RecordVerificationConfirm) Submit

func (form *RecordVerificationConfirm) Submit(interceptors ...InterceptorWithRecordFunc) (*models.Record, error)

Submit validates and submits the form. On success returns the verified auth record associated to `form.Token`.

You can optionally provide a list of InterceptorWithRecordFunc to further modify the form behavior before persisting it.

func (*RecordVerificationConfirm) Validate

func (form *RecordVerificationConfirm) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type RecordVerificationRequest

type RecordVerificationRequest struct {
	Email string `form:"email" json:"email"`
	// contains filtered or unexported fields
}

RecordVerificationRequest is an auth record email verification request form.

func NewRecordVerificationRequest

func NewRecordVerificationRequest(app core.App, collection *models.Collection) *RecordVerificationRequest

NewRecordVerificationRequest creates a new RecordVerificationRequest form initialized with from the provided core.App instance.

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*RecordVerificationRequest) SetDao

func (form *RecordVerificationRequest) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

func (*RecordVerificationRequest) Submit

func (form *RecordVerificationRequest) Submit(interceptors ...InterceptorWithRecordFunc) error

Submit validates and sends a verification request email to the `form.Email` auth record.

You can optionally provide a list of InterceptorWithRecordFunc to further modify the form behavior before persisting it.

func (*RecordVerificationRequest) Validate

func (form *RecordVerificationRequest) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

// This method doesn't verify that auth record with `form.Email` exists (this is done on Submit).

type SettingsUpsert

type SettingsUpsert struct {
	*settings.Settings
	// contains filtered or unexported fields
}

SettingsUpsert is a settings.Settings upsert (create/update) form.

func NewSettingsUpsert

func NewSettingsUpsert(app core.App) *SettingsUpsert

NewSettingsUpsert creates a new SettingsUpsert form with initializer config created from the provided core.App instance.

If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].

func (*SettingsUpsert) SetDao

func (form *SettingsUpsert) SetDao(dao *daos.Dao)

SetDao replaces the default form Dao instance with the provided one.

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 TestEmailSend

type TestEmailSend struct {
	Template string `form:"template" json:"template"`
	Email    string `form:"email" json:"email"`
	// contains filtered or unexported fields
}

TestEmailSend is a email template test request form.

func NewTestEmailSend

func NewTestEmailSend(app core.App) *TestEmailSend

NewTestEmailSend creates and initializes new TestEmailSend form.

func (*TestEmailSend) Submit

func (form *TestEmailSend) Submit() error

Submit validates and sends a test email to the form.Email address.

func (*TestEmailSend) Validate

func (form *TestEmailSend) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

Directories

Path Synopsis
Package validators implements custom shared PocketBase validators.
Package validators implements custom shared PocketBase validators.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL