config

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfigFileName = ".klepto.toml"
)

Config-related defaults

Variables

This section is empty.

Functions

func WriteSample added in v0.2.0

func WriteSample(w io.Writer) error

WriteSample generates and writes sample config to a writer

Types

type Filter

type Filter struct {
	// Match is a condition field to dump only certain amount data.
	Match string
	// Limit defines a limit of results to be fetched.
	Limit uint64
	// Sorts is the sort condition for the table.
	Sorts map[string]string
}

Filter represents the way you want to filter the results.

type Matchers added in v0.0.8

type Matchers map[string]string

Matchers are variables to store filter data, you can declare a filter once and reuse it among tables.

type Relationship

type Relationship struct {
	// Table is the table name.
	Table string
	// ForeignKey is the table name foreign key.
	ForeignKey string
	// ReferencedTable is the referenced table name.
	ReferencedTable string
	// ReferencedKey is the referenced table primary key name.
	ReferencedKey string
}

Relationship represents the relationship between the table and referenced table.

type Table

type Table struct {
	// Name is the table name.
	Name string
	// IgnoreData if set to true, it will dump the table structure without importing data.
	IgnoreData bool
	// Filter represents the way you want to filter the results.
	Filter Filter
	// Anonymise anonymises columns.
	Anonymise map[string]string
	// Relationship is an collection of relationship definitions.
	Relationships []*Relationship
}

Table represents a klepto table definition.

type Tables

type Tables []*Table

Tables are an array of table definitions.

func LoadFromFile added in v0.2.0

func LoadFromFile(configPath string) (Tables, error)

LoadFromFile loads klepto tables config from file

func (Tables) FindByName

func (t Tables) FindByName(name string) *Table

FindByName find a table by its name.

Jump to

Keyboard shortcuts

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