Documentation ¶
Index ¶
- Constants
- func Parse(filename string, output Configurable) error
- func ParseWithValidator(filename string, val *validator.Validate, output Configurable) error
- type Alias
- type ApiKey
- type Config
- type Configurable
- type Contract
- type Credentials
- type DataSource
- type Database
- type Hasura
- type HasuraSource
- type Prometheus
- type UserCredentials
Constants ¶
View Source
const ( DBKindSqlite = "sqlite" DBKindPostgres = "postgres" DBKindMysql = "mysql" DBKindClickhouse = "clickhouse" DBKindElasticSearch = "elasticsearch" )
Supported database kinds
Variables ¶
This section is empty.
Functions ¶
func ParseWithValidator ¶ added in v0.4.6
func ParseWithValidator(filename string, val *validator.Validate, output Configurable) error
ParseWithValidator - parse config with custom validator. If validator is nil validation will be skipped.
Types ¶
type Alias ¶ added in v0.2.24
type Alias[Type any] struct { // contains filtered or unexported fields }
Alias - type for aliasing in config
func (*Alias[Type]) SetStruct ¶ added in v0.2.24
func (a *Alias[Type]) SetStruct(entity Type)
SetStruct - set entity. Use in Substitute
func (*Alias[Type]) Struct ¶ added in v0.2.24
func (a *Alias[Type]) Struct() Type
Struct - returns substitute struct
func (*Alias[Type]) UnmarshalYAML ¶ added in v0.2.24
UnmarshalYAML -
type Config ¶
type Config struct { Version string `yaml:"version" validate:"required"` Database Database `yaml:"database" validate:"required"` DataSources map[string]DataSource `yaml:"datasources,omitempty"` Contracts map[string]Contract `yaml:"contracts,omitempty"` Hasura *Hasura `yaml:"hasura,omitempty" validate:"omitempty"` Prometheus *Prometheus `yaml:"prometheus,omitempty" validate:"omitempty"` }
Config
type Contract ¶
type Contract struct { Address string `yaml:"address" validate:"required,len=36"` TypeName string `yaml:"typename"` }
Contracts -
type Credentials ¶ added in v0.2.8
type Credentials struct { User *UserCredentials `yaml:"user,omitempty" validate:"omitempty"` ApiKey *ApiKey `yaml:"api_key,omitempty" validate:"omitempty"` }
Credentials -
type DataSource ¶
type DataSource struct { Kind string `yaml:"kind"` URL string `yaml:"url" validate:"required,url"` Credentials *Credentials `yaml:"credentials,omitempty" validate:"omitempty"` Timeout uint `yaml:"timeout" validate:"omitempty"` RequestsPerSecond int `yaml:"rps" validate:"omitempty,min=1"` }
DataSource -
type Database ¶
type Database struct { Path string `yaml:"path,omitempty"` Kind string `yaml:"kind" validate:"required,oneof=sqlite postgres mysql clickhouse elasticsearch"` Host string `yaml:"host" validate:"required_with=Port User Database"` Port int `yaml:"port" validate:"required_with=Host User Database,gt=-1,lt=65535"` User string `yaml:"user" validate:"required_with=Host Port Database"` Password string `yaml:"password"` Database string `yaml:"database" validate:"required_with=Host Port User"` SchemaName string `yaml:"schema_name"` ApplicationName string `yaml:"application_name"` MaxOpenConnections int `yaml:"max_open_connections"` MaxIdleConnections int `yaml:"max_idle_connections"` MaxLifetimeConnections int `yaml:"max_lifetime_connections"` }
Database
type Hasura ¶
type Hasura struct { URL string `yaml:"url" validate:"required,url"` Secret string `yaml:"admin_secret" validate:"required"` RowsLimit uint64 `yaml:"select_limit" validate:"gt=0"` EnableAggregations bool `yaml:"allow_aggregation"` Source *HasuraSource `yaml:"source"` Rest *bool `yaml:"rest"` }
Hasura -
func (*Hasura) UnmarshalYAML ¶ added in v0.2.24
UnmarshalYAML -
type HasuraSource ¶ added in v0.2.30
type Prometheus ¶ added in v0.1.36
type Prometheus struct {
URL string `yaml:"url" validate:"required"`
}
Prometheus -
type UserCredentials ¶ added in v0.2.8
type UserCredentials struct { Name string `yaml:"name" validate:"required"` Password string `yaml:"password" validate:"required"` }
UserCredentials -
Click to show internal directories.
Click to hide internal directories.