config

package
v0.5.11 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// GitRepo is used for initialization of SFGA archive.
	GitRepo

	// LocalSchemaPath is an optional path to a local schema.sql file.
	// If set, it will be used instead of fetching from GitRepo.
	LocalSchemaPath string

	// NomCode represents nomenclatural code relevant for the dataset.
	NomCode nomcode.Code

	// BadRow sets how to process rows with wrong number of fields in CSV
	// files.
	BadRow gnfmt.BadRow

	// WithQuotes sets CSV reader to use `"` as quote. When it is true,
	// RFC-based CSV reader is used, even if delimiter is tab or pipe.
	WithQuotes bool

	// WithParents flag can be set to true when a dataset with a flat
	// hierachy needs conversion to a parent/child hierachy.
	// All IDs generated during unflattening will have 'sf-' prefix.
	WithParents bool

	// BatchSize tells how many elements (rows, structs) to deal with in
	// a chunk of data.
	BatchSize int

	// JobsNum conveys the number of concurrent jobs to run, where it is
	// needed.
	JobsNum int
}

func New

func New(opts ...Option) Config

type GitRepo

type GitRepo struct {
	// URL to the SFGA schema repository.
	URL string

	// Tag is a version tag of the SFGA repository to use.
	Tag string

	// ShaSumSchema is sha256 hash for the content of schema.sql file.
	// If the has is trucated, only trucated part is checked. If it is
	// empty, no check is done.
	ShaSchemaSQL string
}

type Option

type Option func(*Config)

func OptBadRow

func OptBadRow(br gnfmt.BadRow) Option

func OptBatchSize

func OptBatchSize(i int) Option

func OptJobsNum

func OptJobsNum(i int) Option

func OptLocalSchemaPath

func OptLocalSchemaPath(path string) Option

func OptNomCode

func OptNomCode(code nomcode.Code) Option

func OptWithParents

func OptWithParents(b bool) Option

func OptWithQuotes

func OptWithQuotes(b bool) Option

Jump to

Keyboard shortcuts

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