runtime

package
v0.22.3 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddObj

func AddObj(v ...Object)

func RegistrySchema

func RegistrySchema(g *GroupVersionKind, fn func(Object) Schema)

Types

type GroupVersionKind

type GroupVersionKind struct {
	Group   string
	Version string
	Kind    string
}

GroupVersionKind contains the information of Object, etc Group, Version, Kind

func FromGVK

func FromGVK(s string) *GroupVersionKind

func (*GroupVersionKind) APIGroup

func (gvk *GroupVersionKind) APIGroup() string

func (*GroupVersionKind) String

func (gvk *GroupVersionKind) String() string

type Object

type Object interface {
	// GVK get the GroupVersionKind of Object
	GVK() *GroupVersionKind
	// DeepCopyFrom deep copy the struct from another
	DeepCopyFrom(Object)
	// DeepCopy deep copy the struct
	DeepCopy() Object
}

Object is an interface that describes protocol message

func NewObj

func NewObj(gvk string) (Object, bool)

NewObj creates a new object, trigger OnCreate function

func NewObjWithGVK

func NewObjWithGVK(gvk *GroupVersionKind) (Object, bool)

NewObjWithGVK creates a new object, trigger OnCreate function

type ObjectSet

type ObjectSet struct {
	sync.RWMutex

	OnCreate func(in Object) Object
	// contains filtered or unexported fields
}

func NewObjectSet

func NewObjectSet() *ObjectSet

func (*ObjectSet) AddObj

func (os *ObjectSet) AddObj(v ...Object)

AddObj push objects to Set

func (*ObjectSet) GetObj

func (os *ObjectSet) GetObj(gvk *GroupVersionKind) (Object, bool)

func (*ObjectSet) IsExists

func (os *ObjectSet) IsExists(gvk *GroupVersionKind) bool

func (*ObjectSet) NewObj

func (os *ObjectSet) NewObj(gvk string) (Object, bool)

NewObj creates a new object, trigger OnCreate function

func (*ObjectSet) NewObjWithGVK

func (os *ObjectSet) NewObjWithGVK(gvk *GroupVersionKind) (Object, bool)

NewObjWithGVK creates a new object, trigger OnCreate function

type Schema

type Schema interface {
	FindPage(ctx context.Context, page, size int32) ([]Object, int64, error)
	FindAll(ctx context.Context) ([]Object, error)
	FindPureAll(ctx context.Context) ([]Object, error)
	Count(ctx context.Context) (total int64, err error)
	FindOne(ctx context.Context) (Object, error)
	FindPureOne(ctx context.Context) (Object, error)
	Cond(exprs ...clause.Expression) Schema
	Create(ctx context.Context) (Object, error)
	BatchUpdates(ctx context.Context) error
	Updates(ctx context.Context) (Object, error)
	BatchDelete(ctx context.Context, soft bool) error
	Delete(ctx context.Context, soft bool) error
	Tx(ctx context.Context) *dao.DB
}

func NewSchema

func NewSchema(in Object) (Schema, bool)

type SchemaSet

type SchemaSet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSchemaSet

func NewSchemaSet() *SchemaSet

func (*SchemaSet) NewSchema

func (s *SchemaSet) NewSchema(in Object) (Schema, bool)

func (*SchemaSet) RegistrySchema

func (s *SchemaSet) RegistrySchema(g *GroupVersionKind, fn func(Object) Schema)

Jump to

Keyboard shortcuts

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