summaryrefslogtreecommitdiff
path: root/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/mongodb/mongo-tools-common/json/objectid.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/mongodb/mongo-tools-common/json/objectid.go')
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/mongodb/mongo-tools-common/json/objectid.go61
1 files changed, 0 insertions, 61 deletions
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/mongodb/mongo-tools-common/json/objectid.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/mongodb/mongo-tools-common/json/objectid.go
deleted file mode 100644
index f7d7a017a6d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/mongodb/mongo-tools-common/json/objectid.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (C) MongoDB, Inc. 2014-present.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-
-package json
-
-import (
- "fmt"
- "reflect"
-)
-
-// Transition functions for recognizing ObjectId.
-// Adapted from encoding/json/scanner.go.
-
-// stateO is the state after reading `O`.
-func stateO(s *scanner, c int) int {
- if c == 'b' {
- s.step = generateState("ObjectId", []byte("jectId"), stateConstructor)
- return scanContinue
- }
- return s.error(c, "in literal ObjectId (expecting 'b')")
-}
-
-// Decodes an ObjectId literal stored in the underlying byte data into v.
-func (d *decodeState) storeObjectId(v reflect.Value) {
- op := d.scanWhile(scanSkipSpace)
- if op != scanBeginCtor {
- d.error(fmt.Errorf("expected beginning of constructor"))
- }
-
- args, err := d.ctor("ObjectId", []reflect.Type{objectIdType})
- if err != nil {
- d.error(err)
- }
- switch kind := v.Kind(); kind {
- case reflect.Interface:
- v.Set(args[0])
- default:
- d.error(fmt.Errorf("cannot store %v value into %v type", objectIdType, kind))
- }
-}
-
-// Returns an ObjectId literal from the underlying byte data.
-func (d *decodeState) getObjectId() interface{} {
- op := d.scanWhile(scanSkipSpace)
- if op != scanBeginCtor {
- d.error(fmt.Errorf("expected beginning of constructor"))
- }
-
- args := d.ctorInterface()
- if err := ctorNumArgsMismatch("ObjectId", 1, len(args)); err != nil {
- d.error(err)
- }
- arg0, ok := args[0].(string)
- if !ok {
- d.error(fmt.Errorf("expected string for first argument of ObjectId constructor"))
- }
- return ObjectId(arg0)
-}