types

package
v0.0.0-...-1bb69ff Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LDPResource        = "http://www.w3.org/ns/ldp#Resource"
	LDPDirectContainer = "http://www.w3.org/ns/ldp#DirectContainer"
	LDPRDFSource       = "http://www.w3.org/ns/ldp#RDFSource"
	LDPNonRDFSource    = "http://www.w3.org/ns/ldp#NonRDFSource"
)

Variables

View Source
var AssertionURIPattern = regexp.MustCompile("^ul:([a-z2-7]{59})$")
View Source
var EmptyDirectoryURI = "dweb:/ipfs/bafybeiczsscdsbs7ffqz55asqdf3smv6klcw3gofszvwlyarci47bgf354"
View Source
var FileURIPattern = regexp.MustCompile("^dweb:/ipfs/([a-z2-7]{59})$")
View Source
var LinkTypeDirectContainer = MakeLinkType(LDPDirectContainer)
View Source
var LinkTypeNonRDFSource = MakeLinkType(LDPNonRDFSource)
View Source
var LinkTypeRDFSource = MakeLinkType(LDPRDFSource)
View Source
var LinkTypeResource = MakeLinkType(LDPResource)
View Source
var NQuadsFileExtension = ".nq"
View Source
var PackageURIPattern = regexp.MustCompile("^ul:([a-z2-7]{59})#(c14n\\d+)$")

Functions

func GetURI

func GetURI(base string, key []string) (u string)

func MakeLinkType

func MakeLinkType(t string) string

func ParsePath

func ParsePath(p string) []string

Types

type Assertion

type Assertion struct {
	ID       string      `json:"id,omitempty"`
	Resource string      `json:"resource,omitempty"`
	Title    string      `json:"title,omitempty"`
	Created  string      `json:"created,omitempty"`
	Modified string      `json:"modified,omitempty"`
	Dataset  []*rdf.Quad `json:"-"`
}

func (*Assertion) ETag

func (a *Assertion) ETag() string

func (*Assertion) GetDataset

func (a *Assertion) GetDataset(api iface.CoreAPI) []*rdf.Quad

func (*Assertion) Name

func (a *Assertion) Name() string

func (*Assertion) Path

func (a *Assertion) Path() path.Resolved

func (*Assertion) T

func (a *Assertion) T() ResourceType

func (*Assertion) Type

func (a *Assertion) Type() string

func (*Assertion) URI

func (a *Assertion) URI() string

type File

type File struct {
	ID       string `json:"id,omitempty"`
	Resource string `json:"resource,omitempty"`
	Title    string `json:"title,omitempty"`
	Created  string `json:"created,omitempty"`
	Modified string `json:"modified,omitempty"`
	Extent   int    `json:"extent"`
	Format   string `json:"format"`
}

func (*File) ETag

func (f *File) ETag() string

func (*File) Name

func (f *File) Name() string

func (*File) Path

func (f *File) Path() path.Resolved

func (*File) T

func (f *File) T() ResourceType

func (*File) Type

func (f *File) Type() string

func (*File) URI

func (f *File) URI() string

type Package

type Package struct {
	Reference
	Created     string   `json:"created,omitempty"`
	Modified    string   `json:"modified,omitempty"`
	Description string   `json:"description,omitempty"`
	Keywords    []string `json:"keywords,omitempty"`
	Parent      string   `json:"parent,omitempty"`
	Value       struct {
		ID     string `json:"id"`
		Extent int    `json:"extent"`
	} `json:"value"`
	Members struct {
		Packages   []*Reference `json:"packages,omitempty"`
		Assertions []*Assertion `json:"assertions,omitempty"`
		Files      []*File      `json:"files,omitempty"`
	} `json:"members,omitempty"`
}

func NewPackage

func NewPackage(resource, title string) *Package

NewPackage creates a new timestamped package.

func (*Package) CopyResource

func (pkg *Package) CopyResource() *Reference

func (*Package) ETag

func (pkg *Package) ETag() string

func (*Package) Fragment

func (pkg *Package) Fragment() (c cid.Cid, fragment string)

func (*Package) JsonLd

func (pkg *Package) JsonLd(context string) (map[string]interface{}, error)

func (*Package) Name

func (pkg *Package) Name() string

func (*Package) Path

func (pkg *Package) Path() path.Resolved

func (*Package) SearchAssertions

func (pkg *Package) SearchAssertions(name string, isCid bool) (int, *Assertion)

func (*Package) SearchFiles

func (pkg *Package) SearchFiles(name string, isCid bool) (int, *File)

func (*Package) SearchPackages

func (pkg *Package) SearchPackages(name string, isCid bool) (int, *Reference)

func (*Package) T

func (pkg *Package) T() ResourceType

func (*Package) Type

func (pkg *Package) Type() string

func (*Package) URI

func (pkg *Package) URI() string

func (*Package) ValuePath

func (pkg *Package) ValuePath() path.Resolved

type Reference

type Reference struct {
	ID       string `json:"id,omitempty"`
	Resource string `json:"resource,omitempty"`
	Title    string `json:"title,omitempty"`
}

func (*Reference) ETag

func (r *Reference) ETag() string

func (*Reference) Fragment

func (r *Reference) Fragment() string

func (*Reference) Name

func (r *Reference) Name() string

func (*Reference) Path

func (r *Reference) Path() path.Resolved

func (*Reference) T

func (r *Reference) T() ResourceType

func (*Reference) Type

func (r *Reference) Type() string

func (*Reference) URI

func (r *Reference) URI() string

type Resource

type Resource interface {
	T() ResourceType
	Type() string
	Path() path.Resolved
	ETag() string
	URI() string
	Name() string
}

type ResourceType

type ResourceType uint8

ResourceType is an enum for resource types

const (

	// PackageType = 1 the ResourceType for Packages
	PackageType ResourceType
	// AssertionType = 2 the ResourceType for Assertions
	AssertionType
	// FileType = 3 is the ResourceType for Files
	FileType
)
func ParseLinks(links []string) (self string, t ResourceType)

Jump to

Keyboard shortcuts

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