types

package
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TagResourceType tag for resource type
	TagResourceType = "resourceType"
	// TagResourceName tag for resource name
	TagResourceName = "resourceName"
	// TagNamespace tag for namespace
	TagNamespace = "namespace"
	// TagClusterID tag for cluster id
	TagClusterID = "clusterId"
	// TagCreateTime tag for create time
	TagCreateTime = "createTime"
	// TagUpdateTime tag for update time
	TagUpdateTime = "updateTime"
)
View Source
const (
	// ObjectTypeStorageDynamic type name for StorageDynamic
	ObjectTypeStorageDynamic = "StorageDynamic"
)
View Source
const (
	// ObjectTypeStorageObjectDefinition type name for StorageObjectDefinition
	ObjectTypeStorageObjectDefinition = "StorageObjectDefinition"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterNamespacedName

type ClusterNamespacedName struct {
	ClusterID string
	Namespace string
	Name      string
}

ClusterNamespacedName comprise a resource name

type Field

type Field struct {
	Name     string    `json:"name" bson:"name"`
	Type     FieldType `json:"type" bson:"type"`
	MaxBytes int64     `json:"maxBytes" bson:"maxBytes"`
}

Field field

type FieldIndex

type FieldIndex struct {
	Keys   []string `json:"keys" bson:"keys"`
	Name   string   `json:"name" bson:"name"`
	Unique bool     `json:"unique" bson:"unique"`
}

FieldIndex field index

type FieldType

type FieldType string

FieldType type of field

type Meta

type Meta struct {
	Type       ObjectType `json:"resourceType" bson:"resourceType"`
	Name       string     `json:"resourceName" bson:"resourceName"`
	Namespace  string     `json:"namespace" bson:"namespace"`
	ClusterID  string     `json:"clusterId" bson:"clusterId"`
	CreateTime time.Time  `json:"createTime" bson:"createTime"`
	UpdateTime time.Time  `json:"updateTime" bson:"updateTime"`
}

Meta metadata for object

func (*Meta) GetClusterID

func (om *Meta) GetClusterID() string

GetClusterID get cluster id

func (*Meta) GetCreateTime

func (om *Meta) GetCreateTime() time.Time

GetCreateTime get create time

func (*Meta) GetName

func (om *Meta) GetName() string

GetName get name

func (*Meta) GetNamespace

func (om *Meta) GetNamespace() string

GetNamespace get namespace

func (*Meta) GetObjectType

func (om *Meta) GetObjectType() ObjectType

GetObjectType get object type

func (*Meta) GetUpdateTime

func (om *Meta) GetUpdateTime() time.Time

GetUpdateTime get update time

func (*Meta) SetClusterID

func (om *Meta) SetClusterID(cid string)

SetClusterID set cluster id

func (*Meta) SetCreateTime

func (om *Meta) SetCreateTime(t time.Time)

SetCreateTime set create time

func (*Meta) SetName

func (om *Meta) SetName(n string)

SetName set name

func (*Meta) SetNamespace

func (om *Meta) SetNamespace(ns string)

SetNamespace set namespace

func (*Meta) SetObjectType

func (om *Meta) SetObjectType(t ObjectType)

SetObjectType set object type

func (*Meta) SetUpdateTime

func (om *Meta) SetUpdateTime(t time.Time)

SetUpdateTime set update time

type ObjectKey

type ObjectKey ClusterNamespacedName

ObjectKey key for object

type ObjectType

type ObjectType string

ObjectType type of object

type RawObject

type RawObject struct {
	Meta `json:",inline" bson:",inline"`
	Data map[string]interface{} `json:"data" bson:"data"`
}

RawObject store object

func (*RawObject) GetData

func (obj *RawObject) GetData() map[string]interface{}

GetData get data

func (*RawObject) Key

func (obj *RawObject) Key() ObjectKey

Key get key of object

func (*RawObject) SetData

func (obj *RawObject) SetData(data map[string]interface{}) error

SetData set data

func (*RawObject) ToString

func (obj *RawObject) ToString() string

ToString convert object to string

type StorageDynamic

type StorageDynamic struct {
	Meta `json:",inline" bson:",inline"`
	Data map[string]interface{} `json:"data" bson:"data"`
}

StorageDynamic dynamic object for storage

type StorageObjectDefinition

type StorageObjectDefinition struct {
	Meta `json:",inline" bson:",inline"`
	Data StorageObjectDefinitionSpec `json:"data" bson:"data"`
}

StorageObjectDefinition object definition for storage

func NewStorageObjectDefinition

func NewStorageObjectDefinition() *StorageObjectDefinition

NewStorageObjectDefinition create storage object definition

func (*StorageObjectDefinition) GetData

func (sod *StorageObjectDefinition) GetData() map[string]interface{}

GetData get data

func (*StorageObjectDefinition) SetData

func (sod *StorageObjectDefinition) SetData(data map[string]interface{}) error

SetData set data

type StorageObjectDefinitionSpec

type StorageObjectDefinitionSpec struct {
	ObjectType string       `json:"objectType" bson:"objectType"`
	Fields     []Field      `json:"fields" bson:"fields"`
	Indexes    []FieldIndex `json:"indexes" bson:"indexes"`
}

StorageObjectDefinitionSpec spec of StorageObjectDefinition

type ValueSelector

type ValueSelector struct {
	Pairs map[string]interface{}
}

ValueSelector selector for searching objects with certain value in their path

func NewValueSelector

func NewValueSelector() *ValueSelector

NewValueSelector create value selector

func (*ValueSelector) Get

func (vs *ValueSelector) Get(path string) (interface{}, bool)

Get get selector value

func (*ValueSelector) GetPairs

func (vs *ValueSelector) GetPairs() map[string]interface{}

GetPairs return map[string]interface{}

func (*ValueSelector) Set

func (vs *ValueSelector) Set(path string, value interface{}) error

Set set selector value pairs

Jump to

Keyboard shortcuts

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