示例#1
0
func TestParseObjectId(t *testing.T) {
	for _, test := range parseObjectIdTests {
		actual := strings.ParseObjectId(test.input)
		if actual != test.expected {
			t.Errorf("expecting ParseObjectId(%v) to be %v, got %v", test.input, test.expected, actual)
		}
	}
}
示例#2
0
func (f Form) ParseObjectId(field string) bson.ObjectId {
	id := f.GetOne(field)
	return strings.ParseObjectId(id)
}