Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractCids(artifacts []Artifact) ([]cid.Cid, error)
- func ValidateEntry(entry ArtifactEntry, filePath string) error
- type Artifact
- type ArtifactCommit
- type ArtifactEntry
- type ArtifactEntryFile
- type ArtifactEntryLink
- type ArtifactParseError
- type ContentKey
- type EntryField
- type ErrorCallback
- type FieldValidator
- type GenericEntry
- type InvalidArtifactError
- type InvalidArtifactReason
- type Revision
Constants ¶
View Source
const ArtifactFileExtension = ".md"
View Source
const CurrentArtifactVersion = 2
Variables ¶
View Source
var ErrInvalidArtifactFiles = errors.New("one or more artifact files are invalid")
View Source
var ErrNoFrontMatter = errors.New("this file has no front matter")
Functions ¶
func ExtractCids ¶
func ValidateEntry ¶
func ValidateEntry(entry ArtifactEntry, filePath string) error
Types ¶
type Artifact ¶
type Artifact struct { Path string `json:"path"` Slug string `json:"slug"` Commit *ArtifactCommit `json:"commit"` Entry GenericEntry `json:"entry"` }
type ArtifactCommit ¶
type ArtifactEntry ¶
type ArtifactEntry struct { Version int `yaml:"version" json:"version"` Title string `yaml:"title" json:"title"` Description string `yaml:"description" json:"description"` LongDescription *string `yaml:"longDescription" json:"longDescription"` Files []ArtifactEntryFile `yaml:"files" json:"files"` Links []ArtifactEntryLink `yaml:"links" json:"links"` People []string `yaml:"people" json:"people"` Identities []string `yaml:"identities" json:"identities"` FromYear int `yaml:"fromYear" json:"fromYear"` ToYear *int `yaml:"toYear" json:"toYear"` Decades []int `yaml:"decades" json:"decades"` Aliases []string `yaml:"aliases" json:"aliases"` }
func (ArtifactEntry) ToGeneric ¶ added in v0.2.0
func (e ArtifactEntry) ToGeneric() GenericEntry
type ArtifactEntryFile ¶
type ArtifactEntryLink ¶
type ArtifactParseError ¶
func (ArtifactParseError) Error ¶
func (e ArtifactParseError) Error() string
type ContentKey ¶
type ContentKey string
func ContentKeyFromCid ¶
func ContentKeyFromCid(id cid.Cid) ContentKey
type EntryField ¶
type EntryField string
const ( FieldVersion EntryField = "version" FieldTitle EntryField = "title" FieldDescription EntryField = "description" FieldLongDescription EntryField = "longDescription" FieldFiles EntryField = "files" FieldFileName EntryField = "name" FieldFileMediaType EntryField = "mediaType" FieldFileFilename EntryField = "filename" FieldFileCid EntryField = "cid" FieldLinks EntryField = "links" FieldLinkName EntryField = "name" FieldLinkUrl EntryField = "url" FieldPeople EntryField = "people" FieldIdentities EntryField = "identities" FieldFromYear EntryField = "fromYear" FieldToYear EntryField = "toYear" FieldDecades EntryField = "decades" FieldAliases EntryField = "aliases" )
func (EntryField) At ¶
func (f EntryField) At(index int) EntryField
func (EntryField) Literal ¶
func (f EntryField) Literal() string
func (EntryField) Of ¶
func (f EntryField) Of(outer EntryField) EntryField
type ErrorCallback ¶
type ErrorCallback func(field EntryField, reason string)
type FieldValidator ¶
type FieldValidator func(entry ArtifactEntry, reportError ErrorCallback)
type GenericEntry ¶ added in v0.2.0
type GenericEntry map[string]interface{}
func (GenericEntry) Sanitize ¶ added in v0.2.0
func (e GenericEntry) Sanitize() GenericEntry
Sanitize replaces `map[interface{}]interface{}` values that cannot be serialized to JSON with `map[string]interface{}`.
func (GenericEntry) ToTyped ¶ added in v0.2.0
func (e GenericEntry) ToTyped(value interface{})
type InvalidArtifactError ¶
type InvalidArtifactError struct { FilePath string Reasons []InvalidArtifactReason }
func (InvalidArtifactError) Error ¶
func (e InvalidArtifactError) Error() string
type InvalidArtifactReason ¶
type InvalidArtifactReason struct { Field EntryField Reason string }
Click to show internal directories.
Click to hide internal directories.