Documentation ¶
Index ¶
- Variables
- func FindFile(path string) (bool, string, error)
- type Config
- type DB
- type FigmaConfig
- type FileDB
- func (db *FileDB) CalculateHash() (string, error)
- func (db *FileDB) Close() error
- func (db *FileDB) Data() *Config
- func (db *FileDB) IsAcceptedSource(name string) bool
- func (db *FileDB) IsGone() bool
- func (db *FileDB) IsStale() bool
- func (db *FileDB) Load() error
- func (db *FileDB) Open() error
- func (db *FileDB) Refresh() error
- type StaticDB
- type TagConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // BasenameRegexps matches on allowed names of the configuration file. BasenameRegexp = regexp.MustCompile(`(?i)^(dsk|dsk\.(json|ya?ml))$`) )
Functions ¶
Types ¶
type Config ¶
type Config struct { // The name of the organization that this Design System is for, defaults to "DSK". Org string `json:"org,omitempty" yaml:"org,omitempty"` // The project name, defaults to the basename of the DDT folder. Project string `json:"project,omitempty" yaml:"project,omitempty"` // Language, the documents are authored in. Mainly used for indexing // the documents, defaults to English ("en"). Lang string `json:"lang,omitempty" yaml:"lang,omitempty"` // A slice of configuration objects for specific tags. Allows you to display certain tags in custom colors. Tags []*TagConfig `json:"tags,omitempty" yaml:"tags,omitempty"` // List of sources or source patterns to whitelist DDT sources // that can be selected and switched to, by default just the // "live" version is allowed. Multiple versions can be matched // using patterns. Patterns may include wildcards ('*'), which // match any number of characters or ('?') to match a single // character. // // Internally this is known as "sources", externally to the // user as "versions". "Sources" as a term is too abstract and // "versions" has many meanings to cover this case. Sources []string `json:"versions,omitempty" yaml:"versions,omitempty"` // Configuration related to figma.com. Figma *FigmaConfig `json:"figma,omitempty" yaml:"figma,omitempty"` Custom interface{} `json:"custom,omitempty" yaml:"custom,omitempty"` }
type DB ¶
type DB interface { // Data returns the internal configuration data. Data() *Config // Refresh updates the internal data from its original source. Refresh() error // Open prepares the struct for use, it allow structs implementing // the interface i.e. to retrieve data from its underlying source. Open() error // Close is the counterpart to Open() Close() error // IsAcceptedSource returns true, when the given source is // whitelisted by configuration. It must support pattern matching // with multiple ('*') and single ('?') character matching. IsAcceptedSource(string) bool }
type FigmaConfig ¶
type FigmaConfig struct { // A generated figma personal access token, used for accessing the Figma API on users behalf. AccessToken string `json:"accessToken,omitempty" yaml:"accessToken,omitempty"` }
type FileDB ¶
func (*FileDB) CalculateHash ¶
CalculateHash hash returns a sha1 sum of the file contents.
func (*FileDB) IsAcceptedSource ¶
func (*FileDB) IsGone ¶
IsGone checks if the underlying file still exists. This check together with IsStale() can be used to decide whether the need to initialize a new struct or can reuse the current one, and update it from the files contents.
type StaticDB ¶
type StaticDB struct {
// contains filtered or unexported fields
}
StaticDB is a read-only configuration database.
func NewStaticDB ¶
func (*StaticDB) IsAcceptedSource ¶
Click to show internal directories.
Click to hide internal directories.