Documentation ¶
Index ¶
- Constants
- Variables
- func Count(collName string, query map[string]interface{}) (int, error)
- func EnsureIndexes() error
- func FindAll(collName string, query, projection map[string]interface{}, sort []string, ...) error
- func FindAndModify(collName string, query, projection, change map[string]interface{}, ...) error
- func FindById(collName string, id interface{}, projection map[string]interface{}, ...) error
- func FindOne(collName string, query, projection map[string]interface{}, result interface{}) error
- func FindOrInsert(collName string, query map[string]interface{}, doc, result interface{}) (bool, error)
- func Insert(collName string, doc ...interface{}) error
- func List(collName string, query, projection map[string]interface{}, start, limit int, ...) error
- func RemoveAll(collName string, query map[string]interface{}) (int, error)
- func RemoveById(collName string, id interface{}) error
- func RemoveOne(collName string, query map[string]interface{}) error
- func SetStorage(stg *mgoutils.MgoPool)
- func UpdateAll(collName string, query, update map[string]interface{}) (int, error)
- func UpdateById(collName string, id interface{}, change map[string]interface{}) error
- func UpdateOne(collName string, query, update map[string]interface{}) error
- type Automation
- type AutomationAction
- type AutomationCondition
- type Brand
- type BrandAutorizationInfo
- type BrandBaseInfo
- type BrandPreExtend
- type ChannelInfo
- type Comment
- func (this *Comment) FindAll(query map[string]interface{}, sort []string) ([]*Comment, error)
- func (this *Comment) FindAndModify(query, change map[string]interface{}) error
- func (this *Comment) FindById(id interface{}) error
- func (this *Comment) FindOne(query map[string]interface{}) error
- func (this *Comment) Insert() error
- type ExtendField
- type File
- type Focus
- func (this *Focus) Count(query map[string]interface{}) (int, error)
- func (this *Focus) FindAndModify(query, change map[string]interface{}) error
- func (this *Focus) FindById(id interface{}) error
- func (this *Focus) Insert() error
- func (this *Focus) List(query map[string]interface{}, start, limit int, sort []string) ([]*Focus, error)
- func (this *Focus) UpdateById(id interface{}, change map[string]interface{}) error
- type Resource
- type Ticket
- func (this *Ticket) Count(query map[string]interface{}) (int, error)
- func (this *Ticket) FindAndModify(query, change map[string]interface{}) error
- func (this *Ticket) FindById(id interface{}) error
- func (this *Ticket) Insert() error
- func (this *Ticket) List(query map[string]interface{}, start, limit int, sort []string) ([]*Ticket, error)
- type TypePriority
- type TypeUserImportance
- type User
- func (this *User) Count(query map[string]interface{}) (int, error)
- func (this *User) FindAndModify(query, change map[string]interface{}) error
- func (this *User) FindById(id interface{}) error
- func (this *User) FindOne(query map[string]interface{}) error
- func (this *User) FindOrInsert(query map[string]interface{}, doc *User) (bool, error)
- func (this *User) Insert() error
- func (this *User) List(query map[string]interface{}, start, limit int, sort []string) ([]*User, error)
- type UserBaseInfo
- type UserBusinessInfo
- type UserLoginInfo
- type UserPersonalInfo
- type UserTip
Constants ¶
View Source
const ( CommentCollectionName = "comment" CommentTypeQuestion = "QUESTION" CommentTypePublic = "PUBLIC" CommentTypeFeedback = "FEEDBACK" CommentTypeInternal = "INTERNAL" )
View Source
const ( ExtendFieldInputTypeText = "TEXT" ExtendFieldInputTypeTextarea = "TEXTAREA" ExtendFieldInputTypeSelect = "SELECT" ExtendFieldInputTypeCheckbox = "CHECKBOX" )
View Source
const ( FocusCollectionName = "focus" FocusStatusPending = "PENDING" FocusStatusHandled = "HANDLED" )
View Source
const ( PriorityNon TypePriority = "" PriorityLow TypePriority = "1" PriorityNormal TypePriority = "2" PriorityHign TypePriority = "3" PriorityUrgent TypePriority = "4" PriorityNonStr = "" PriorityLowStr = "LOW" PriorityNormalStr = "NORMAL" PriorityHignStr = "HIGH" PriorityUrgentStr = "URGENT" )
View Source
const ( ResourceTypeTicket = "TICKET" ResourceTypeComment = "COMMENT" )
View Source
const ( TicketCollectionName = "ticket" TicketStatusPending = "PENDING" TicketStatusReplied = "REPLIED" TicketStatusResubmitted = "RESUBMITTED" TicketStatusSolved = "SOLVED" )
View Source
const ( UserImportanceNon TypeUserImportance = "0" UserImportanceNormal TypeUserImportance = "1" UserImportanceImportant TypeUserImportance = "2" UserImportanceVIP TypeUserImportance = "3" UserImportanceNonStr = "NON" UserImportanceNormalStr = "NORMAL" UserImportanceImportantStr = "IMPORTANT" UserImportanceVIPStr = "VIP" )
View Source
const (
AutomationCollectionName = "automation"
)
View Source
const (
BrandCollectionName = "brand"
)
View Source
const (
FileCollectionName = "file"
)
View Source
const (
UserCollectionName = "user"
)
Variables ¶
View Source
var ( Now = time.Now NewId = mgoutils.NewId IsEmptyId = mgoutils.IsEmptyObjectId )
View Source
var (
EmptyComment = &Comment{}
)
View Source
var (
EmptyFocus = &Focus{}
)
View Source
var (
EmptyTicket = &Ticket{}
)
View Source
var (
EmptyUser = &User{}
)
View Source
var ( MgoIndexes = map[string][]mgo.Index{ BrandCollectionName: []mgo.Index{ mgo.Index{ Key: []string{"on"}, Unique: true, }, }, UserCollectionName: []mgo.Index{ mgo.Index{ Key: []string{"channel.name", "channel.id"}, Unique: true, }, }, TicketCollectionName: []mgo.Index{ mgo.Index{ Key: []string{"channel.name", "channel.id"}, Unique: true, }, }, } )
Functions ¶
func EnsureIndexes ¶
func EnsureIndexes() error
func FindAndModify ¶
func FindOrInsert ¶
func RemoveById ¶
func SetStorage ¶
func UpdateById ¶
Types ¶
type Automation ¶
type Automation struct { Id bson.ObjectId `json:"id" bson:"_id"` Created int64 `json:"created" bson:"created"` Updated int64 `json:"updated" bson:"updated"` Priority int `json:"priority" bson:"priority"` Conditions map[bson.ObjectId][]*AutomationCondition `json:"conditions" bson:"conditions"` Actions []*AutomationAction `json:"actions" bson:"actions"` }
type AutomationAction ¶
type AutomationCondition ¶
type Brand ¶
type Brand struct { Id bson.ObjectId `json:"id" bson:"_id"` Created int64 `json:"created" bson:"created"` Updated int64 `json:"updated" bson:"updated"` Base BrandBaseInfo `json:"base" bson:"base"` Authorization BrandAutorizationInfo `json:"-" bson:"authorization"` PreExtend BrandPreExtend `json:"-" bson:"preExtend"` On bool `json:"-" bson:"on"` }
func (*Brand) FindAndModify ¶
type BrandAutorizationInfo ¶
type BrandAutorizationInfo struct {
APIKey string `json:"apiKey" bson:"apiKey"`
}
type BrandBaseInfo ¶
type BrandPreExtend ¶
type BrandPreExtend struct { Ticket []*ExtendField `json:"ticket" bson:"ticket"` Client []*ExtendField `json:"client" bson:"client"` }
type ChannelInfo ¶
type ChannelInfo struct { Name string `json:"name" bson:"name"` Id interface{} `json:"-" bson:"id"` }
type Comment ¶
type Comment struct { Id bson.ObjectId `json:"id" bson:"_id"` TicketId bson.ObjectId `json:"-" bson:"ticketId"` CreatorId bson.ObjectId `json:"-" bson:"creatorId"` Type string `json:"type" bson:"type"` Content string `json:"content" bson:"content"` Created int64 `json:"created" bson:"created"` Updated int64 `json:"updated" bson:"updated"` Attachments []*File `json:"attachmente" bson:"attachments"` }
func (*Comment) FindAndModify ¶
type ExtendField ¶
type ExtendField struct { Id bson.ObjectId `json:"id" bson:"_id"` Label string `json:"label" bson:"label"` Description string `json:"description" bson:"description"` Input string `json:"input" bson:"input"` Options []string `json:"options" bson:"options"` Created int64 `json:"created" bson:"created"` Updated int64 `json:"updated" bson:"updated"` }
func NewExtendField ¶
func NewExtendField() *ExtendField
type File ¶
type File struct { Id bson.ObjectId `json:"id" bson:"_id"` IsInternal bool `json:"isInternal" bson:"isInternal"` MimeType string `json:"mimeType" bson:"mimeType"` FileSize int64 `json:"fileSize" bson:"fileSize"` FileName string `json:"fileName" bson:"fileName"` FileKey string `json:"fileKey" bson:"fileKey"` Created int64 `json:"created" bson:"created"` }
type Focus ¶
type Focus struct { Id bson.ObjectId `json:"id" bson:"_id"` Type string `json:"type" bson:"type"` Status string `json:"status" bson:"status"` Priority TypePriority `json:"priority" bson:"priority"` Resource *Resource `json:"resource" bson:"resource"` Message string `json:"message" bson:"message"` Created int64 `json:"created" bson:"created"` Handled int64 `json:"handled" bson:"handled"` Deadline int64 `json:"deadline" bson:"deadline"` }
func (*Focus) FindAndModify ¶
func (*Focus) UpdateById ¶
type Resource ¶
type Ticket ¶
type Ticket struct { Id bson.ObjectId `json:"id" bson:"_id"` CreatorId bson.ObjectId `json:"-" bson:"creatorId"` Channel ChannelInfo `json:"channel" bson:"channel"` Subject string `json:"subject" bson:"subject"` IsPublic bool `json:"isPublic" bson:"isPublic"` Created int64 `json:"created" bson:"created"` Updated int64 `json:"updated" bson:"updated"` FirstCommented int64 `json:"firstCommented" bson:"firstCommented"` Priority TypePriority `json:"priority" bson:"priority"` Status string `json:"status" bson:"status"` Rank int `json:"rank" bson:"rank"` Extend map[string]string `json:"extend" bson:"extend"` }
func (*Ticket) FindAndModify ¶
type TypePriority ¶
type TypePriority string
func NewTypePriority ¶
func NewTypePriority(s string) TypePriority
func (*TypePriority) FromOutput ¶
func (this *TypePriority) FromOutput(s string)
func (TypePriority) MarshalJSON ¶
func (this TypePriority) MarshalJSON() ([]byte, error)
func (TypePriority) ToOutput ¶
func (this TypePriority) ToOutput() string
func (*TypePriority) UnmarshalJSON ¶
func (this *TypePriority) UnmarshalJSON(b []byte) error
type TypeUserImportance ¶
type TypeUserImportance string
func NewTypeUserImportance ¶
func NewTypeUserImportance(s string) TypeUserImportance
func (*TypeUserImportance) FromOutput ¶
func (this *TypeUserImportance) FromOutput(s string)
func (TypeUserImportance) MarshalJSON ¶
func (this TypeUserImportance) MarshalJSON() ([]byte, error)
func (TypeUserImportance) ToOutput ¶
func (this TypeUserImportance) ToOutput() string
func (*TypeUserImportance) UnmarshalJSON ¶
func (this *TypeUserImportance) UnmarshalJSON(b []byte) error
type User ¶
type User struct { Id bson.ObjectId `json:"id" bson:"_id"` Updated int64 `json:"updated" bson:"updated"` Created int64 `json:"created" bson:"created"` Login UserLoginInfo `json:"-" bson:"login"` Channel ChannelInfo `json:"-" bson:"channel"` Base UserBaseInfo `json:"-" bson:"base"` Personal UserPersonalInfo `json:"-" bson:"personal"` Business UserBusinessInfo `json:"-" bson:"business"` }
func NewUserWithChannel ¶
func NewUserWithChannel(channel ChannelInfo) *User
func (*User) FindAndModify ¶
func (*User) FindOrInsert ¶
type UserBaseInfo ¶
type UserBusinessInfo ¶
type UserBusinessInfo struct { Importance TypeUserImportance Tips []*UserTip }
type UserLoginInfo ¶
type UserLoginInfo struct {
Password string `json:"-" bson:"password"`
}
type UserPersonalInfo ¶
type UserPersonalInfo struct { Email string `json:"email" bson:"email"` EmailCertificated bool `json:"emailCertificated" bson:"emailCertificated"` Mobile string `json:"mobile" bson:"mobile"` MobileCertificated bool `json:"mobileCertificated" bson:"mobileCertificated"` Extend map[string]string `json:"extend" bson:"extend"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.