types

package
v0.0.0-...-f591335 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileMeta

type FileMeta struct {
	Name string `json:"name,omitempty"`
	Size int64  `json:"size,omitempty"`

	// modification time
	ModTime int64  `json:"mod_time,omitempty"`
	IsDir   bool   `json:"is_dir,omitempty"`
	Ext     string `json:"ext,omitempty"`
}

func NewFileMeta

func NewFileMeta(fp string) (*FileMeta, error)

type IMetadata

type IMetadata interface {
	Decode(data []byte) (err error)
	Encode() (data []byte, err error)
	Sign() (data []byte, err error)
}

type ISubMetadata

type ISubMetadata interface{}

type ImageMeta

type ImageMeta struct {
	FileMeta

	Width  int `json:"width,omitempty"`
	Height int `json:"height,omitempty"`

	// 缩略图地址
	Thumb string `json:"thumb,omitempty"`
}

type License

type License struct {
	Type        string             `json:"type,omitempty"`
	Parameters  []LicenseParameter `json:"parameters,omitempty"`
	Description string             `json:"description,omitempty"`
}

type LicenseParameter

type LicenseParameter struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Type        string `json:"type,omitempty"`
	Values      string `json:"values,omitempty"`
}

type Metadata

type Metadata struct {
	IMetadata

	// 用于metadata的全局id,metadata修改时ID不变
	ID string `json:"id,omitempty"`

	// 对该内容的描述
	Abstract string `json:"abstract,omitempty"`

	// 分组,只能归档到一个组
	Category []string `json:"category,omitempty"`

	// 标签,可以有多个标签
	Tag []string `json:"tag,omitempty"`

	// 根据签名生成的唯一的内容识别码
	DNA string `json:"dna,omitempty"`

	// 内容分片的数量
	ChunkNum uint64 `json:"chunk_num,omitempty"`

	// 修改前的dna
	ParentDna string `json:"parent_dna,omitempty"`

	// 扩展的额外的数据
	Extra map[string]string `json:"extra,omitempty"`

	// 内容原地址
	Source string `json:"source,omitempty"`

	// 内容的标题说明
	Title string `json:"title,omitempty"`

	// 组件扩展附加,比如内容的点赞评论和转发以及投票等组件
	Extend []string `json:"extend,omitempty"`

	// 其他类型的数据
	Data ISubMetadata `json:"data,omitempty"`

	// 内容hash,keecak256 hash
	ContentHash string `json:"content_hash,omitempty"`

	// 内容的创建时间
	CreateTime int64 `json:"create_time,omitempty"`

	// 内容的修改时间
	UpdateTime int64 `json:"update_time,omitempty"`

	// 创建和修改状态
	Status string `json:"status,omitempty"`

	// 内容的语言
	Language string `json:"language,omitempty"`

	// 内容的签名
	Signature string `json:"signature,omitempty"`

	// 内容的许可证
	License struct {
		Type   string            `json:"type,omitempty"`
		Params map[string]string `json:"parameters,omitempty"`
	} `json:"license,omitempty"`
}

func CreateFileMeta

func CreateFileMeta(db kdb.IKHash, f string) (*Metadata, error)

func (*Metadata) Decode

func (m *Metadata) Decode(data []byte) error

func (*Metadata) Encode

func (m *Metadata) Encode() ([]byte, error)

type NameHash

type NameHash struct {
	Name string `json:"name"`
	Hash string `json:"hash"`
}

type RPCRequest

type RPCRequest struct {
	ID        string                 `json:"id"`
	Method    string                 `json:"method"`
	Signature string                 `json:"sign,omitempty"`
	Params    map[string]interface{} `json:"params,omitempty"`
}

type RPCResponse

type RPCResponse struct {
	Code int    `json:"code"`
	ID   string `json:"id"`
	Msg  string `json:"msg,omitempty"`
	Data string `json:"data,omitempty"`
}

type User

type User struct {
	Email       []string `json:"email,omitempty"`
	Phone       []string `json:"phone,omitempty"`
	Name        string   `json:"name,omitempty"`
	NickName    string   `json:"nick_name,omitempty"`
	IDCard      string   `json:"id_card,omitempty"`
	CreditScore int64    `json:"credit_score,omitempty"`
	Game        []string `json:"game,omitempty"`
	Social      []string `json:"social,omitempty"`
	Job         []string `json:"job,omitempty"`
	Office      []string `json:"office,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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