Golang中的奇怪类型定义语法(name,then type,then string litera
发布时间:2020-12-16 19:16:49 所属栏目:大数据 来源:网络整理
导读:我一直在试图找出如何使用mgo(MongoDB驱动程序Go),我遇到了这个struct声明: type Something struct { Id bson.ObjectId "_id,omitempty" Name string} 我不太了解第一个元素(Id)的语法。我知道它被声明为类型bson.ObjectId,但是在那里的字符串文字是什么
我一直在试图找出如何使用mgo(MongoDB驱动程序Go),我遇到了这个struct声明:
type Something struct { Id bson.ObjectId "_id,omitempty" Name string } 我不太了解第一个元素(Id)的语法。我知道它被声明为类型bson.ObjectId,但是在那里的字符串文字是什么? 我的问题不在于mgo驱动程序的功能, 我在Go规格上找不到任何东西,我也不知道如何google这个。
这在
language specification的
Struct types部分解释:
// A struct corresponding to the TimeStamp protocol buffer. // The tag strings define the protocol buffer field numbers. struct { microsec uint64 "field 1" serverIP6 uint64 "field 2" process string "field 3" } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |