Documentation ¶
Index ¶
- Constants
- Variables
- func FetchById(manager db.IModelManager, idStr string) (db.IModel, error)
- func RegistUserCredCacheUpdater()
- type IResourceBaseModel
- type SConfig
- type SConfigManager
- type SContact
- type SContactManager
- type SNotification
- type SNotificationManager
- type SResourceBase
- func (self *SResourceBase) Delete(ctx context.Context, userCred mcclient.TokenCredential) error
- func (self *SResourceBase) GetIResourceBaseModel() IResourceBaseModel
- func (self *SResourceBase) PreUpdate(ctx context.Context, userCred mcclient.TokenCredential, ...)
- func (self *SResourceBase) SetDeleteBy(uid string)
- type SResourceBaseManager
- type SStandaloneResourceBase
- type SStandaloneResourceBaseManager
- func (manager *SStandaloneResourceBaseManager) FetchById(idStr string) (db.IModel, error)
- func (manager *SStandaloneResourceBaseManager) FilterById(q *sqlchemy.SQuery, idStr string) *sqlchemy.SQuery
- func (manager *SStandaloneResourceBaseManager) FilterByNotId(q *sqlchemy.SQuery, idStr string) *sqlchemy.SQuery
- func (manager *SStandaloneResourceBaseManager) GetIStandaloneModelManager() db.IStandaloneModelManager
- type SStatusStandaloneResourceBase
- func (model *SStatusStandaloneResourceBase) GetDetailsStatus(ctx context.Context, userCred mcclient.TokenCredential, ...) (jsonutils.JSONObject, error)
- func (model *SStatusStandaloneResourceBase) IsInStatus(status ...string) bool
- func (model *SStatusStandaloneResourceBase) PerformStatus(ctx context.Context, userCred mcclient.TokenCredential, ...) (jsonutils.JSONObject, error)
- func (model *SStatusStandaloneResourceBase) SetStatus(userCred mcclient.TokenCredential, status string, reason string) error
- type SStatusStandaloneResourceBaseManager
- type STemplate
- type STemplateManager
- type SUser
- type SUserCacheManager
- func (ucm *SUserCacheManager) FetchUserByIDOrName(ctx context.Context, idStr string) (*SUser, error)
- func (ucm *SUserCacheManager) FetchUserFromLoaclCache(ctx context.Context, q *sqlchemy.SQuery) ([]SUser, error)
- func (ucm *SUserCacheManager) FetchUserLikeName(ctx context.Context, name string, noExpireCheck bool) ([]SUser, error)
- func (ucm *SUserCacheManager) FetchUsersByIDs(ctx context.Context, ids []string) (map[string]SUser, error)
- type UUIDGenerator
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 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 ¶
func (self *SResourceBaseManager) ValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)
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 (*SStandaloneResourceBaseManager) FilterByNotId ¶
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 (model *SStatusStandaloneResourceBase) GetDetailsStatus(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (jsonutils.JSONObject, error)
func (*SStatusStandaloneResourceBase) IsInStatus ¶
func (model *SStatusStandaloneResourceBase) IsInStatus(status ...string) bool
func (*SStatusStandaloneResourceBase) PerformStatus ¶
func (model *SStatusStandaloneResourceBase) PerformStatus(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)
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 ¶
func (*SUser) GetModelManager ¶
func (user *SUser) GetModelManager() db.IModelManager
type SUserCacheManager ¶
type SUserCacheManager struct {
db.SUserCacheManager
}
var UserCacheManager *SUserCacheManager
func (*SUserCacheManager) FetchUserByIDOrName ¶
func (*SUserCacheManager) FetchUserFromLoaclCache ¶
func (*SUserCacheManager) FetchUserLikeName ¶
func (*SUserCacheManager) FetchUsersByIDs ¶
type UUIDGenerator ¶
type UUIDGenerator func() string
Click to show internal directories.
Click to hide internal directories.