oldmodels

package
v0.3.9-2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	CONTACT_INIT      = "init"      // Contact's status is init which means no verifying
	CONTACT_VERIFYING = "verifying" // Contact's status is verifying
	CONTACT_VERIFIED  = "verified"  // Contact's status is verified
)
View Source
const (
	TEMPLATE_TYPE_TITLE   = "title"
	TEMPLATE_TYPE_CONTENT = "content"
	TEMPLATE_TYPE_REMOTE  = "remote"
	CONTACTTYPE_ALL       = "all"
)

Variables

View Source
var (
	DefaultUUIDGenerator = stringutils.UUID4
)

Functions

func FetchById

func FetchById(manager db.IModelManager, idStr string) (db.IModel, error)

func RegistUserCredCacheUpdater

func RegistUserCredCacheUpdater()

Types

type IResourceBaseModel

type IResourceBaseModel interface {
	db.IModel
	GetIResourceBaseModel() IResourceBaseModel
	SetDeleteBy(string)
}

type SConfig

type SConfig struct {
	SStatusStandaloneResourceBase

	Type      string `width:"15" nullable:"false" create:"required" list:"user"`
	KeyText   string `width:"30" nullable:"false" create:"required" list:"user"`
	ValueText string `width:"256" nullable:"false" create:"required" list:"user"`
}

SConfig is a table which storage (k,v) and its type. The three important concepts are key, value and type. Key and type uniquely identify a value.

type SConfigManager

type SConfigManager struct {
	SStatusStandaloneResourceBaseManager
}
var ConfigManager *SConfigManager

type SContact

type SContact struct {
	SStatusStandaloneResourceBase

	UID         string    `width:"128" nullable:"false" create:"required" update:"user" list:"user" get:"user"`
	ContactType string    `width:"16" nullable:"false" create:"required" update:"user"`
	Contact     string    `width:"64" nullable:"false" create:"required" update:"user"`
	Enabled     string    `width:"5" nullable:"false" default:"1" create:"optional" update:"user"`
	VerifiedAt  time.Time `update:"user"`
}

type SContactManager

type SContactManager struct {
	SStatusStandaloneResourceBaseManager
}
var ContactManager *SContactManager

type SNotification

type SNotification struct {
	SStatusStandaloneResourceBase

	UID         string    `width:"128" nullable:"false" create:"required"`
	ContactType string    `width:"16" nullable:"false" create:"required" list:"user" index:"true"`
	Topic       string    `width:"128" nullable:"true" create:"optional" list:"user"`
	Priority    string    `width:"16" nullable:"true" create:"optional" list:"user"`
	Msg         string    `create:"required"`
	ReceivedAt  time.Time `nullable:"true" list:"user" create:"optional"`
	SendAt      time.Time `nullable:"false"`
	SendBy      string    `width:"128" nullable:"false"`
	// ClusterID identify message with same topic, msg, priority
	ClusterID string `width:"128" charset:"ascii" primary:"true" create:"optional" list:"user" get:"user"`
}

type SNotificationManager

type SNotificationManager struct {
	SStatusStandaloneResourceBaseManager
}
var NotificationManager *SNotificationManager

type SResourceBase

type SResourceBase struct {
	db.SResourceBase

	CreateBy string `width:"128" charset:"ascii" nullable:"true" create:"optional"`
	UpdateBy string `width:"128" charset:"ascii" nullable:"true" update:"user"`
	DeleteBy string `width:"128" charset:"ascii" nullable:"true"`

	Remark jsonutils.JSONObject `get:"user"`
}

func (*SResourceBase) Delete

func (self *SResourceBase) Delete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SResourceBase) GetIResourceBaseModel

func (self *SResourceBase) GetIResourceBaseModel() IResourceBaseModel

func (*SResourceBase) PreUpdate

func (self *SResourceBase) PreUpdate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject)

func (*SResourceBase) SetDeleteBy

func (self *SResourceBase) SetDeleteBy(uid string)

type SResourceBaseManager

type SResourceBaseManager struct {
	db.SResourceBaseManager
}

func NewResourceBaseManager

func NewResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SResourceBaseManager

func (*SResourceBaseManager) ValidateCreateData

type SStandaloneResourceBase

type SStandaloneResourceBase struct {
	SResourceBase

	ID string `width:"128" charset:"ascii" primary:"true" create:"optional"`
}

