hack/pin-dependency.sh github.com/go-openapi/validate v0.19.5
This commit is contained in:
1
vendor/github.com/go-openapi/strfmt/.golangci.yml
generated
vendored
1
vendor/github.com/go-openapi/strfmt/.golangci.yml
generated
vendored
@@ -27,3 +27,4 @@ issues:
|
||||
text: "should be .*ObjectID"
|
||||
linters:
|
||||
- golint
|
||||
|
||||
|
15
vendor/github.com/go-openapi/strfmt/.travis.yml
generated
vendored
15
vendor/github.com/go-openapi/strfmt/.travis.yml
generated
vendored
@@ -1,20 +1,15 @@
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
go:
|
||||
- '1.9'
|
||||
- 1.10.x
|
||||
- 1.11.x
|
||||
- 1.12.x
|
||||
install:
|
||||
- go get -u github.com/stretchr/testify/assert
|
||||
- go get -u github.com/google/uuid
|
||||
- go get -u github.com/asaskevich/govalidator
|
||||
- go get -u github.com/mailru/easyjson
|
||||
- go get -u github.com/go-openapi/errors
|
||||
- go get -u github.com/mitchellh/mapstructure
|
||||
- go get -u github.com/globalsign/mgo/bson
|
||||
- GO111MODULE=off go get -u gotest.tools/gotestsum
|
||||
language: go
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
notifications:
|
||||
slack:
|
||||
secure: zE5AtIYTpYfQPnTzP+EaQPN7JKtfFAGv6PrJqoIZLOXa8B6zGb6+J1JRNNxWi7faWbyJOxa4FSSsuPsKZMycUK6wlLFIdhDxwqeo7Ew8r6rdZKdfUHQggfNS9wO79ARoNYUDHtmnaBUS+eWSM1YqSc4i99QxyyfuURLOeAaA/q14YbdlTlaw3lrZ0qT92ot1FnVGNOx064zuHtFeUf+jAVRMZ6Q3rvqllwIlPszE6rmHGXBt2VoJxRaBetdwd7FgkcYw9FPXKHhadwC7/75ZAdmxIukhxNMw4Tr5NuPcqNcnbYLenDP7B3lssGVIrP4BRSqekS1d/tqvdvnnFWHMwrNCkSnSc065G5+qWTlXKAemIclgiXXqE2furBNLm05MDdG8fn5epS0UNarkjD+zX336RiqwBlOX4KbF+vPyqcO98CsN0lnd+H6loc9reiTHs37orFFpQ+309av9be2GGsHUsRB9ssIyrewmhAccOmkRtr2dVTZJNFQwa5Kph5TNJuTjnZEwG/xUkEX2YSfwShOsb062JWiflV6PJdnl80pc9Tn7D5sO5Bf9DbijGRJwwP+YiiJtwtr+vsvS+n4sM0b5eqm4UoRo+JJO8ffoJtHS7ItuyRbVQCwEPJ4221WLcf5PquEEDdAPwR+K4Gj8qTXqTDdxOiES1xFUKVgmzhI=
|
||||
script:
|
||||
- ./hack/coverage
|
||||
- gotestsum -f short-verbose -- -race -coverprofile=coverage.txt -covermode=atomic ./...
|
||||
|
6
vendor/github.com/go-openapi/strfmt/BUILD
generated
vendored
6
vendor/github.com/go-openapi/strfmt/BUILD
generated
vendored
@@ -16,11 +16,11 @@ go_library(
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/asaskevich/govalidator:go_default_library",
|
||||
"//vendor/github.com/globalsign/mgo/bson:go_default_library",
|
||||
"//vendor/github.com/go-openapi/errors:go_default_library",
|
||||
"//vendor/github.com/mailru/easyjson/jlexer:go_default_library",
|
||||
"//vendor/github.com/mailru/easyjson/jwriter:go_default_library",
|
||||
"//vendor/github.com/mitchellh/mapstructure:go_default_library",
|
||||
"//vendor/go.mongodb.org/mongo-driver/bson:go_default_library",
|
||||
"//vendor/go.mongodb.org/mongo-driver/bson/bsontype:go_default_library",
|
||||
"//vendor/go.mongodb.org/mongo-driver/bson/primitive:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
121
vendor/github.com/go-openapi/strfmt/bson.go
generated
vendored
121
vendor/github.com/go-openapi/strfmt/bson.go
generated
vendored
@@ -16,12 +16,12 @@ package strfmt
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/globalsign/mgo/bson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/bsontype"
|
||||
bsonprim "go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -32,27 +32,45 @@ func init() {
|
||||
|
||||
// IsBSONObjectID returns true when the string is a valid BSON.ObjectId
|
||||
func IsBSONObjectID(str string) bool {
|
||||
return bson.IsObjectIdHex(str)
|
||||
_, err := bsonprim.ObjectIDFromHex(str)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// ObjectId represents a BSON object ID (alias to github.com/globalsign/mgo/bson.ObjectId)
|
||||
// ObjectId represents a BSON object ID (alias to go.mongodb.org/mongo-driver/bson/primitive.ObjectID)
|
||||
//
|
||||
// swagger:strfmt bsonobjectid
|
||||
type ObjectId bson.ObjectId
|
||||
type ObjectId bsonprim.ObjectID
|
||||
|
||||
// NewObjectId creates a ObjectId from a Hex String
|
||||
func NewObjectId(hex string) ObjectId {
|
||||
return ObjectId(bson.ObjectIdHex(hex))
|
||||
oid, err := bsonprim.ObjectIDFromHex(hex)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ObjectId(oid)
|
||||
}
|
||||
|
||||
// MarshalText turns this instance into text
|
||||
func (id *ObjectId) MarshalText() ([]byte, error) {
|
||||
return []byte(bson.ObjectId(*id).Hex()), nil
|
||||
func (id ObjectId) MarshalText() ([]byte, error) {
|
||||
oid := bsonprim.ObjectID(id)
|
||||
if oid == bsonprim.NilObjectID {
|
||||
return nil, nil
|
||||
}
|
||||
return []byte(oid.Hex()), nil
|
||||
}
|
||||
|
||||
// UnmarshalText hydrates this instance from text
|
||||
func (id *ObjectId) UnmarshalText(data []byte) error { // validation is performed later on
|
||||
*id = ObjectId(bson.ObjectIdHex(string(data)))
|
||||
if len(data) == 0 {
|
||||
*id = ObjectId(bsonprim.NilObjectID)
|
||||
return nil
|
||||
}
|
||||
oidstr := string(data)
|
||||
oid, err := bsonprim.ObjectIDFromHex(oidstr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*id = ObjectId(oid)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -72,58 +90,63 @@ func (id *ObjectId) Scan(raw interface{}) error {
|
||||
}
|
||||
|
||||
// Value converts a value to a database driver value
|
||||
func (id *ObjectId) Value() (driver.Value, error) {
|
||||
return driver.Value(string(*id)), nil
|
||||
func (id ObjectId) Value() (driver.Value, error) {
|
||||
return driver.Value(bsonprim.ObjectID(id).Hex()), nil
|
||||
}
|
||||
|
||||
func (id *ObjectId) String() string {
|
||||
return string(*id)
|
||||
func (id ObjectId) String() string {
|
||||
return bsonprim.ObjectID(id).String()
|
||||
}
|
||||
|
||||
// MarshalJSON returns the ObjectId as JSON
|
||||
func (id *ObjectId) MarshalJSON() ([]byte, error) {
|
||||
var w jwriter.Writer
|
||||
id.MarshalEasyJSON(&w)
|
||||
return w.BuildBytes()
|
||||
}
|
||||
|
||||
// MarshalEasyJSON writes the ObjectId to a easyjson.Writer
|
||||
func (id *ObjectId) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
w.String(bson.ObjectId(*id).Hex())
|
||||
func (id ObjectId) MarshalJSON() ([]byte, error) {
|
||||
return bsonprim.ObjectID(id).MarshalJSON()
|
||||
}
|
||||
|
||||
// UnmarshalJSON sets the ObjectId from JSON
|
||||
func (id *ObjectId) UnmarshalJSON(data []byte) error {
|
||||
l := jlexer.Lexer{Data: data}
|
||||
id.UnmarshalEasyJSON(&l)
|
||||
return l.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON sets the ObjectId from a easyjson.Lexer
|
||||
func (id *ObjectId) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
if data := in.String(); in.Ok() {
|
||||
*id = NewObjectId(data)
|
||||
}
|
||||
}
|
||||
|
||||
// GetBSON returns the hex representation of the ObjectId as a bson.M{} map.
|
||||
func (id *ObjectId) GetBSON() (interface{}, error) {
|
||||
return bson.M{"data": bson.ObjectId(*id).Hex()}, nil
|
||||
}
|
||||
|
||||
// SetBSON sets the ObjectId from raw bson data
|
||||
func (id *ObjectId) SetBSON(raw bson.Raw) error {
|
||||
var m bson.M
|
||||
if err := raw.Unmarshal(&m); err != nil {
|
||||
var obj bsonprim.ObjectID
|
||||
if err := obj.UnmarshalJSON(data); err != nil {
|
||||
return err
|
||||
}
|
||||
*id = ObjectId(obj)
|
||||
return nil
|
||||
}
|
||||
|
||||
if data, ok := m["data"].(string); ok {
|
||||
*id = NewObjectId(data)
|
||||
return nil
|
||||
// MarshalBSON renders the object id as a BSON document
|
||||
func (id ObjectId) MarshalBSON() ([]byte, error) {
|
||||
return bson.Marshal(bson.M{"data": bsonprim.ObjectID(id)})
|
||||
}
|
||||
|
||||
// UnmarshalBSON reads the objectId from a BSON document
|
||||
func (id *ObjectId) UnmarshalBSON(data []byte) error {
|
||||
var obj struct {
|
||||
Data bsonprim.ObjectID
|
||||
}
|
||||
if err := bson.Unmarshal(data, &obj); err != nil {
|
||||
return err
|
||||
}
|
||||
*id = ObjectId(obj.Data)
|
||||
return nil
|
||||
}
|
||||
|
||||
return errors.New("couldn't unmarshal bson raw value as ObjectId")
|
||||
// MarshalBSONValue is an interface implemented by types that can marshal themselves
|
||||
// into a BSON document represented as bytes. The bytes returned must be a valid
|
||||
// BSON document if the error is nil.
|
||||
func (id ObjectId) MarshalBSONValue() (bsontype.Type, []byte, error) {
|
||||
oid := bsonprim.ObjectID(id)
|
||||
return bsontype.ObjectID, oid[:], nil
|
||||
}
|
||||
|
||||
// UnmarshalBSONValue is an interface implemented by types that can unmarshal a
|
||||
// BSON value representation of themselves. The BSON bytes and type can be
|
||||
// assumed to be valid. UnmarshalBSONValue must copy the BSON value bytes if it
|
||||
// wishes to retain the data after returning.
|
||||
func (id *ObjectId) UnmarshalBSONValue(tpe bsontype.Type, data []byte) error {
|
||||
var oid bsonprim.ObjectID
|
||||
copy(oid[:], data)
|
||||
*id = ObjectId(oid)
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto copies the receiver and writes its value into out.
|
||||
|
54
vendor/github.com/go-openapi/strfmt/date.go
generated
vendored
54
vendor/github.com/go-openapi/strfmt/date.go
generated
vendored
@@ -16,13 +16,12 @@ package strfmt
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/globalsign/mgo/bson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -96,14 +95,7 @@ func (d Date) Value() (driver.Value, error) {
|
||||
|
||||
// MarshalJSON returns the Date as JSON
|
||||
func (d Date) MarshalJSON() ([]byte, error) {
|
||||
var w jwriter.Writer
|
||||
d.MarshalEasyJSON(&w)
|
||||
return w.BuildBytes()
|
||||
}
|
||||
|
||||
// MarshalEasyJSON writes the Date to a easyjson.Writer
|
||||
func (d Date) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
w.String(time.Time(d).Format(RFC3339FullDate))
|
||||
return json.Marshal(time.Time(d).Format(RFC3339FullDate))
|
||||
}
|
||||
|
||||
// UnmarshalJSON sets the Date from JSON
|
||||
@@ -111,42 +103,38 @@ func (d *Date) UnmarshalJSON(data []byte) error {
|
||||
if string(data) == jsonNull {
|
||||
return nil
|
||||
}
|
||||
l := jlexer.Lexer{Data: data}
|
||||
d.UnmarshalEasyJSON(&l)
|
||||
return l.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON sets the Date from a easyjson.Lexer
|
||||
func (d *Date) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
if data := in.String(); in.Ok() {
|
||||
tt, err := time.Parse(RFC3339FullDate, data)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
*d = Date(tt)
|
||||
var strdate string
|
||||
if err := json.Unmarshal(data, &strdate); err != nil {
|
||||
return err
|
||||
}
|
||||
tt, err := time.Parse(RFC3339FullDate, strdate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*d = Date(tt)
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetBSON returns the Date as a bson.M{} map.
|
||||
func (d *Date) GetBSON() (interface{}, error) {
|
||||
return bson.M{"data": d.String()}, nil
|
||||
func (d Date) MarshalBSON() ([]byte, error) {
|
||||
return bson.Marshal(bson.M{"data": d.String()})
|
||||
}
|
||||
|
||||
// SetBSON sets the Date from raw bson data
|
||||
func (d *Date) SetBSON(raw bson.Raw) error {
|
||||
func (d *Date) UnmarshalBSON(data []byte) error {
|
||||
var m bson.M
|
||||
if err := raw.Unmarshal(&m); err != nil {
|
||||
if err := bson.Unmarshal(data, &m); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if data, ok := m["data"].(string); ok {
|
||||
rd, err := time.Parse(RFC3339FullDate, data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*d = Date(rd)
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
return errors.New("couldn't unmarshal bson raw value as Date")
|
||||
return errors.New("couldn't unmarshal bson bytes value as Date")
|
||||
}
|
||||
|
||||
// DeepCopyInto copies the receiver and writes its value into out.
|
||||
|
915
vendor/github.com/go-openapi/strfmt/default.go
generated
vendored
915
vendor/github.com/go-openapi/strfmt/default.go
generated
vendored
File diff suppressed because it is too large
Load Diff
79
vendor/github.com/go-openapi/strfmt/duration.go
generated
vendored
79
vendor/github.com/go-openapi/strfmt/duration.go
generated
vendored
@@ -16,6 +16,7 @@ package strfmt
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
@@ -23,9 +24,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/globalsign/mgo/bson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -153,53 +152,47 @@ func (d Duration) String() string {
|
||||
|
||||
// MarshalJSON returns the Duration as JSON
|
||||
func (d Duration) MarshalJSON() ([]byte, error) {
|
||||
var w jwriter.Writer
|
||||
d.MarshalEasyJSON(&w)
|
||||
return w.BuildBytes()
|
||||
}
|
||||
|
||||
// MarshalEasyJSON writes the Duration to a easyjson.Writer
|
||||
func (d Duration) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
w.String(time.Duration(d).String())
|
||||
return json.Marshal(time.Duration(d).String())
|
||||
}
|
||||
|
||||
// UnmarshalJSON sets the Duration from JSON
|
||||
func (d *Duration) UnmarshalJSON(data []byte) error {
|
||||
l := jlexer.Lexer{Data: data}
|
||||
d.UnmarshalEasyJSON(&l)
|
||||
return l.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON sets the Duration from a easyjson.Lexer
|
||||
func (d *Duration) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
if data := in.String(); in.Ok() {
|
||||
tt, err := ParseDuration(data)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
*d = Duration(tt)
|
||||
}
|
||||
}
|
||||
|
||||
// GetBSON returns the Duration a bson.M{} map.
|
||||
func (d *Duration) GetBSON() (interface{}, error) {
|
||||
return bson.M{"data": int64(*d)}, nil
|
||||
}
|
||||
|
||||
// SetBSON sets the Duration from raw bson data
|
||||
func (d *Duration) SetBSON(raw bson.Raw) error {
|
||||
var m bson.M
|
||||
if err := raw.Unmarshal(&m); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if data, ok := m["data"].(int64); ok {
|
||||
*d = Duration(data)
|
||||
if string(data) == jsonNull {
|
||||
return nil
|
||||
}
|
||||
|
||||
return errors.New("couldn't unmarshal bson raw value as Duration")
|
||||
var dstr string
|
||||
if err := json.Unmarshal(data, &dstr); err != nil {
|
||||
return err
|
||||
}
|
||||
tt, err := ParseDuration(dstr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*d = Duration(tt)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d Duration) MarshalBSON() ([]byte, error) {
|
||||
return bson.Marshal(bson.M{"data": d.String()})
|
||||
}
|
||||
|
||||
func (d *Duration) UnmarshalBSON(data []byte) error {
|
||||
var m bson.M
|
||||
if err := bson.Unmarshal(data, &m); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if data, ok := m["data"].(string); ok {
|
||||
rd, err := ParseDuration(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*d = Duration(rd)
|
||||
return nil
|
||||
}
|
||||
|
||||
return errors.New("couldn't unmarshal bson bytes value as Date")
|
||||
}
|
||||
|
||||
// DeepCopyInto copies the receiver and writes its value into out.
|
||||
|
2
vendor/github.com/go-openapi/strfmt/format.go
generated
vendored
2
vendor/github.com/go-openapi/strfmt/format.go
generated
vendored
@@ -225,7 +225,7 @@ func (f *defaultFormats) DelByName(name string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// DelByType removes the specified format, returns true when an item was actually removed
|
||||
// DelByFormat removes the specified format, returns true when an item was actually removed
|
||||
func (f *defaultFormats) DelByFormat(strfmt Format) bool {
|
||||
f.Lock()
|
||||
defer f.Unlock()
|
||||
|
14
vendor/github.com/go-openapi/strfmt/go.mod
generated
vendored
14
vendor/github.com/go-openapi/strfmt/go.mod
generated
vendored
@@ -1,13 +1,13 @@
|
||||
module github.com/go-openapi/strfmt
|
||||
|
||||
require (
|
||||
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf
|
||||
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb
|
||||
github.com/go-openapi/errors v0.17.0
|
||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
|
||||
github.com/go-openapi/errors v0.19.2
|
||||
github.com/go-stack/stack v1.8.0 // indirect
|
||||
github.com/google/go-cmp v0.3.0 // indirect
|
||||
github.com/google/uuid v1.1.1
|
||||
github.com/kr/pretty v0.1.0 // indirect
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329
|
||||
github.com/mitchellh/mapstructure v1.1.2
|
||||
github.com/stretchr/testify v1.2.2
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
||||
github.com/stretchr/testify v1.3.0
|
||||
github.com/tidwall/pretty v1.0.0 // indirect
|
||||
go.mongodb.org/mongo-driver v1.0.3
|
||||
)
|
||||
|
34
vendor/github.com/go-openapi/strfmt/go.sum
generated
vendored
34
vendor/github.com/go-openapi/strfmt/go.sum
generated
vendored
@@ -1,25 +1,25 @@
|
||||
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf h1:eg0MeVzsP1G42dRafH3vf+al2vQIJU0YHX+1Tw87oco=
|
||||
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA=
|
||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb h1:D4uzjWwKYQ5XnAvUbuvHW93esHg7F8N/OYeBBcJoTr0=
|
||||
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
|
||||
github.com/go-openapi/errors v0.17.0 h1:g5DzIh94VpuR/dd6Ff8KqyHNnw7yBa2xSHIPPzjRDUo=
|
||||
github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0=
|
||||
github.com/go-openapi/errors v0.19.2 h1:a2kIyV3w+OS3S97zxUndRVD46+FhGOUBDFY7nmu4CsY=
|
||||
github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94=
|
||||
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
|
||||
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
go.mongodb.org/mongo-driver v1.0.3 h1:GKoji1ld3tw2aC+GX1wbr/J2fX13yNacEYoJ8Nhr0yU=
|
||||
go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
|
||||
|
67
vendor/github.com/go-openapi/strfmt/time.go
generated
vendored
67
vendor/github.com/go-openapi/strfmt/time.go
generated
vendored
@@ -16,15 +16,14 @@ package strfmt
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/globalsign/mgo/bson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -56,12 +55,14 @@ const (
|
||||
RFC3339Millis = "2006-01-02T15:04:05.000Z07:00"
|
||||
// RFC3339Micro represents a ISO8601 format to micro instead of to nano
|
||||
RFC3339Micro = "2006-01-02T15:04:05.000000Z07:00"
|
||||
// ISO8601LocalTime represents a ISO8601 format to ISO8601 in local time (no timezone)
|
||||
ISO8601LocalTime = "2006-01-02T15:04:05"
|
||||
// DateTimePattern pattern to match for the date-time format from http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
DateTimePattern = `^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}:[0-9]{2}))$`
|
||||
)
|
||||
|
||||
var (
|
||||
dateTimeFormats = []string{RFC3339Micro, RFC3339Millis, time.RFC3339, time.RFC3339Nano}
|
||||
dateTimeFormats = []string{RFC3339Micro, RFC3339Millis, time.RFC3339, time.RFC3339Nano, ISO8601LocalTime}
|
||||
rxDateTime = regexp.MustCompile(DateTimePattern)
|
||||
// MarshalFormat sets the time resolution format used for marshaling time (set to milliseconds)
|
||||
MarshalFormat = RFC3339Millis
|
||||
@@ -79,7 +80,6 @@ func ParseDateTime(data string) (DateTime, error) {
|
||||
lastError = err
|
||||
continue
|
||||
}
|
||||
lastError = nil
|
||||
return DateTime(dd), nil
|
||||
}
|
||||
return DateTime{}, lastError
|
||||
@@ -144,54 +144,47 @@ func (t DateTime) Value() (driver.Value, error) {
|
||||
|
||||
// MarshalJSON returns the DateTime as JSON
|
||||
func (t DateTime) MarshalJSON() ([]byte, error) {
|
||||
var w jwriter.Writer
|
||||
t.MarshalEasyJSON(&w)
|
||||
return w.BuildBytes()
|
||||
}
|
||||
|
||||
// MarshalEasyJSON writes the DateTime to a easyjson.Writer
|
||||
func (t DateTime) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
w.String(time.Time(t).Format(MarshalFormat))
|
||||
return json.Marshal(time.Time(t).Format(MarshalFormat))
|
||||
}
|
||||
|
||||
// UnmarshalJSON sets the DateTime from JSON
|
||||
func (t *DateTime) UnmarshalJSON(data []byte) error {
|
||||
l := jlexer.Lexer{Data: data}
|
||||
t.UnmarshalEasyJSON(&l)
|
||||
return l.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON sets the DateTime from a easyjson.Lexer
|
||||
func (t *DateTime) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
if data := in.String(); in.Ok() {
|
||||
tt, err := ParseDateTime(data)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
*t = tt
|
||||
if string(data) == jsonNull {
|
||||
return nil
|
||||
}
|
||||
|
||||
var tstr string
|
||||
if err := json.Unmarshal(data, &tstr); err != nil {
|
||||
return err
|
||||
}
|
||||
tt, err := ParseDateTime(tstr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*t = tt
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetBSON returns the DateTime as a bson.M{} map.
|
||||
func (t *DateTime) GetBSON() (interface{}, error) {
|
||||
return bson.M{"data": t.String()}, nil
|
||||
func (t DateTime) MarshalBSON() ([]byte, error) {
|
||||
return bson.Marshal(bson.M{"data": t.String()})
|
||||
}
|
||||
|
||||
// SetBSON sets the DateTime from raw bson data
|
||||
func (t *DateTime) SetBSON(raw bson.Raw) error {
|
||||
func (t *DateTime) UnmarshalBSON(data []byte) error {
|
||||
var m bson.M
|
||||
if err := raw.Unmarshal(&m); err != nil {
|
||||
if err := bson.Unmarshal(data, &m); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if data, ok := m["data"].(string); ok {
|
||||
var err error
|
||||
*t, err = ParseDateTime(data)
|
||||
return err
|
||||
rd, err := ParseDateTime(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*t = rd
|
||||
return nil
|
||||
}
|
||||
|
||||
return errors.New("couldn't unmarshal bson raw value as Duration")
|
||||
return errors.New("couldn't unmarshal bson bytes value as Date")
|
||||
}
|
||||
|
||||
// DeepCopyInto copies the receiver and writes its value into out.
|
||||
|
Reference in New Issue
Block a user