config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package config provides configuration for the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	Config  string
	Output  string
	Package string
	DSN     string
	Verbose bool
}

type Config

type Config struct {
	Version      string          `koanf:"-"`
	Filename     string          `koanf:"-"`
	Log          *Log            `koanf:"log"`
	Uncountables []string        `koanf:"uncountables"`
	Initialisms  []string        `koanf:"initialisms"`
	Timezone     string          `koanf:"timezone"`
	Template     *Template       `koanf:"template"`
	Imports      []*Import       `koanf:"imports"`
	Output       *Output         `koanf:"output"`
	Custom       []*CustomStruct `koanf:"custom"`
	DB           []*DB           `koanf:"db"`
}

func Parse

func Parse(args Args) (*Config, error)

func (*Config) Validate

func (c *Config) Validate() error

type CustomField

type CustomField struct {
	Name    string `koanf:"name"`
	Type    string `koanf:"type"`
	Tags    []*Tag `koanf:"tags"`
	Comment string `koanf:"comment"`
}

func (*CustomField) Validate

func (c *CustomField) Validate() error

type CustomStruct

type CustomStruct struct {
	Name    string         `koanf:"name"`
	Comment string         `koanf:"comment"`
	Fields  []*CustomField `koanf:"fields"`
	Tags    []*Tag         `koanf:"tags"`
}

func (*CustomStruct) Validate

func (c *CustomStruct) Validate() error

type CustomTable

type CustomTable struct {
	Name    string                  `koanf:"table"`
	Alias   string                  `koanf:"alias"`
	Comment string                  `koanf:"comment"`
	Fields  map[string]*CustomField `koanf:"fields"`
	Tags    []*Tag                  `koanf:"tags"`
}

func (*CustomTable) Validate

func (c *CustomTable) Validate() error

type DB

type DB struct {
	Driver  string                  `koanf:"driver"`
	DSN     string                  `koanf:"dsn"`
	Schema  string                  `koanf:"schema"`
	Include []string                `koanf:"include"`
	Exclude []string                `koanf:"exclude"`
	Custom  map[string]*CustomTable `koanf:"custom"`
}

func (*DB) Validate

func (d *DB) Validate() error

type Import

type Import struct {
	Package string   `koanf:"package"`
	Alias   string   `koanf:"alias"`
	Types   []string `koanf:"types"`
}

func (*Import) Validate

func (i *Import) Validate() error

type Log

type Log struct {
	Level string `koanf:"level"`
	File  string `koanf:"file"`
}

type Output

type Output struct {
	Dir     string `koanf:"dir"`
	Package string `koanf:"package"`
	Module  string `koanf:"module"`
}

func (*Output) Validate

func (o *Output) Validate() error

type Tag

type Tag struct {
	Key     string   `mapstructure:"key"`
	Name    string   `mapstructure:"name"`
	Options []string `mapstructure:"options"`
}

type Template

type Template struct {
	Dir string `koanf:"dir"`
}

func (*Template) Validate

func (t *Template) Validate() error

type Validator

type Validator interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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