template

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Id        *string
	Name      *string
	LoginName *string
	Subject   *string
	Email     *string
}

Account contains account information. Not all fields will always be populated; it depends on the type of account.

type Data

type Data struct {
	User    User
	Account Account
}

Data is the top-level struct containing the various domains of templated data. The Generate function can take in any data but this provides a shared structure for general use.

type Parsed

type Parsed struct {
	// contains filtered or unexported fields
}

Parsed contains information about a template parsed via New. Technically `raw` and `funcMap` are not required to be cached here as they are part of the `template.Template` object but it is useful for tests.

func New

func New(ctx context.Context, raw string) (*Parsed, error)

New creates a Parsed struct. It requires the raw string.

func (*Parsed) Generate

func (p *Parsed) Generate(ctx context.Context, data interface{}) (string, error)

Generate based on the provided template

type User

type User struct {
	Id       *string
	Name     *string
	FullName *string
	Email    *string
}

User contains user information. FullName and Email are not always populated or may be different than the values in the Account struct; these are set on the user by an account from the primary auth method in a scope. It is possible for a user to not have an account from that auth method (in which case it will not be populated), or for the token they have used for the request to be from a different auth method, in which case it may not match what's in the Account struct.

Jump to

Keyboard shortcuts

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