当前位置: 首页>>代码示例>>Golang>>正文


Golang db.GetByQWithFields函数代码示例

本文整理汇总了Golang中github.com/leanote/leanote/app/db.GetByQWithFields函数的典型用法代码示例。如果您正苦于以下问题:Golang GetByQWithFields函数的具体用法?Golang GetByQWithFields怎么用?Golang GetByQWithFields使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetByQWithFields函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: GetNotebookId

// 通过noteId得到notebookId
// shareService call
// [ok]
func (this *NoteService) GetNotebookId(noteId string) bson.ObjectId {
	note := info.Note{}
	// db.Get(db.Notes, noteId, &note)
	// LogJ(note)
	db.GetByQWithFields(db.Notes, bson.M{"_id": bson.ObjectIdHex(noteId)}, []string{"NotebookId"}, &note)
	return note.NotebookId
}
开发者ID:ClaudeXin,项目名称:leanote,代码行数:10,代码来源:NoteService.go

示例2: GetThemePath

func (this *ThemeService) GetThemePath(userId, themeId string) string {
	theme := info.Theme{}
	db.GetByQWithFields(db.Themes, bson.M{"_id": bson.ObjectIdHex(themeId), "UserId": bson.ObjectIdHex(userId)}, []string{"Path"}, &theme)
	if theme.Path != "" {
		return theme.Path
	}
	return ""
}
开发者ID:ClaudeXin,项目名称:leanote,代码行数:8,代码来源:ThemeService.go

示例3: IncrUsn

// 自增Usn
// 每次notebook,note添加, 修改, 删除, 都要修改
func (this *UserService) IncrUsn(userId string) int {
	user := info.User{}
	query := bson.M{"_id": bson.ObjectIdHex(userId)}
	db.GetByQWithFields(db.Users, query, []string{"Usn"}, &user)
	usn := user.Usn
	usn += 1
	Log("inc Usn")
	db.UpdateByQField(db.Users, query, "Usn", usn)
	return usn
	//	return db.Update(db.Notes, bson.M{"_id": bson.ObjectIdHex(noteId)}, bson.M{"$inc": bson.M{"ReadNum": 1}})
}
开发者ID:rainkong,项目名称:leanote,代码行数:13,代码来源:UserService.go

示例4: IsBlog

// 判断是否是blog
func (this *NotebookService) IsBlog(notebookId string) bool {
	notebook := info.Notebook{}
	db.GetByQWithFields(db.Notebooks, bson.M{"_id": bson.ObjectIdHex(notebookId)}, []string{"IsBlog"}, &notebook)
	return notebook.IsBlog
}
开发者ID:sunyinhuiCoding,项目名称:leanote,代码行数:6,代码来源:NotebookService.go

示例5: GetUsername

// 得到用户名
func (this *UserService) GetUsername(userId string) string {
	user := info.User{}
	db.GetByQWithFields(db.Users, bson.M{"_id": bson.ObjectIdHex(userId)}, []string{"Username"}, &user)
	return user.Username
}
开发者ID:rainkong,项目名称:leanote,代码行数:6,代码来源:UserService.go

示例6: GetUsn

func (this *UserService) GetUsn(userId string) int {
	user := info.User{}
	query := bson.M{"_id": bson.ObjectIdHex(userId)}
	db.GetByQWithFields(db.Users, query, []string{"Usn"}, &user)
	return user.Usn
}
开发者ID:rainkong,项目名称:leanote,代码行数:6,代码来源:UserService.go


注:本文中的github.com/leanote/leanote/app/db.GetByQWithFields函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。