Documentation ¶
Index ¶
- Constants
- Variables
- func AddToMap(dst, src map[string]any)
- func PrepareFunctionMap() map[string]any
- func RenderKnown[T Context](cfg config.Config, engine TemplateEngine, known Known[T], args T) (string, error)
- func RenderKnownTo[T Context](cfg config.Config, engine TemplateEngine, known Known[T], args T, ...) error
- type AccountCreationNoticeCtx
- type BaseContext
- type Context
- type Engine
- type InviteMailCtx
- type Kind
- type Known
- type RenderContext
- type RequestPasswordResetCtx
- type SendPhoneSecurityCodeCtx
- type TemplateEngine
- type VerifyMailCtx
- type VerifyPhoneNumberCtx
Constants ¶
View Source
const ( KindSMS = Kind("sms") KindMail = Kind("mail") )
Variables ¶
View Source
var ( VerifyPhoneNumber = Known[*VerifyPhoneNumberCtx]{ Name: "verify_phone_number", Kind: KindSMS, } SendPhoneSecurityCode = Known[*SendPhoneSecurityCodeCtx]{ Name: "send_phone_security_code", Kind: KindSMS, } RequestPasswordReset = Known[*RequestPasswordResetCtx]{ Name: "request_password_reset", Kind: KindMail, } AccountCreationNotice = Known[*AccountCreationNoticeCtx]{ Name: "account_creation_notice", Kind: KindMail, } VerifyMail = Known[*VerifyMailCtx]{ Name: "verify_mail", Kind: KindMail, } InviteMail = Known[*InviteMailCtx]{ Name: "user_invitation", Kind: KindMail, } )
Functions ¶
func PrepareFunctionMap ¶
func RenderKnown ¶
func RenderKnownTo ¶
Types ¶
type AccountCreationNoticeCtx ¶
type AccountCreationNoticeCtx struct { BaseContext Creator models.User User models.User ResetLink string }
Context types
type BaseContext ¶
func (*BaseContext) SetPublicURL ¶
func (bc *BaseContext) SetPublicURL(url string)
func (*BaseContext) SetSiteName ¶
func (bc *BaseContext) SetSiteName(name string)
func (*BaseContext) SetSiteURL ¶
func (bc *BaseContext) SetSiteURL(url string)
type Engine ¶
type Engine struct { SMS TemplateEngine Mail TemplateEngine }
type InviteMailCtx ¶
type InviteMailCtx struct { BaseContext RegisterURL string Name string Inviter models.User }
Context types
type Known ¶
Known is a known template that provides strong typing for the template variables and is bound by name.
type RenderContext ¶
type RenderContext struct {
// contains filtered or unexported fields
}
func NewRenderContext ¶
func NewRenderContext() *RenderContext
func (*RenderContext) Get ¶
func (rc *RenderContext) Get(key string) any
func (*RenderContext) Set ¶
func (rc *RenderContext) Set(key string, value any)
type RequestPasswordResetCtx ¶
type RequestPasswordResetCtx struct { BaseContext User models.User ResetLink string }
Context types
type SendPhoneSecurityCodeCtx ¶
type SendPhoneSecurityCodeCtx struct { BaseContext Code string }
Context types
type TemplateEngine ¶
func NewHTMLEngine ¶
func NewHTMLEngine(fs fs.FS, kind Kind) (TemplateEngine, error)
func NewTextEngine ¶
func NewTextEngine(fs fs.FS, kind Kind) (TemplateEngine, error)
type VerifyMailCtx ¶
type VerifyMailCtx struct { BaseContext User models.User VerifyLink string }
Context types
type VerifyPhoneNumberCtx ¶
type VerifyPhoneNumberCtx struct { BaseContext Code string }
Context types
Click to show internal directories.
Click to hide internal directories.