Documentation
¶
Overview ¶
Package spec provides builders and parsers for spelling Noms databases, datasets and values.
Index ¶
- Constants
- func CreateCommitMetaStruct(db datas.Database, date, message string, keyValueStrings map[string]string, ...) (types.Struct, error)
- func CreateDatabaseSpecString(protocol, path string) string
- func CreateHashSpecString(protocol, path string, h hash.Hash) string
- func CreateValueSpecString(protocol, path, value string) string
- func GetChunkStore(str string) (chunks.ChunkStore, error)
- func GetDatabase(str string) (datas.Database, error)
- func GetDataset(str string) (datas.Database, datas.Dataset, error)
- func GetPath(str string) (datas.Database, types.Value, error)
- func ReadAbsolutePaths(db datas.Database, paths ...string) ([]types.Value, error)
- func RegisterCommitMetaFlags(flags *flag.FlagSet)
- func RegisterDatabaseFlags(flags *flag.FlagSet)
- type AbsolutePath
- type DatabaseSpec
- type PathSpec
Constants ¶
const CommitMetaDateFormat = "2006-01-02T15:04:05-0700"
const (
Separator = "::"
)
Variables ¶
This section is empty.
Functions ¶
func CreateCommitMetaStruct ¶
func CreateCommitMetaStruct(db datas.Database, date, message string, keyValueStrings map[string]string, keyValuePaths map[string]types.Value) (types.Struct, error)
CreateCommitMetaStruct creates and returns a Noms struct suitable for use in CommitOptions.Meta. It returns types.EmptyStruct and an error if any issues are encountered. Database is used only if commitMetaKeyValuePaths are provided on the command line and values need to be resolved. Date should be ISO 8601 format (see CommitMetaDateFormat), if empty the current date is used. The values passed as command line arguments (if any) are merged with the values provided as function arguments.
func CreateValueSpecString ¶
func GetChunkStore ¶
func GetChunkStore(str string) (chunks.ChunkStore, error)
func ReadAbsolutePaths ¶
ReadAbsolutePaths attempts to parse each path in 'paths' and resolve them. If any path fails to parse correctly or if any path can be resolved to an existing Noms Value, then this function returns (nil, error).
func RegisterCommitMetaFlags ¶
RegisterCommitMetaFlags registers command line flags used for creating commit meta structs.
func RegisterDatabaseFlags ¶
Types ¶
type AbsolutePath ¶
AbsolutePath represents a path originating at a dataset or a well-formed hash (i.e. '#' + 32 chars) representing a Noms Value that is independently addressable. Either the Dataset of Hash field will indicate the beginning of the AbsolutePath and the other one will be nil. The Path field holds the remainder of the path.
func NewAbsolutePath ¶
func NewAbsolutePath(str string) (AbsolutePath, error)
NewAbsolutePath attempts to parse 'str' and return an AbsolutePath.
func (AbsolutePath) Resolve ¶
func (p AbsolutePath) Resolve(db datas.Database) (val types.Value)
Resolve returns the Value reachable by 'p' in 'db'.
func (AbsolutePath) String ¶
func (p AbsolutePath) String() (str string)
type DatabaseSpec ¶
func ParseDatabaseSpec ¶
func ParseDatabaseSpec(spec string) (DatabaseSpec, error)
ParseDatabaseSpec parses a database spec string into its parts
func (DatabaseSpec) String ¶
func (spec DatabaseSpec) String() string
type PathSpec ¶
type PathSpec struct {
DbSpec DatabaseSpec
Path AbsolutePath
}
func ParsePathSpec ¶
ParsePathSpec parses a path spec string into its parts