codemeta

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONMarshal added in v1.2.4

func JSONMarshal(data interface{}) ([]byte, error)

JSONMarshal provides provide a custom json encoder to solve a an issue with HTML entities getting converted to UTF-8 code points by json.Marshal(), json.MarshalIndent().

func JSONMarshalIndent added in v1.2.4

func JSONMarshalIndent(data interface{}, prefix string, indent string) ([]byte, error)

JSONMarshalIndent provides provide a custom json encoder to solve a an issue with HTML entities getting converted to UTF-8 code points by json.Marshal(), json.MarshalIndent().

func JSONUnmarshal added in v1.2.4

func JSONUnmarshal(src []byte, data interface{}) error

JSONUnmarshal is a custom JSON decoder so we can treat numbers easier

Types

type Codemeta

type Codemeta struct {
	// Terms used by Caltech Library codemeta.json
	// Id should be the DOI if available
	Context           string                  `json:"@context"`
	Type              string                  `json:"@type"`
	Name              string                  `json:"name"`
	Description       string                  `json:"description"`
	CodeRepository    string                  `json:"codeRepository"`
	IssueTracker      string                  `json:"issueTracker"`
	License           string                  `json:"license"`
	Version           string                  `json:"version"`
	Author            []*PersonOrOrganization `json:"author"`
	Contributor       []*PersonOrOrganization `json:"contributor,omitempty"`
	Editor            []*PersonOrOrganization `json:"editor,omitempty"`
	Maintainer        []*PersonOrOrganization `json:"maintainer,omitempty"`
	DevelopmentStatus string                  `json:"developmentStatus"`
	DownloadURL       string                  `json:"downloadUrl"`
	Keywords          []string                `json:"keywords"`
	//Maintainer        string                  `json:"maintainer,omitempty"`
	//Funder            []*PersonOrOrganization `json:"funder,omitempty"`
	Funder          *PersonOrOrganization   `json:"funder,omitempty"`
	CopyrightHolder []*PersonOrOrganization `json:"copyrightHolder,omitempty"`
	CopyrightYear   int                     `json:"copyrightYear,omitempty"`
	Created         string                  `json:"dateCreated,omitempty"`
	Updated         string                  `json:"dateModified,omitempty"`
	Published       string                  `json:"datePublished,omitempty"`
	Identifier      string                  `json:"identifier,omitempty"` //FIXME: Is this where I can put the DOI

}

func (*Codemeta) Delete added in v1.0.4

func (cm *Codemeta) Delete(dataPath string) error

Delete removes the value in the codemeta.json file for a provided json path.

func (*Codemeta) Set added in v1.0.4

func (cm *Codemeta) Set(dataPath string, value string) error

Set sets the value in the codemeta.json file for a provided json path.

func (*Codemeta) Show added in v1.0.4

func (cm *Codemeta) Show(dataPath string) (string, error)

Show returns a the value as a string for the json path described by dataPaths. If dataPath is "." return the whole object as a string. if the dataPath is not valid return an empty string.

func (*Codemeta) ToCff

func (cm *Codemeta) ToCff() ([]byte, error)

ToCff crosswalks a Codemeta data structure rendering CITATION.cff document as an array of byte. Based on documentation at https://citation-file-format.github.io/

func (*Codemeta) ToJSON

func (cm *Codemeta) ToJSON() ([]byte, error)

type PersonOrOrganization

type PersonOrOrganization struct {
	// ORCID is use for person id
	Id   string `json:"@id"`
	Type string `json:"@type"`
	// Name is used by organizations
	Name string `json:"name,omitempty"`
	// Given/Family are used by individual persons
	GivenName   string                `json:"givenName,omitempty"`
	FamilyName  string                `json:"familyName,omitempty"`
	Affiliation *PersonOrOrganization `json:"affiliation,omitempty"`
	Email       string                `json:"email,omitempty"`
}

func (*PersonOrOrganization) ToCFF

func (person *PersonOrOrganization) ToCFF() ([]byte, error)

func (*PersonOrOrganization) ToJSON

func (person *PersonOrOrganization) ToJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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