data

package
v0.0.0-...-36277ca Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnitType = Type(iota)
	MarkdownType
	ListType
	TableType
)

DataContent Format Type

Variables

View Source
var (
	OkStatus      = newStatus(0, successFlag) // 成功
	RunErrStatus  = newStatus(1, validFlag)   // 模块运行错误,表示特定的函数执行失败
	BugStatus     = newStatus(2, validFlag)   // 由于未知BUG出现了某种预料之外的情况
	InvalidStatus = newStatus(3, noneFlag)    // 无效状态,将被忽略

)
View Source
var EmptyContent = wrapContent{}

Functions

func IsValid

func IsValid(s Status) bool

func ShouldReturn

func ShouldReturn(s Status) bool

Types

type AnalyseData

type AnalyseData struct {
	XTime    JSONTime       `json:"time"`
	DataList []*AnalyseData `json:"dataList"`
	ID       string         `json:"id"`
	Name     string         `json:"name"`
	Desc     string         `json:"desc"`
	Data     *wrapContent   `json:"data"`
	Status   Status         `json:"status"`
	XType    Type           `json:"type"`
	// contains filtered or unexported fields
}

func NewAnalyseData

func NewAnalyseData(content Content) *AnalyseData

NewAnalyseData create analyse data.

func NewLazyAnalyseData

func NewLazyAnalyseData(lazyFunc func(aData *AnalyseData) Content) *AnalyseData

func NewListAnalyseData

func NewListAnalyseData(id string, name string, dataList []*AnalyseData) *AnalyseData

func NewOtherAnalyseData

func NewOtherAnalyseData(s Status, desc string, content Content) *AnalyseData

func (*AnalyseData) Change

func (a *AnalyseData) Change(changer func(set ContentSet) Content)

func (*AnalyseData) ExtraByKey

func (a *AnalyseData) ExtraByKey(k string) (interface{}, bool)

func (*AnalyseData) PutExtra

func (a *AnalyseData) PutExtra(k string, v interface{}) *AnalyseData

func (*AnalyseData) RmExtra

func (a *AnalyseData) RmExtra(k string)

func (AnalyseData) String

func (a AnalyseData) String() string

func (*AnalyseData) WaitReady

func (a *AnalyseData) WaitReady()

func (*AnalyseData) WithID

func (a *AnalyseData) WithID(id string) *AnalyseData

func (*AnalyseData) WithName

func (a *AnalyseData) WithName(name string) *AnalyseData

type Content

type Content interface {
	Class() Type
	Data() interface{}
}

type ContentSet

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

func NewSet

func NewSet(contents ...Content) *ContentSet

func (ContentSet) Class

func (c ContentSet) Class() Type

func (*ContentSet) Combine

func (c *ContentSet) Combine(contents ...Content) *ContentSet

func (ContentSet) Data

func (c ContentSet) Data() (res interface{})

type JSONTime

type JSONTime time.Time

func (JSONTime) MarshalJSON

func (t JSONTime) MarshalJSON() ([]byte, error)

type Pool

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

Pool 数据池

func NewDataPool

func NewDataPool() *Pool

NewDataPool 创建数据池

func (*Pool) Chan

func (p *Pool) Chan() chan<- *AnalyseData

Chan 获取数据池发送的通道

func (*Pool) Data

func (p *Pool) Data() []*AnalyseData

Data 获取池中的数据,若数据未收集完成,阻塞操作

func (*Pool) InitPool

func (p *Pool) InitPool(done <-chan struct{}, waitCnt uint)

InitPool 初始化数据池

done: 被关闭时,停止接收数据
waitCnt: 表示数据接收前要等待的次数

func (*Pool) WaitReady

func (p *Pool) WaitReady()

WaitReady 阻塞等待操作就绪

type Status

type Status int32

Status 数据状态

func (Status) MarshalJSON

func (s Status) MarshalJSON() ([]byte, error)

func (Status) String

func (s Status) String() string

type Type

type Type int8

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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