Documentation
¶
Index ¶
- Constants
- Variables
- type AWSConfig
- type Config
- type DbConfig
- type Resolver
- func (r *Resolver) DbConfigForDbSpec(str string) *DbConfig
- func (r *Resolver) GetChunkStore(ctx context.Context, str string) (chunks.ChunkStore, error)
- func (r *Resolver) GetDatabase(ctx context.Context, str string) (datas.Database, types.ValueReadWriter, error)
- func (r *Resolver) GetDatabaseSpecForPath(ctx context.Context, str string) (spec.Spec, error)
- func (r *Resolver) GetDataset(ctx context.Context, str string) (datas.Database, types.ValueReadWriter, datas.Dataset, error)
- func (r *Resolver) GetPath(ctx context.Context, str string) (datas.Database, types.ValueReadWriter, types.Value, error)
- func (r *Resolver) ResolveDbSpec(str string) string
- func (r *Resolver) ResolvePathSpec(str string) string
- func (r *Resolver) ResolvePathSpecAndGetDbConfig(str string) (string, *DbConfig)
Constants ¶
const ( NomsConfigFile = ".nomsconfig" DefaultDbAlias = "default" )
Variables ¶
var ErrNoConfig = fmt.Errorf("no %s found", NomsConfigFile)
Functions ¶
This section is empty.
Types ¶
type AWSConfig ¶
type AWSConfig struct { Region string CredSource string `toml:"cred_source"` CredFile string `toml:"cred_file"` }
Global AWS Config
type Config ¶
All configuration
func FindNomsConfig ¶
Find the closest directory containing .nomsconfig starting in cwd and then searching up ancestor tree. Look first looking in cwd and then up through its ancestors
func ReadConfig ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func NewResolver() *Resolver
A Resolver enables using db defaults, db aliases and dataset '.' replacement in command line arguments when a .nomsconfig file is present. To use it, create a config resolver before command line processing and use it to resolve each dataspec argument in succession.
func (*Resolver) DbConfigForDbSpec ¶
Resolve string to database name. And get the DbConfig if one exists. If config is defined:
- replace the empty string with the default db url
- replace any db alias with it's url
func (*Resolver) GetChunkStore ¶
Resolve string to a chunkstore. Like ResolveDatabase, but returns the underlying ChunkStore
func (*Resolver) GetDatabase ¶
func (r *Resolver) GetDatabase(ctx context.Context, str string) (datas.Database, types.ValueReadWriter, error)
Resolve string to database spec. If a config is present,
- resolve a db alias to its db spec
- resolve "" to the default db spec
func (*Resolver) GetDatabaseSpecForPath ¶
GetDatabaseForPath returns the database and a VRW for the path given, but does not attempt to load a value
func (*Resolver) GetDataset ¶
func (r *Resolver) GetDataset(ctx context.Context, str string) (datas.Database, types.ValueReadWriter, datas.Dataset, error)
Resolve string to a dataset. If a config is present,
- if no db prefix is present, assume the default db
- if the db prefix is an alias, replace it
func (*Resolver) GetPath ¶
func (r *Resolver) GetPath(ctx context.Context, str string) (datas.Database, types.ValueReadWriter, types.Value, error)
Resolve string to a value path. If a config is present,
- if no db spec is present, assume the default db
- if the db spec is an alias, replace it
func (*Resolver) ResolveDbSpec ¶
See config.DbConfigForDbSpec which will retrieve the entire DbConfig object associated with the db (if one exists). This method retrieves the Url from that DbConfig.
func (*Resolver) ResolvePathSpec ¶
See ResolvePathSpecAndGetDbConfig which does both path spec resolutioon and config retrieval
func (*Resolver) ResolvePathSpecAndGetDbConfig ¶
Resolve string to dataset or path name and get the appropriate DbConfig if one exists.
- replace database name as described in ResolveDatabase
- if this is the first call to ResolvePath, remember the datapath part for subsequent calls.
- if this is not the first call and a "." is used, replace it with the first datapath.