forms
import forms "ganigeorgiev.com/pocketbase/pocketbase/forms"
Source: forms.
Constants
const (
TestTemplateVerification = "verification"
TestTemplatePasswordReset = "password-reset"
TestTemplateEmailChange = "email-change"
TestTemplateOTP = "otp"
TestTemplateAuthAlert = "login-alert"
)
Types
AppleClientSecretCreate
type AppleClientSecretCreate struct {
// ClientId is the identifier of your app (aka. Service ID).
ClientId string `form:"clientId" json:"clientId"`
// TeamId is a 10-character string associated with your developer account
// (usually could be found next to your name in the Apple Developer site).
TeamId string `form:"teamId" json:"teamId"`
// KeyId is a 10-character key identifier generated for the "Sign in with Apple"
// private key associated with your developer account.
KeyId string `form:"keyId" json:"keyId"`
// PrivateKey is the private key associated to your app.
// Usually wrapped within -----BEGIN PRIVATE KEY----- X -----END PRIVATE KEY-----.
PrivateKey string `form:"privateKey" json:"privateKey"`
// Duration specifies how long the generated JWT should be considered valid.
// The specified value must be in seconds and max 15777000 (~6months).
Duration int `form:"duration" json:"duration"`
// contains filtered or unexported fields
}
AppleClientSecretCreate is a form struct to generate a new Apple Client Secret.
Reference: https://developer.apple.com/documentation/sign_in_with_apple/generate_and_validate_tokens
NewAppleClientSecretCreate
func NewAppleClientSecretCreate(app core.App) *AppleClientSecretCreate
NewAppleClientSecretCreate creates a new AppleClientSecretCreate form with initializer config created from the provided core.App instances.
AppleClientSecretCreate.Submit
func (form *AppleClientSecretCreate) Submit() (string, error)
Submit validates the form and returns a new Apple Client Secret JWT.
AppleClientSecretCreate.Validate
func (form *AppleClientSecretCreate) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
RecordUpsert
type RecordUpsert struct {
// contains filtered or unexported fields
}
NewRecordUpsert
func NewRecordUpsert(app core.App, record *core.Record) *RecordUpsert
NewRecordUpsert creates a new RecordUpsert form from the provided core.App and core.Record instances (for create you could pass a pointer to an empty Record - core.NewRecord(collection)).
RecordUpsert.DrySubmit
func (form *RecordUpsert) DrySubmit(callback func(txApp core.App, drySavedRecord *core.Record) error) error
Deprecated: It was previously used as part of the record create action but it is not needed anymore and will be removed in the future.
DrySubmit performs a temp form submit within a transaction and reverts it at the end. For actual record persistence, check the [RecordUpsert.Submit()] method.
This method doesn't perform validations, handle file uploads/deletes or trigger app save events!
RecordUpsert.GrantManagerAccess
func (form *RecordUpsert) GrantManagerAccess()
GrantManagerAccess updates the form access level to "manager" allowing directly changing some system record fields (often used with auth collection records).
RecordUpsert.GrantSuperuserAccess
func (form *RecordUpsert) GrantSuperuserAccess()
GrantSuperuserAccess updates the form access level to "superuser" allowing directly changing all system record fields, including those marked as "Hidden".
RecordUpsert.HasManageAccess
func (form *RecordUpsert) HasManageAccess() bool
HasManageAccess reports whether the form has "manager" or "superuser" level access.
RecordUpsert.Load
func (form *RecordUpsert) Load(data map[string]any)
Load loads the provided data into the form and the related record.
RecordUpsert.ResetAccess
func (form *RecordUpsert) ResetAccess()
ResetAccess resets the form access level to the accessLevelDefault.
RecordUpsert.SetApp
func (form *RecordUpsert) SetApp(app core.App)
SetApp replaces the current form app instance.
This could be used for example if you want to change at later stage before submission to change from regular -> transactional app instance.
RecordUpsert.SetRecord
func (form *RecordUpsert) SetRecord(record *core.Record)
SetRecord replaces the current form record instance.
RecordUpsert.Submit
func (form *RecordUpsert) Submit() error
Submit validates the form specific validations and attempts to save the form record.
TestEmailSend
type TestEmailSend struct {
Email string `form:"email" json:"email"`
Template string `form:"template" json:"template"`
Collection string `form:"collection" json:"collection"` // optional, fallbacks to _superusers
// contains filtered or unexported fields
}
TestEmailSend is a email template test request form.
NewTestEmailSend
func NewTestEmailSend(app core.App) *TestEmailSend
NewTestEmailSend creates and initializes new TestEmailSend form.
TestEmailSend.Submit
func (form *TestEmailSend) Submit() error
Submit validates and sends a test email to the form.Email address.
TestEmailSend.Validate
func (form *TestEmailSend) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
TestS3Filesystem
type TestS3Filesystem struct {
// The name of the filesystem - storage or backups
Filesystem string `form:"filesystem" json:"filesystem"`
// contains filtered or unexported fields
}
TestS3Filesystem defines a S3 filesystem connection test.
NewTestS3Filesystem
func NewTestS3Filesystem(app core.App) *TestS3Filesystem
NewTestS3Filesystem creates and initializes new TestS3Filesystem form.
TestS3Filesystem.Submit
func (form *TestS3Filesystem) Submit() error
Submit validates and performs a S3 filesystem connection test.
TestS3Filesystem.Validate
func (form *TestS3Filesystem) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.