func (*SStandaloneResourceBase) BeforeInsert

func (model *SStandaloneResourceBase) BeforeInsert()

func (*SStandaloneResourceBase) GetIStandaloneModel

func (model *SStandaloneResourceBase) GetIStandaloneModel() db.IStandaloneModel

func (*SStandaloneResourceBase) GetId

func (model *SStandaloneResourceBase) GetId() string

func (*SStandaloneResourceBase) StandaloneModelManager

func (model *SStandaloneResourceBase) StandaloneModelManager() db.IStandaloneModelManager

type SStandaloneResourceBaseManager

type SStandaloneResourceBaseManager struct {
	SResourceBaseManager
}

func NewStandaloneResourceBaseManager

func NewStandaloneResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SStandaloneResourceBaseManager

func (*SStandaloneResourceBaseManager) FetchById

func (manager *SStandaloneResourceBaseManager) FetchById(idStr string) (db.IModel, error)

func (*SStandaloneResourceBaseManager) FilterById

func (manager *SStandaloneResourceBaseManager) FilterById(q *sqlchemy.SQuery, idStr string) *sqlchemy.SQuery

func (*SStandaloneResourceBaseManager) FilterByNotId

func (manager *SStandaloneResourceBaseManager) FilterByNotId(q *sqlchemy.SQuery, idStr string) *sqlchemy.SQuery

func (*SStandaloneResourceBaseManager) GetIStandaloneModelManager

func (manager *SStandaloneResourceBaseManager) GetIStandaloneModelManager() db.IStandaloneModelManager

type SStatusStandaloneResourceBase

type SStatusStandaloneResourceBase struct {
	SStandaloneResourceBase

	Status string `width:"36" charset:"ascii" nullable:"false" default:"init" create:"optional" update:"user"`
}

func (*SStatusStandaloneResourceBase) GetDetailsStatus

func (*SStatusStandaloneResourceBase) IsInStatus

func (model *SStatusStandaloneResourceBase) IsInStatus(status ...string) bool

func (*SStatusStandaloneResourceBase) PerformStatus

func (*SStatusStandaloneResourceBase) SetStatus

func (model *SStatusStandaloneResourceBase) SetStatus(userCred mcclient.TokenCredential, status string, reason string) error

type SStatusStandaloneResourceBaseManager

type SStatusStandaloneResourceBaseManager struct {
	SStandaloneResourceBaseManager
}

func NewStatusStandaloneResourceBaseManager

func NewStatusStandaloneResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SStatusStandaloneResourceBaseManager

type STemplate

type STemplate struct {
	SStandaloneResourceBase

	ContactType string `width:"16" nullable:"false" create:"required" update:"user" list:"user"`
	Topic       string `width:"20" nullable:"false" create:"required" update:"user" list:"user"`

	// title | content | remote
	TemplateType string `width:"10" nullable:"false" create:"required" update:"user" list:"user"`
	Content      string `length:"text" nullable:"false" create:"required" get:"user" list:"user" update:"user"`
}

type STemplateManager

type STemplateManager struct {
	SStandaloneResourceBaseManager
}
var TemplateManager *STemplateManager

type SUser

type SUser struct {
	db.SUser
}

func (*SUser) Delete

func (u *SUser) Delete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SUser) GetModelManager

func (user *SUser) GetModelManager() db.IModelManager

type SUserCacheManager

type SUserCacheManager struct {
	db.SUserCacheManager
}
var UserCacheManager *SUserCacheManager

func (*SUserCacheManager) FetchUserByIDOrName

func (ucm *SUserCacheManager) FetchUserByIDOrName(ctx context.Context, idStr string) (*SUser, error)

func (*SUserCacheManager) FetchUserFromLoaclCache

func (ucm *SUserCacheManager) FetchUserFromLoaclCache(ctx context.Context, q *sqlchemy.SQuery) ([]SUser, error)

func (*SUserCacheManager) FetchUserLikeName

func (ucm *SUserCacheManager) FetchUserLikeName(ctx context.Context, name string, noExpireCheck bool) ([]SUser,
	error)

func (*SUserCacheManager) FetchUsersByIDs

func (ucm *SUserCacheManager) FetchUsersByIDs(ctx context.Context, ids []string) (map[string]SUser, error)

type UUIDGenerator

type UUIDGenerator func() string

Jump to

Keyboard shortcuts

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