base

package
v0.0.0-...-6410feb Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MODEL_KEY_SEPARATOR    = "/"
	GLOBAL_MODEL_NAMESPACE = "models"
)

Variables

View Source
var (
	ErrNotJson = errors.New("Not a JSON")
)

Functions

This section is empty.

Types

type IEtcdModel

type IEtcdModel interface {
	lockman.ILockedObject

	GetModelManager() IEtcdModelManager
	SetModelManager(IEtcdModelManager, IEtcdModel)

	SetId(id string)

	GetExtraDetailsHeaders(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) map[string]string
}

type IEtcdModelManager

type IEtcdModelManager interface {
	lockman.ILockedClass

	KeywordPlural() string

	Allocate() IEtcdModel

	AllJson(ctx context.Context) ([]jsonutils.JSONObject, error)
	GetJson(ctx context.Context, idstr string) (jsonutils.JSONObject, error)
	Get(ctx context.Context, idstr string, model IEtcdModel) error
	All(ctx context.Context, dest interface{}) error
	Save(ctx context.Context, model IEtcdModel) error
	Delete(ctx context.Context, model IEtcdModel) error
	Session(ctx context.Context, model IEtcdModel) error
	Watch(ctx context.Context, onCreate etcd.TEtcdCreateEventFunc, onModify etcd.TEtcdModifyEventFunc, onDelete etcd.TEtcdDeleteEventFunc)

	CustomizeHandlerInfo(handler *appsrv.SHandlerInfo)
	FetchCreateHeaderData(ctx context.Context, header http.Header) (jsonutils.JSONObject, error)
	FetchUpdateHeaderData(ctx context.Context, header http.Header) (jsonutils.JSONObject, error)
}

type SEtcdBaseModel

type SEtcdBaseModel struct {
	object.SObject

	ID string
	// contains filtered or unexported fields
}

func (*SEtcdBaseModel) GetExtraDetailsHeaders

func (model *SEtcdBaseModel) GetExtraDetailsHeaders(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) map[string]string

func (*SEtcdBaseModel) GetId

func (model *SEtcdBaseModel) GetId() string

func (*SEtcdBaseModel) GetModelManager

func (model *SEtcdBaseModel) GetModelManager() IEtcdModelManager

func (*SEtcdBaseModel) Keyword

func (model *SEtcdBaseModel) Keyword() string

func (*SEtcdBaseModel) SetId

func (model *SEtcdBaseModel) SetId(id string)

func (*SEtcdBaseModel) SetModelManager

func (model *SEtcdBaseModel) SetModelManager(manager IEtcdModelManager, virtual IEtcdModel)

type SEtcdBaseModelManager

type SEtcdBaseModelManager struct {
	object.SObject
	// contains filtered or unexported fields
}

func NewEtcdBaseModelManager

func NewEtcdBaseModelManager(model IEtcdModel, keyword string, keywordPlural string) SEtcdBaseModelManager

func (*SEtcdBaseModelManager) All

func (manager *SEtcdBaseModelManager) All(ctx context.Context, dest interface{}) error

func (*SEtcdBaseModelManager) AllJson

func (manager *SEtcdBaseModelManager) AllJson(ctx context.Context) ([]jsonutils.JSONObject, error)

func (*SEtcdBaseModelManager) Allocate

func (manager *SEtcdBaseModelManager) Allocate() IEtcdModel

func (*SEtcdBaseModelManager) CustomizeHandlerInfo

func (manager *SEtcdBaseModelManager) CustomizeHandlerInfo(handler *appsrv.SHandlerInfo)

func (*SEtcdBaseModelManager) Delete

func (manager *SEtcdBaseModelManager) Delete(ctx context.Context, model IEtcdModel) error

func (*SEtcdBaseModelManager) FetchCreateHeaderData

func (manager *SEtcdBaseModelManager) FetchCreateHeaderData(ctx context.Context, header http.Header) (jsonutils.JSONObject, error)

func (*SEtcdBaseModelManager) FetchUpdateHeaderData

func (manager *SEtcdBaseModelManager) FetchUpdateHeaderData(ctx context.Context, header http.Header) (jsonutils.JSONObject, error)

func (*SEtcdBaseModelManager) Get

func (manager *SEtcdBaseModelManager) Get(ctx context.Context, idstr string, model IEtcdModel) error

func (*SEtcdBaseModelManager) GetJson

func (manager *SEtcdBaseModelManager) GetJson(ctx context.Context, idstr string) (jsonutils.JSONObject, error)

func (*SEtcdBaseModelManager) Keyword

func (manager *SEtcdBaseModelManager) Keyword() string

func (*SEtcdBaseModelManager) KeywordPlural

func (manager *SEtcdBaseModelManager) KeywordPlural() string

func (*SEtcdBaseModelManager) Save

func (manager *SEtcdBaseModelManager) Save(ctx context.Context, model IEtcdModel) error

func (*SEtcdBaseModelManager) Session

func (manager *SEtcdBaseModelManager) Session(ctx context.Context, model IEtcdModel) error

func (*SEtcdBaseModelManager) Watch

Jump to

Keyboard shortcuts

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