models

package
v0.0.0-...-01ad037 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Version *versions.ConfigVersion `json:"version"`
	Columns *int                    `json:"columns" validate:"required,gt=0"`
	Zoom    *float32                `json:"zoom,omitempty" validate:"omitempty,gt=0,lte=10"`
	Tiles   []TileConfig            `json:"tiles" validate:"required,notempty"`
}

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON should error if there is something unexpected

type ConfigBag

type ConfigBag struct {
	Config *Config       `json:"config,omitempty"`
	Errors []ConfigError `json:"errors,omitempty"`
}

func (*ConfigBag) AddErrors

func (c *ConfigBag) AddErrors(errors ...ConfigError)

type ConfigError

type ConfigError struct {
	ID      ConfigErrorID   `json:"id"`
	Message string          `json:"message"`
	Data    ConfigErrorData `json:"data"`
}

type ConfigErrorData

type ConfigErrorData struct {
	ConfigExtract          string `json:"configExtract,omitempty"`
	ConfigExtractHighlight string `json:"configExtractHighlight,omitempty"`
	Value                  string `json:"value,omitempty"`
	FieldName              string `json:"fieldName,omitempty"`
	Expected               string `json:"expected,omitempty"`
}

type ConfigErrorID

type ConfigErrorID string
const (
	ConfigErrorConfigNotFound                    ConfigErrorID = "ERROR_CONFIG_NOT_FOUND"
	ConfigErrorDisabledVariant                   ConfigErrorID = "ERROR_DISABLED_VARIANT"
	ConfigErrorFieldTypeMismatch                 ConfigErrorID = "ERROR_FIELD_TYPE_MISMATCH"
	ConfigErrorInvalidEscapedCharacter           ConfigErrorID = "ERROR_INVALID_ESCAPED_CHARACTER"
	ConfigErrorInvalidFieldValue                 ConfigErrorID = "ERROR_INVALID_FIELD_VALUE"
	ConfigErrorMissingRequiredField              ConfigErrorID = "ERROR_MISSING_REQUIRED_FIELD"
	ConfigErrorUnsupportedTileInThisVersion      ConfigErrorID = "ERROR_UNSUPPORTED_TILE_IN_THIS_VERSION"
	ConfigErrorUnsupportedTileParamInThisVersion ConfigErrorID = "ERROR_UNSUPPORTED_TILE_PARAM_IN_THIS_VERSION"
	ConfigErrorUnauthorizedField                 ConfigErrorID = "ERROR_UNAUTHORIZED_FIELD"
	ConfigErrorUnauthorizedSubtileType           ConfigErrorID = "ERROR_UNAUTHORIZED_SUBTILE_TYPE"
	ConfigErrorUnableToHydrate                   ConfigErrorID = "ERROR_UNABLE_TO_HYDRATE"
	ConfigErrorUnableToParseConfig               ConfigErrorID = "ERROR_UNABLE_TO_PARSE_CONFIG"
	ConfigErrorUnexpectedError                   ConfigErrorID = "ERROR_UNEXPECTED"
	ConfigErrorUnknownField                      ConfigErrorID = "ERROR_UNKNOWN_FIELD"
	ConfigErrorUnknownGeneratorTileType          ConfigErrorID = "ERROR_UNKNOWN_GENERATOR_TILE_TYPE"
	ConfigErrorUnknownNamedConfig                ConfigErrorID = "ERROR_UNKNOWN_NAMED_CONFIG"
	ConfigErrorUnknownTileType                   ConfigErrorID = "ERROR_UNKNOWN_TILE_TYPE"
	ConfigErrorUnknownVariant                    ConfigErrorID = "ERROR_UNKNOWN_VARIANT"
	ConfigErrorUnsupportedVersion                ConfigErrorID = "ERROR_UNSUPPORTED_VERSION"
)

type ConfigFileNotFoundError

type ConfigFileNotFoundError struct {
	PathOrURL string
	Err       error
}

ConfigFileNotFoundError

func (*ConfigFileNotFoundError) Error

func (e *ConfigFileNotFoundError) Error() string

func (*ConfigFileNotFoundError) Unwrap

func (e *ConfigFileNotFoundError) Unwrap() error

type ConfigMetadata

type ConfigMetadata struct {
	Name string `json:"name"`
}

type ConfigParams

type ConfigParams struct {
	Config string `json:"config" query:"config" param:"config"`
}

type ConfigUnmarshalError

type ConfigUnmarshalError struct {
	Err       error
	RawConfig string
}

func (*ConfigUnmarshalError) Error

func (e *ConfigUnmarshalError) Error() string

func (*ConfigUnmarshalError) Unwrap

func (e *ConfigUnmarshalError) Unwrap() error

type GeneratedTile

type GeneratedTile struct {
	Label  string
	Params interface{}
}

type TempConfig

type TempConfig Config // Use Temp config to avoid infinite UnmarshalJSON loop

The goal here is to raise an error if a key is sent that is not supported. This should stop many problems, like misspelling a parameter.

type TileConfig

type TileConfig struct {
	Type coreModels.TileType `json:"type" validate:"required"`

	Label      string `json:"label,omitempty"`
	RowSpan    *int   `json:"rowSpan,omitempty" validate:"omitempty,gt=0"`
	ColumnSpan *int   `json:"columnSpan,omitempty" validate:"omitempty,gt=0"`

	Tiles           []TileConfig `json:"tiles,omitempty"`
	URL             string       `json:"url,omitempty"`
	InitialMaxDelay *int         `json:"initialMaxDelay,omitempty"`

	// Used to validate config and to create API URLs
	// Will be removed before being returned to the UI
	Params        map[string]interface{} `json:"params,omitempty"`
	ConfigVariant coreModels.VariantName `json:"configVariant,omitempty"`
}

type TileGeneratorFunction

type TileGeneratorFunction func(params interface{}) ([]GeneratedTile, error)

Jump to

Keyboard shortcuts

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