types

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PermOwnerRead   = "owner_read"
	PermOwnerWrite  = "owner_write"
	PermOwnerExec   = "owner_exec"
	PermGroupRead   = "group_read"
	PermGroupWrite  = "group_write"
	PermGroupExec   = "group_exec"
	PermOthersRead  = "others_read"
	PermOthersWrite = "others_write"
	PermOthersExec  = "others_exec"
)
View Source
const (
	/*
		system-wide kind
	*/
	GroupKind = "group"

	/*
		text based file kind
	*/
	TextKind = "text"

	/*
		format doc kind
	*/
	FmtDocKind = "fmtdoc"

	/*
		media file kind
	*/
	ImageKind = "image"
	VideoKind = "video"
	AudioKind = "audio"

	/*
		web based file kind
	*/
	WebArchiveKind = "web"

	/*
		workflow kind
	*/
	WorkflowKind = "workflow"
	JobKind      = "job"

	/*
		time management system object kind
	*/
	TodoActionItemKind = "tdaction"
	TodoProjectKind    = "tdproject"
	TodoGroupKind      = "tdgroup"

	/*
		ungrouped files
	*/
	RawKind = "raw"
)
View Source
const (
	VersionKey = "nanafs.version"
	KindKey    = "nanafs.kind"
)

Variables

View Source
var (
	ErrNotFound    = errors.New("no record")
	ErrIsExist     = errors.New("record existed")
	ErrNoGroup     = errors.New("not group")
	ErrIsGroup     = errors.New("this object is a group")
	ErrUnsupported = errors.New("unsupported operation")
)

Functions

func Get

func Get(columnKey string, o *Object) interface{}

Types

type Access

type Access struct {
	Permissions []Permission `json:"permissions,omitempty"`
}

type After

type After struct {
	ColumnKey string
	Content   time.Time
}

func (After) Apply

func (a After) Apply(value *Object) bool

type Annotation

type Annotation struct {
	Annotations []AnnotationItem `json:"annotations,omitempty"`
	Details     string           `json:"details,omitempty"`
}

func (*Annotation) Add

func (a *Annotation) Add(newA *AnnotationItem)

func (*Annotation) Get

func (a *Annotation) Get(key string, withInternal bool) *AnnotationItem

func (*Annotation) Remove

func (a *Annotation) Remove(key string)

type AnnotationItem

type AnnotationItem struct {
	Type       string `json:"type"`
	Content    string `json:"content"`
	IsInternal bool   `json:"is_internal"`
	Encode     bool   `json:"encode"`
}

type Before

type Before struct {
	ColumnKey string
	Content   time.Time
}

func (Before) Apply

func (b Before) Apply(value *Object) bool

type BeginWith

type BeginWith struct {
	ColumnKey string
	Content   string
}

func (BeginWith) Apply

func (b BeginWith) Apply(value *Object) bool

type CommOpe

type CommOpe struct {
	ColumnKey string `json:"column_key"`
	Content   string `json:"content"`
}

type CustomColumn

type CustomColumn struct {
	Columns []CustomColumnItem `json:"columns,omitempty"`
}

type CustomColumnItem

type CustomColumnItem struct {
	Name  string `json:"name"`
	Type  string `json:"type"`
	Value string `json:"value"`
}

type Equal

type Equal struct {
	ColumnKey string
	Content   string
}

func (Equal) Apply

func (m Equal) Apply(value *Object) bool

type ExtendData

type ExtendData struct {
	Properties *Properties `json:"properties,omitempty"`
	Annotation *Annotation `json:"annotation,omitempty"`
}

type In

type In struct {
	ColumnKey string
	Content   []string
}

func (In) Apply

func (i In) Apply(value *Object) bool

type Job

type Job struct {
	Id           string `json:"id"`
	WorkflowName string `json:"workflow_name"`
	Status       string `json:"status"`
	Message      string `json:"message"`
	Tasks        []Task `json:"tasks"`
}

type Kind

type Kind string

Kind of Object

type Label

type Label struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Labels

type Labels struct {
	Labels []Label `json:"labels,omitempty"`
}

func (Labels) Get

func (l Labels) Get(key string) *Label

type Metadata

type Metadata struct {
	ID         string    `json:"id"`
	Name       string    `json:"name"`
	Aliases    string    `json:"aliases,omitempty"`
	ParentID   string    `json:"parent_id"`
	RefID      string    `json:"ref_id,omitempty"`
	Kind       Kind      `json:"kind"`
	Hash       string    `json:"hash"`
	Size       int64     `json:"size"`
	Inode      uint64    `json:"inode"`
	Namespace  string    `json:"namespace,omitempty"`
	CreatedAt  time.Time `json:"created_at"`
	ChangedAt  time.Time `json:"changed_at"`
	ModifiedAt time.Time `json:"modified_at"`
	AccessAt   time.Time `json:"access_at"`
	Labels     Labels    `json:"labels"`
	Access     Access    `json:"access"`
}

func NewMetadata

func NewMetadata(name string, kind Kind) Metadata

type MutilOpe

type MutilOpe struct {
	ColumnKey string
	Content   []string
}

type Object

type Object struct {
	Metadata
	ExtendData   ExtendData   `json:"extend_data"`
	CustomColumn CustomColumn `json:"custom_column"`
	// contains filtered or unexported fields
}

func InitNewObject

func InitNewObject(parent *Object, attr ObjectAttr) (*Object, error)

func (*Object) IsGroup

func (o *Object) IsGroup() bool

type ObjectAttr

type ObjectAttr struct {
	Name        string
	Kind        Kind
	Permissions []Permission
}

type Operation

type Operation interface {
	Apply(value *Object) bool
}

type Pattern

type Pattern struct {
	ColumnKey string
	Content   string
}

func (Pattern) Apply

func (p Pattern) Apply(value *Object) bool

type Permission

type Permission string

type Properties

type Properties struct {
	Author   string   `json:"author,omitempty"`
	Title    string   `json:"title,omitempty"`
	Subject  string   `json:"subject,omitempty"`
	Keywords []string `json:"keywords,omitempty"`
	Comment  string   `json:"comment,omitempty"`
}

type Rule

type Rule struct {
	Logic     string
	Rules     []Rule
	Operation Operation
}

func (Rule) Apply

func (r Rule) Apply(value *Object) bool

type Task

type Task struct {
	Name    string `json:"name"`
	Message string `json:"message"`
	Status  string `json:"status"`
}

type TimeOpe

type TimeOpe struct {
	ColumnKey string
	Content   time.Time
}

type WFRule

type WFRule struct {
	Logic     string    `json:"logic"`
	Rules     []WFRule  `json:"rules"`
	Equal     *CommOpe  `json:"equal"`
	BeginWith *CommOpe  `json:"begin_with"`
	Pattern   *CommOpe  `json:"pattern"`
	Before    *TimeOpe  `json:"before"`
	After     *TimeOpe  `json:"after"`
	In        *MutilOpe `json:"in"`
}

func (WFRule) ToRule

func (w WFRule) ToRule() Rule

type Workflow

type Workflow struct {
	Name    string   `json:"name"`
	Rule    WFRule   `json:"rule"`
	Actions []string `json:"actions"`
}

Jump to

Keyboard shortcuts

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