assets

package
v0.0.0-...-b84af7b Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindURLs

func FindURLs(d Deps, list ...bson.ObjectId) (common.AssetRefsMap, error)

Types

type Asset

type Asset struct {
	ID       bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
	Original string        `bson:"original" json:"original"`
	Hosted   string        `bson:"hosted" json:"hosted"`
	DataType string        `bson:"dataType,omitempty" json:"dataType,omitempty"`
	MD5      string        `bson:"hash" json:"hash"`
	Status   string        `bson:"status" json:"status"`
	Created  time.Time     `bson:"created_at" json:"created_at"`
	Updated  time.Time     `bson:"updated_at" json:"updated_at"`
}

func FindHash

func FindHash(d Deps, hash string) (asset Asset, err error)

func FromURL

func FromURL(deps Deps, url string) (ref Asset, err error)

FromURL asset.

func (Asset) Extension

func (asset Asset) Extension() string

func (Asset) Replace

func (asset Asset) Replace(content string) string

Replace original URL with asset tag.

func (Asset) URL

func (asset Asset) URL() string

type Assets

type Assets []Asset

Assets list.

func FindList

func FindList(d Deps, scopes ...common.Scope) (list Assets, err error)

func (Assets) HostRemotes

func (list Assets) HostRemotes(deps Deps, related string)

HostRemotes assets into S3 bucket.

func (Assets) UpdateCache

func (list Assets) UpdateCache(d Deps) (err error)

type Deps

type Deps interface {
	Mgo() *mgo.Database
	S3() *s3.Bucket
	LedisDB() *ledis.DB
}

Jump to

Keyboard shortcuts

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