kasset

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Event kaos.EventHub
	Topic string
)

Functions

func NewSimpleFS

func NewSimpleFS(basicPath string) *simpleFS

Types

type Asset

type Asset struct {
	orm.DataModelBase `json:"-" bson:"-"`
	ID                string `json:"_id" bson:"_id"`
	Title             string `json:"title"`
	OriginalFileName  string `json:"originalfilename"`
	NewFileName       string `json:"newfilename"`
	URI               string `json:"uri"`
	ContentType       string `json:"contenttype"`
	Size              int    `json:"size"`
	Tags              string `json:"tags"`
}

func (*Asset) GetID

func (a *Asset) GetID(c dbflex.IConnection) ([]string, []interface{})

func (*Asset) PreSave

func (a *Asset) PreSave(c dbflex.IConnection) error

func (*Asset) SetID

func (a *Asset) SetID(keys ...interface{})

func (*Asset) TableName

func (a *Asset) TableName() string

type AssetAPIEngine

type AssetAPIEngine struct {
}

func (*AssetAPIEngine) FindByRefID

func (ae *AssetAPIEngine) FindByRefID(ctx *kaos.Context, req *ReferenceRequest) ([]*Asset, error)

func (*AssetAPIEngine) MakeRef

func (ae *AssetAPIEngine) MakeRef(ctx *kaos.Context, req *AssetReference) (string, error)

type AssetData

type AssetData struct {
	Asset   *Asset `json:"asset"`
	Content []byte `json:"content"`
}

type AssetEngine

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

func NewAssetEngine

func NewAssetEngine(fs AssetFS) *AssetEngine

func (*AssetEngine) Delete

func (ae *AssetEngine) Delete(ctx *kaos.Context, id string) (int, error)

func (*AssetEngine) HttpViewer

func (ae *AssetEngine) HttpViewer(w http.ResponseWriter, r *http.Request)

func (*AssetEngine) Read

func (a *AssetEngine) Read(ctx *kaos.Context, id string) (*Asset, error)

func (*AssetEngine) SaveAttr

func (ae *AssetEngine) SaveAttr(ctx *kaos.Context, req *SaveAttrRequest) (string, error)

func (*AssetEngine) Write

func (a *AssetEngine) Write(ctx *kaos.Context, attachReq *AssetData) (*Asset, error)

type AssetFS

type AssetFS interface {
	Save(string, []byte) error
	Read(string) ([]byte, error)
	Delete(string) error
}

type AssetReference

type AssetReference struct {
	orm.DataModelBase `json:"-" bson:"-"`
	ID                string `json:"_id" bson:"_id"`
	AssetID           string `json:"assetid"`
	RefType           string `json:"reftype"`
	RefID             string `json:"refid"`
	Feature           string `json:"feature"`
}

func (*AssetReference) GetID

func (ar *AssetReference) GetID(_ dbflex.IConnection) ([]string, []interface{})

func (*AssetReference) SetID

func (ar *AssetReference) SetID(keys ...interface{})

func (*AssetReference) TableName

func (ar *AssetReference) TableName() string

type ReferenceRequest

type ReferenceRequest struct {
	RefType string
	RefID   string
}

type SaveAttrRequest

type SaveAttrRequest struct {
	ID   string                 `json:"_id"`
	Data map[string]interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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