config

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MPL-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

View Source
const ApplicationName = "octosql"

Variables

View Source
var OctosqlCacheDir = func() string {
	cacheDirPath, err := xdg.SearchCacheFile(ApplicationName)
	if err != nil {
		return octosqlHomeDir()
	}
	return cacheDirPath
}()
View Source
var OctosqlConfigDir = func() string {
	configDirPath, err := xdg.SearchConfigFile(ApplicationName)
	if err != nil {
		return octosqlHomeDir()
	}
	return configDirPath
}()
View Source
var OctosqlDataDir = func() string {
	dataDirPath, err := xdg.SearchDataFile(ApplicationName)
	if err != nil {
		return octosqlHomeDir()
	}
	return dataDirPath
}()

Functions

func ContextWithConfig added in v0.11.1

func ContextWithConfig(ctx context.Context, config *Config) context.Context

Types

type Config

type Config struct {
	Databases []DatabaseConfig `yaml:"databases"`
	Files     FilesConfig      `yaml:"files"`
}

func FromContext added in v0.11.1

func FromContext(ctx context.Context) *Config

func Read added in v0.4.0

func Read() (*Config, error)

type DatabaseConfig added in v0.4.0

type DatabaseConfig struct {
	Name    string                               `yaml:"name"`
	Type    PluginReference                      `yaml:"type"`
	Version *YamlUnmarshallableVersionConstraint `yaml:"version"`
	Config  yaml.Node                            `yaml:"config"`
}

type FilesConfig added in v0.11.1

type FilesConfig struct {
	JSON            JSONConfig `yaml:"json"`
	BufferSizeBytes int        `yaml:"buffer_size_bytes"`
}

type JSONConfig added in v0.11.1

type JSONConfig struct {
	MaxLineSizeBytes int `yaml:"max_line_size_bytes"`
}

type PluginReference added in v0.4.0

type PluginReference struct {
	Name       string
	Repository string
}

func (*PluginReference) String added in v0.4.0

func (r *PluginReference) String() string

func (*PluginReference) UnmarshalText added in v0.4.0

func (r *PluginReference) UnmarshalText(text []byte) error

type YamlUnmarshallableVersionConstraint added in v0.4.0

type YamlUnmarshallableVersionConstraint semver.Constraints

func NewYamlUnmarshallableVersionConstraint added in v0.4.0

func NewYamlUnmarshallableVersionConstraint(v *semver.Constraints) *YamlUnmarshallableVersionConstraint

func (*YamlUnmarshallableVersionConstraint) Raw added in v0.4.0

func (*YamlUnmarshallableVersionConstraint) UnmarshalText added in v0.4.0

func (constraint *YamlUnmarshallableVersionConstraint) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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