runtime

package
v1.3.5-beta Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEnt added in v0.22.6

func AddEnt(v ...Entity)

func RegisterRepo added in v0.22.6

func RegisterRepo(g *GroupVersionKind, fn func(Entity) Repo)

Types

type Entity added in v0.22.6

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

Entity is an interface that describes protocol message

func NewEntWithGVK added in v0.22.6

func NewEntWithGVK(gvk *GroupVersionKind) (Entity, bool)

NewEntWithGVK creates a new entity, trigger OnCreate function

func NewEntity added in v0.22.6

func NewEntity(gvk string) (Entity, bool)

NewEntity creates a new entity, trigger OnCreate function

type EntitySet added in v0.22.6

type EntitySet struct {
	sync.RWMutex

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

func NewEntitySet added in v0.22.6

func NewEntitySet() *EntitySet

func (*EntitySet) AddEnt added in v0.22.6

func (os *EntitySet) AddEnt(v ...Entity)

AddEnt push entities to Set

func (*EntitySet) GetEntity added in v0.22.6

func (os *EntitySet) GetEntity(gvk *GroupVersionKind) (Entity, bool)

func (*EntitySet) IsExists added in v0.22.6

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

func (*EntitySet) NewEntWithGVK added in v0.22.6

func (os *EntitySet) NewEntWithGVK(gvk *GroupVersionKind) (Entity, bool)

NewEntWithGVK creates a new entity, trigger OnCreate function

func (*EntitySet) NewEntity added in v0.22.6

func (os *EntitySet) NewEntity(gvk string) (Entity, bool)

NewEntity creates a new entity, trigger OnCreate function

type GroupVersionKind

type GroupVersionKind struct {
	Group   string
	Version string
	Kind    string
}

GroupVersionKind contains the information of Entity, 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 Repo added in v0.22.6

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

func NewRepo added in v0.22.6

func NewRepo(in Entity) (Repo, bool)

type RepoSet added in v0.22.6

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

func NewRepoSet added in v0.22.6

func NewRepoSet() *RepoSet

func (*RepoSet) NewRepo added in v0.22.6

func (s *RepoSet) NewRepo(in Entity) (Repo, bool)

func (*RepoSet) RegisterRepo added in v0.22.6

func (s *RepoSet) RegisterRepo(g *GroupVersionKind, fn func(Entity) Repo)

Jump to

Keyboard shortcuts

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