go_blueberry

package module
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: GPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const SplitScroll string = `` /* 1245-byte string literal not displayed */

Variables

This section is empty.

Functions

func CreatePagesTable added in v0.0.24

func CreatePagesTable(db *sql.DB)

func GetPageData added in v0.0.24

func GetPageData[T any](name string, db *sql.DB) (T, error)

func HandleContactFormRequest added in v0.0.16

func HandleContactFormRequest[FormType Validatable](mail Mail, templateCollection *template.Template, subjectTemplate string, emailTemplate string, thankYouTemplate string) http.HandlerFunc

func HtmlTemplateHandler added in v0.0.14

func HtmlTemplateHandler[T any](pageTemplates *template.Template, templatePath string, dataGetter func() T) http.HandlerFunc

func InitTemplates

func InitTemplates(templateFS embed.FS, templateBasePath string) *template.Template

func InsertPageData added in v0.0.24

func InsertPageData[T any](name string, page T, db *sql.DB) (int64, error)

func MakePageDataGetter added in v0.0.24

func MakePageDataGetter[T any](name string, db *sql.DB) func() T

func UpdatePageData added in v0.0.24

func UpdatePageData[T any](name string, page T, db *sql.DB) error

Types

type Mail added in v0.0.12

type Mail struct {
	Sender       string
	SenderDomain string
	ApiKey       string
	Recipient    string
}

func (Mail) SendMail added in v0.0.12

func (m Mail) SendMail(subject, body string)

type Product added in v0.0.18

type Product struct {
	Name    string
	Options string
	Price   int
}

type Square added in v0.0.18

type Square struct {
	APIKey       string
	LocationId   string
	CheckoutUrl  string
	AppBaseUrl   string
	RedirectPath string
	Tax          SquareTax
}
func (s Square) AnonCheckoutLink(products []Product) (string, string)

type SquareBasePrice added in v0.0.18

type SquareBasePrice struct {
	Amount   int    `json:"amount"`
	Currency string `json:"currency"`
}

type SquareCheckoutOptions added in v0.0.18

type SquareCheckoutOptions struct {
	RedirectUrl string `json:"redirect_url"`
}

type SquareCheckoutRequest added in v0.0.18

type SquareCheckoutRequest struct {
	IdempotencyKey  string                `json:"idempotency_key"`
	Order           SquareOrder           `json:"order"`
	CheckoutOptions SquareCheckoutOptions `json:"checkout_options"`
}

type SquareLineItem added in v0.0.18

type SquareLineItem struct {
	Quantity       string          `json:"quantity"`
	BasePriceMoney SquareBasePrice `json:"base_price_money"`
	Name           string          `json:"name"`
}

type SquareOrder added in v0.0.18

type SquareOrder struct {
	LocationId string           `json:"location_id"`
	LineItems  []SquareLineItem `json:"line_items"`
	Tax        []SquareTax      `json:"taxes"`
}

type SquareResponse added in v0.0.18

type SquareResponse struct {
	PaymentLink struct {
		ID              string `json:"id"`
		Version         int    `json:"version"`
		OrderID         string `json:"order_id"`
		CheckoutOptions struct {
			RedirectURL string `json:"redirect_url"`
		} `json:"checkout_options"`
		URL       string    `json:"url"`
		LongURL   string    `json:"long_url"`
		CreatedAt time.Time `json:"created_at"`
	} `json:"payment_link"`
	RelatedResources struct {
		Orders []struct {
			ID         string `json:"id"`
			LocationID string `json:"location_id"`
			Source     struct {
				Name string `json:"name"`
			} `json:"source"`
			LineItems []struct {
				UID            string `json:"uid"`
				Name           string `json:"name"`
				Quantity       string `json:"quantity"`
				ItemType       string `json:"item_type"`
				BasePriceMoney struct {
					Amount   int    `json:"amount"`
					Currency string `json:"currency"`
				} `json:"base_price_money"`
				VariationTotalPriceMoney struct {
					Amount   int    `json:"amount"`
					Currency string `json:"currency"`
				} `json:"variation_total_price_money"`
				GrossSalesMoney struct {
					Amount   int    `json:"amount"`
					Currency string `json:"currency"`
				} `json:"gross_sales_money"`
				TotalTaxMoney struct {
					Amount   int    `json:"amount"`
					Currency string `json:"currency"`
				} `json:"total_tax_money"`
				TotalDiscountMoney struct {
					Amount   int    `json:"amount"`
					Currency string `json:"currency"`
				} `json:"total_discount_money"`
				TotalMoney struct {
					Amount   int    `json:"amount"`
					Currency string `json:"currency"`
				} `json:"total_money"`
				TotalServiceChargeMoney struct {
					Amount   int    `json:"amount"`
					Currency string `json:"currency"`
				} `json:"total_service_charge_money"`
			} `json:"line_items"`
			Fulfillments []struct {
				UID   string `json:"uid"`
				Type  string `json:"type"`
				State string `json:"state"`
			} `json:"fulfillments"`
			NetAmounts struct {
				TotalMoney struct {
					Amount   int    `json:"amount"`
					Currency string `json:"currency"`
				} `json:"total_money"`
				TaxMoney struct {
					Amount   int    `json:"amount"`
					Currency string `json:"currency"`
				} `json:"tax_money"`
				DiscountMoney struct {
					Amount   int    `json:"amount"`
					Currency string `json:"currency"`
				} `json:"discount_money"`
				TipMoney struct {
					Amount   int    `json:"amount"`
					Currency string `json:"currency"`
				} `json:"tip_money"`
				ServiceChargeMoney struct {
					Amount   int    `json:"amount"`
					Currency string `json:"currency"`
				} `json:"service_charge_money"`
			} `json:"net_amounts"`
			CreatedAt  time.Time `json:"created_at"`
			UpdatedAt  time.Time `json:"updated_at"`
			State      string    `json:"state"`
			Version    int       `json:"version"`
			TotalMoney struct {
				Amount   int    `json:"amount"`
				Currency string `json:"currency"`
			} `json:"total_money"`
			TotalTaxMoney struct {
				Amount   int    `json:"amount"`
				Currency string `json:"currency"`
			} `json:"total_tax_money"`
			TotalDiscountMoney struct {
				Amount   int    `json:"amount"`
				Currency string `json:"currency"`
			} `json:"total_discount_money"`
			TotalTipMoney struct {
				Amount   int    `json:"amount"`
				Currency string `json:"currency"`
			} `json:"total_tip_money"`
			TotalServiceChargeMoney struct {
				Amount   int    `json:"amount"`
				Currency string `json:"currency"`
			} `json:"total_service_charge_money"`
			NetAmountDueMoney struct {
				Amount   int    `json:"amount"`
				Currency string `json:"currency"`
			} `json:"net_amount_due_money"`
		} `json:"orders"`
	} `json:"related_resources"`
}

type SquareTax added in v0.0.22

type SquareTax struct {
	Name       string `json:"name"`
	Percentage string `json:"percentage"`
}

type Validatable added in v0.0.29

type Validatable interface {
	Validate() bool
}

Jump to

Keyboard shortcuts

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