util

package
v0.0.0-...-f33053b Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatYAxisValues

func FormatYAxisValues(num float64) string

func GetFormattedWeek

func GetFormattedWeek(date time.Time) string

func GetLastNWeeks

func GetLastNWeeks(date time.Time, n int) []string

func GetMonospaceFont

func GetMonospaceFont() *truetype.Font

func GetPrevNextWeek

func GetPrevNextWeek(date time.Time) (string, string)

func GetRegularFont

func GetRegularFont() *truetype.Font

func GetStartOfMonths

func GetStartOfMonths(weeks []string) []time.Time

func GetStartOfTheWeek

func GetStartOfTheWeek(date time.Time) time.Time

func ParseYearWeek

func ParseYearWeek(yw string) (time.Time, time.Time, error)

func URLValuesWith

func URLValuesWith(values url.Values, key string, value string) url.Values

func URLValuesWithout

func URLValuesWithout(values url.Values, keyWithout string) url.Values

Types

type Config

type Config struct {
	IsMultiTenant             bool
	ShouldUseSuperDatabase    bool
	SuperDatabaseUrl          *string
	TenantDatabaseUrlTemplate *string
	Tenants                   map[string]Tenant
}

func GetConfig

func GetConfig() (*Config, error)

func GetConfigFromEnv

func GetConfigFromEnv() (*Config, error)

func ValidateConfig

func ValidateConfig(config *TomlConfig) (*Config, error)

type Tenant

type Tenant struct {
	Name          string  `toml:"name"`
	SubdomainName string  `toml:"subdomain"`
	DatabaseName  string  `toml:"database_name"`
	DatabaseUrl   *string `toml:"database_url"`
}

type TomlConfig

type TomlConfig struct {
	TenantDatabaseUrlTemplate *string           `toml:"tenant_database_url_template"`
	SuperDatabaseUrl          *string           `toml:"super_database_url"`
	Tenants                   map[string]Tenant `toml:"tenants"`
}

func LoadConfigToml

func LoadConfigToml(path string) (*TomlConfig, error)

Jump to

Keyboard shortcuts

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