asset

package
v0.0.0-...-41221c5 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MediaTypeByExtension

func MediaTypeByExtension(extension string) string

func MediaTypeByURL

func MediaTypeByURL(url *url.URL) string

func ParseMediaType

func ParseMediaType(value string) string

Types

type Asset

type Asset interface {
	URL() *url.URL
	MediaType() string
	Data() []byte
	References() []Reference
	Embeds() []Embed
	Merge(Asset, Relation) bool
}

type Embed

type Embed interface {
	Relation
	MediaType() string
	Data() []byte
	Flags() Flags
}

type Flags

type Flags []*flag

func (Flags) Delete

func (f Flags) Delete(key string) Flags

func (Flags) Get

func (f Flags) Get(key string) interface{}

func (Flags) Has

func (f Flags) Has(key string) bool

func (Flags) Set

func (f Flags) Set(key string, value interface{}) Flags

type Graph

type Graph struct {
	// contains filtered or unexported fields
}

func NewGraph

func NewGraph() *Graph

func (*Graph) Add

func (g *Graph) Add(asset Asset) bool

func (*Graph) Assets

func (g *Graph) Assets() []Asset

func (*Graph) Delete

func (g *Graph) Delete(asset Asset) bool

func (*Graph) Has

func (g *Graph) Has(asset Asset) bool

func (*Graph) Incoming

func (g *Graph) Incoming(asset Asset) (map[Relation]Asset, bool)

func (*Graph) Indegree

func (g *Graph) Indegree(asset Asset) (int, bool)

func (*Graph) Leaves

func (g *Graph) Leaves() []Asset

func (*Graph) Lookup

func (g *Graph) Lookup(query Query) (Asset, bool)

func (*Graph) Merge

func (g *Graph) Merge(target Asset, source Asset) bool

func (*Graph) Outdegree

func (g *Graph) Outdegree(asset Asset) (int, bool)

func (*Graph) Outgoing

func (g *Graph) Outgoing(asset Asset) (map[Relation]Asset, bool)

func (*Graph) Relate

func (g *Graph) Relate(from Asset, to Asset, relation Relation) bool

func (*Graph) Relation

func (g *Graph) Relation(from Asset, to Asset) (Relation, bool)

func (*Graph) Roots

func (g *Graph) Roots() []Asset

func (*Graph) Size

func (g *Graph) Size() int

type Query

type Query func(Asset) bool

func ByMediaType

func ByMediaType(mediaType string) Query

func ByURL

func ByURL(url *url.URL) Query

type Reference

type Reference interface {
	Relation
	URL() *url.URL
	Rewrite(*url.URL)
	Flags() Flags
}

type Relation

type Relation interface {
	VisitRelation(RelationVisitor)
}

type RelationVisitor

type RelationVisitor struct {
	Reference func(Reference)
	Embed     func(Embed)
}

Directories

Path Synopsis
css
ast
ast
ast
js
ast
https://github.com/estree/estree
https://github.com/estree/estree
ast

Jump to

Keyboard shortcuts

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