Fix CRD validation error for 'items' field

Signed-off-by: He Xiaoxi <xxhe@alauda.io>
This commit is contained in:
He Xiaoxi
2019-06-26 15:30:49 +08:00
parent 879f289ed7
commit 2e37a3bebe
108 changed files with 2356 additions and 1176 deletions

View File

@@ -4,16 +4,26 @@ linters-settings:
golint:
min-confidence: 0
gocyclo:
min-complexity: 25
min-complexity: 31
maligned:
suggest-new: true
dupl:
threshold: 100
goconst:
min-len: 2
min-occurrences: 2
min-occurrences: 4
linters:
enable-all: true
disable:
- maligned
- lll
- gochecknoinits
- gochecknoglobals
issues:
exclude-rules:
- path: bson.go
text: "should be .*ObjectID"
linters:
- golint

View File

@@ -6,7 +6,7 @@ go:
- 1.11.x
install:
- go get -u github.com/stretchr/testify/assert
- go get -u github.com/pborman/uuid
- 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

View File

@@ -10,7 +10,7 @@ This package exposes a registry of data types to support string formats in the g
strfmt represents a well known string format such as credit card or email. The go toolkit for OpenAPI specifications knows how to deal with those.
## Supported data formats
go-openapi/strfmt follows the swagger 2.0 specification with the following formats
go-openapi/strfmt follows the swagger 2.0 specification with the following formats
defined [here](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types).
It also provides convenient extensions to go-openapi users.
@@ -37,12 +37,13 @@ It also provides convenient extensions to go-openapi users.
- rgbcolor (e.g. "rgb(100,100,100)")
- ssn
- uuid, uuid3, uuid4, uuid5
- cidr (e.g. "192.0.2.1/24", "2001:db8:a0b:12f0::1/32")
> NOTE: as the name stands for, this package is intended to support string formatting only.
> It does not provide validation for numerical values with swagger format extension for JSON types "number" or
> NOTE: as the name stands for, this package is intended to support string formatting only.
> It does not provide validation for numerical values with swagger format extension for JSON types "number" or
> "integer" (e.g. float, double, int32...).
## Format types
## Format types
Types defined in strfmt expose marshaling and validation capabilities.
List of defined types:
@@ -56,6 +57,7 @@ List of defined types:
- Hostname
- IPv4
- IPv6
- CIDR
- ISBN
- ISBN10
- ISBN13

View File

@@ -125,3 +125,18 @@ func (id *ObjectId) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as ObjectId")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (id *ObjectId) DeepCopyInto(out *ObjectId) {
*out = *id
}
// DeepCopy copies the receiver into a new ObjectId.
func (id *ObjectId) DeepCopy() *ObjectId {
if id == nil {
return nil
}
out := new(ObjectId)
id.DeepCopyInto(out)
return out
}

View File

@@ -148,3 +148,18 @@ func (d *Date) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as Date")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (d *Date) DeepCopyInto(out *Date) {
*out = *d
}
// DeepCopy copies the receiver into a new Date.
func (d *Date) DeepCopy() *Date {
if d == nil {
return nil
}
out := new(Date)
d.DeepCopyInto(out)
return out
}

View File

@@ -19,6 +19,7 @@ import (
"encoding/base64"
"errors"
"fmt"
"net/mail"
"regexp"
"strings"
@@ -48,7 +49,15 @@ const (
// <subdomain> ::= <label> | <subdomain> "." <label>
// var subdomain = /^[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?(\.[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?)*$/;
// <domain> ::= <subdomain> | " "
HostnamePattern = `^[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?(\.[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?)*$`
//
// Additional validations:
// - for FDQNs, top-level domain (e.g. ".com"), is at least to letters long (no special characters here)
// - hostnames may start with a digit [RFC1123]
// - special registered names with an underscore ('_') are not allowed in this context
// - dashes are permitted, but not at the start or the end of a segment
// - long top-level domain names (e.g. example.london) are permitted
// - symbol unicode points are permitted (e.g. emoji) (not for top-level domain)
HostnamePattern = `^([a-zA-Z0-9\p{S}\p{L}]((-?[a-zA-Z0-9\p{S}\p{L}]{0,62})?)|([a-zA-Z0-9\p{S}\p{L}](([a-zA-Z0-9-\p{S}\p{L}]{0,61}[a-zA-Z0-9\p{S}\p{L}])?)(\.)){1,}([a-zA-Z\p{L}]){2,63})$`
// UUIDPattern Regex for UUID that allows uppercase
UUIDPattern = `(?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$`
// UUID3Pattern Regex for UUID3 that allows uppercase
@@ -111,6 +120,12 @@ func IsUUID5(str string) bool {
return rxUUID5.MatchString(str)
}
// IsEmail validates an email address.
func IsEmail(str string) bool {
addr, e := mail.ParseAddress(str)
return e == nil && addr.Address != ""
}
func init() {
// register formats in the default registry:
// - byte
@@ -120,6 +135,7 @@ func init() {
// - hostname
// - ipv4
// - ipv6
// - cidr
// - isbn
// - isbn10
// - isbn13
@@ -136,7 +152,7 @@ func init() {
Default.Add("uri", &u, govalidator.IsRequestURI)
eml := Email("")
Default.Add("email", &eml, govalidator.IsEmail)
Default.Add("email", &eml, IsEmail)
hn := Hostname("")
Default.Add("hostname", &hn, IsHostname)
@@ -147,6 +163,9 @@ func init() {
ip6 := IPv6("")
Default.Add("ipv6", &ip6, govalidator.IsIPv6)
cidr := CIDR("")
Default.Add("cidr", &cidr, govalidator.IsCIDR)
mac := MAC("")
Default.Add("mac", &mac, govalidator.IsMAC)
@@ -190,13 +209,7 @@ func init() {
Default.Add("password", &pw, func(_ string) bool { return true })
}
/* unused:
var formatCheckers = map[string]Validator{
"byte": govalidator.IsBase64,
}
*/
// Base64 represents a base64 encoded string
// Base64 represents a base64 encoded string, using URLEncoding alphabet
//
// swagger:strfmt byte
type Base64 []byte
@@ -302,6 +315,21 @@ func (b *Base64) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as Base64")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (b *Base64) DeepCopyInto(out *Base64) {
*out = *b
}
// DeepCopy copies the receiver into a new Base64.
func (b *Base64) DeepCopy() *Base64 {
if b == nil {
return nil
}
out := new(Base64)
b.DeepCopyInto(out)
return out
}
// URI represents the uri string format as specified by the json schema spec
//
// swagger:strfmt uri
@@ -387,6 +415,21 @@ func (u *URI) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as URI")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (u *URI) DeepCopyInto(out *URI) {
*out = *u
}
// DeepCopy copies the receiver into a new URI.
func (u *URI) DeepCopy() *URI {
if u == nil {
return nil
}
out := new(URI)
u.DeepCopyInto(out)
return out
}
// Email represents the email string format as specified by the json schema spec
//
// swagger:strfmt email
@@ -472,6 +515,21 @@ func (e *Email) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as Email")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (e *Email) DeepCopyInto(out *Email) {
*out = *e
}
// DeepCopy copies the receiver into a new Email.
func (e *Email) DeepCopy() *Email {
if e == nil {
return nil
}
out := new(Email)
e.DeepCopyInto(out)
return out
}
// Hostname represents the hostname string format as specified by the json schema spec
//
// swagger:strfmt hostname
@@ -557,6 +615,21 @@ func (h *Hostname) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as Hostname")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (h *Hostname) DeepCopyInto(out *Hostname) {
*out = *h
}
// DeepCopy copies the receiver into a new Hostname.
func (h *Hostname) DeepCopy() *Hostname {
if h == nil {
return nil
}
out := new(Hostname)
h.DeepCopyInto(out)
return out
}
// IPv4 represents an IP v4 address
//
// swagger:strfmt ipv4
@@ -642,6 +715,21 @@ func (u *IPv4) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as IPv4")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (u *IPv4) DeepCopyInto(out *IPv4) {
*out = *u
}
// DeepCopy copies the receiver into a new IPv4.
func (u *IPv4) DeepCopy() *IPv4 {
if u == nil {
return nil
}
out := new(IPv4)
u.DeepCopyInto(out)
return out
}
// IPv6 represents an IP v6 address
//
// swagger:strfmt ipv6
@@ -727,6 +815,121 @@ func (u *IPv6) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as IPv6")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (u *IPv6) DeepCopyInto(out *IPv6) {
*out = *u
}
// DeepCopy copies the receiver into a new IPv6.
func (u *IPv6) DeepCopy() *IPv6 {
if u == nil {
return nil
}
out := new(IPv6)
u.DeepCopyInto(out)
return out
}
// CIDR represents a Classless Inter-Domain Routing notation
//
// swagger:strfmt cidr
type CIDR string
// MarshalText turns this instance into text
func (u CIDR) MarshalText() ([]byte, error) {
return []byte(string(u)), nil
}
// UnmarshalText hydrates this instance from text
func (u *CIDR) UnmarshalText(data []byte) error { // validation is performed later on
*u = CIDR(string(data))
return nil
}
// Scan read a value from a database driver
func (u *CIDR) Scan(raw interface{}) error {
switch v := raw.(type) {
case []byte:
*u = CIDR(string(v))
case string:
*u = CIDR(v)
default:
return fmt.Errorf("cannot sql.Scan() strfmt.CIDR from: %#v", v)
}
return nil
}
// Value converts a value to a database driver value
func (u CIDR) Value() (driver.Value, error) {
return driver.Value(string(u)), nil
}
func (u CIDR) String() string {
return string(u)
}
// MarshalJSON returns the CIDR as JSON
func (u CIDR) MarshalJSON() ([]byte, error) {
var w jwriter.Writer
u.MarshalEasyJSON(&w)
return w.BuildBytes()
}
// MarshalEasyJSON writes the CIDR to a easyjson.Writer
func (u CIDR) MarshalEasyJSON(w *jwriter.Writer) {
w.String(string(u))
}
// UnmarshalJSON sets the CIDR from JSON
func (u *CIDR) UnmarshalJSON(data []byte) error {
l := jlexer.Lexer{Data: data}
u.UnmarshalEasyJSON(&l)
return l.Error()
}
// UnmarshalEasyJSON sets the CIDR from a easyjson.Lexer
func (u *CIDR) UnmarshalEasyJSON(in *jlexer.Lexer) {
if data := in.String(); in.Ok() {
*u = CIDR(data)
}
}
// GetBSON returns the CIDR as a bson.M{} map.
func (u *CIDR) GetBSON() (interface{}, error) {
return bson.M{"data": string(*u)}, nil
}
// SetBSON sets the CIDR from raw bson data
func (u *CIDR) SetBSON(raw bson.Raw) error {
var m bson.M
if err := raw.Unmarshal(&m); err != nil {
return err
}
if data, ok := m["data"].(string); ok {
*u = CIDR(data)
return nil
}
return errors.New("couldn't unmarshal bson raw value as CIDR")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (u *CIDR) DeepCopyInto(out *CIDR) {
*out = *u
}
// DeepCopy copies the receiver into a new CIDR.
func (u *CIDR) DeepCopy() *CIDR {
if u == nil {
return nil
}
out := new(CIDR)
u.DeepCopyInto(out)
return out
}
// MAC represents a 48 bit MAC address
//
// swagger:strfmt mac
@@ -812,6 +1015,21 @@ func (u *MAC) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as MAC")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (u *MAC) DeepCopyInto(out *MAC) {
*out = *u
}
// DeepCopy copies the receiver into a new MAC.
func (u *MAC) DeepCopy() *MAC {
if u == nil {
return nil
}
out := new(MAC)
u.DeepCopyInto(out)
return out
}
// UUID represents a uuid string format
//
// swagger:strfmt uuid
@@ -900,6 +1118,21 @@ func (u *UUID) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as UUID")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (u *UUID) DeepCopyInto(out *UUID) {
*out = *u
}
// DeepCopy copies the receiver into a new UUID.
func (u *UUID) DeepCopy() *UUID {
if u == nil {
return nil
}
out := new(UUID)
u.DeepCopyInto(out)
return out
}
// UUID3 represents a uuid3 string format
//
// swagger:strfmt uuid3
@@ -988,6 +1221,21 @@ func (u *UUID3) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as UUID3")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (u *UUID3) DeepCopyInto(out *UUID3) {
*out = *u
}
// DeepCopy copies the receiver into a new UUID3.
func (u *UUID3) DeepCopy() *UUID3 {
if u == nil {
return nil
}
out := new(UUID3)
u.DeepCopyInto(out)
return out
}
// UUID4 represents a uuid4 string format
//
// swagger:strfmt uuid4
@@ -1076,6 +1324,21 @@ func (u *UUID4) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as UUID4")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (u *UUID4) DeepCopyInto(out *UUID4) {
*out = *u
}
// DeepCopy copies the receiver into a new UUID4.
func (u *UUID4) DeepCopy() *UUID4 {
if u == nil {
return nil
}
out := new(UUID4)
u.DeepCopyInto(out)
return out
}
// UUID5 represents a uuid5 string format
//
// swagger:strfmt uuid5
@@ -1164,6 +1427,21 @@ func (u *UUID5) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as UUID5")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (u *UUID5) DeepCopyInto(out *UUID5) {
*out = *u
}
// DeepCopy copies the receiver into a new UUID5.
func (u *UUID5) DeepCopy() *UUID5 {
if u == nil {
return nil
}
out := new(UUID5)
u.DeepCopyInto(out)
return out
}
// ISBN represents an isbn string format
//
// swagger:strfmt isbn
@@ -1249,6 +1527,21 @@ func (u *ISBN) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as ISBN")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (u *ISBN) DeepCopyInto(out *ISBN) {
*out = *u
}
// DeepCopy copies the receiver into a new ISBN.
func (u *ISBN) DeepCopy() *ISBN {
if u == nil {
return nil
}
out := new(ISBN)
u.DeepCopyInto(out)
return out
}
// ISBN10 represents an isbn 10 string format
//
// swagger:strfmt isbn10
@@ -1334,6 +1627,21 @@ func (u *ISBN10) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as ISBN10")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (u *ISBN10) DeepCopyInto(out *ISBN10) {
*out = *u
}
// DeepCopy copies the receiver into a new ISBN10.
func (u *ISBN10) DeepCopy() *ISBN10 {
if u == nil {
return nil
}
out := new(ISBN10)
u.DeepCopyInto(out)
return out
}
// ISBN13 represents an isbn 13 string format
//
// swagger:strfmt isbn13
@@ -1419,6 +1727,21 @@ func (u *ISBN13) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as ISBN13")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (u *ISBN13) DeepCopyInto(out *ISBN13) {
*out = *u
}
// DeepCopy copies the receiver into a new ISBN13.
func (u *ISBN13) DeepCopy() *ISBN13 {
if u == nil {
return nil
}
out := new(ISBN13)
u.DeepCopyInto(out)
return out
}
// CreditCard represents a credit card string format
//
// swagger:strfmt creditcard
@@ -1504,6 +1827,21 @@ func (u *CreditCard) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as CreditCard")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (u *CreditCard) DeepCopyInto(out *CreditCard) {
*out = *u
}
// DeepCopy copies the receiver into a new CreditCard.
func (u *CreditCard) DeepCopy() *CreditCard {
if u == nil {
return nil
}
out := new(CreditCard)
u.DeepCopyInto(out)
return out
}
// SSN represents a social security string format
//
// swagger:strfmt ssn
@@ -1589,6 +1927,21 @@ func (u *SSN) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as SSN")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (u *SSN) DeepCopyInto(out *SSN) {
*out = *u
}
// DeepCopy copies the receiver into a new SSN.
func (u *SSN) DeepCopy() *SSN {
if u == nil {
return nil
}
out := new(SSN)
u.DeepCopyInto(out)
return out
}
// HexColor represents a hex color string format
//
// swagger:strfmt hexcolor
@@ -1674,6 +2027,21 @@ func (h *HexColor) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as HexColor")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (h *HexColor) DeepCopyInto(out *HexColor) {
*out = *h
}
// DeepCopy copies the receiver into a new HexColor.
func (h *HexColor) DeepCopy() *HexColor {
if h == nil {
return nil
}
out := new(HexColor)
h.DeepCopyInto(out)
return out
}
// RGBColor represents a RGB color string format
//
// swagger:strfmt rgbcolor
@@ -1759,6 +2127,21 @@ func (r *RGBColor) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as RGBColor")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (r *RGBColor) DeepCopyInto(out *RGBColor) {
*out = *r
}
// DeepCopy copies the receiver into a new RGBColor.
func (r *RGBColor) DeepCopy() *RGBColor {
if r == nil {
return nil
}
out := new(RGBColor)
r.DeepCopyInto(out)
return out
}
// Password represents a password.
// This has no validations and is mainly used as a marker for UI components.
//
@@ -1844,3 +2227,18 @@ func (r *Password) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as Password")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (r *Password) DeepCopyInto(out *Password) {
*out = *r
}
// DeepCopy copies the receiver into a new Password.
func (r *Password) DeepCopy() *Password {
if r == nil {
return nil
}
out := new(Password)
r.DeepCopyInto(out)
return out
}

View File

@@ -121,7 +121,7 @@ func ParseDuration(cand string) (time.Duration, error) {
if ok {
return dur, nil
}
return 0, fmt.Errorf("Unable to parse %s as duration", cand)
return 0, fmt.Errorf("unable to parse %s as duration", cand)
}
// Scan reads a Duration value from database driver type.
@@ -201,3 +201,18 @@ func (d *Duration) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as Duration")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (d *Duration) DeepCopyInto(out *Duration) {
*out = *d
}
// DeepCopy copies the receiver into a new Duration.
func (d *Duration) DeepCopy() *Duration {
if d == nil {
return nil
}
out := new(Duration)
d.DeepCopyInto(out)
return out
}

View File

@@ -16,6 +16,7 @@ package strfmt
import (
"encoding"
"fmt"
"reflect"
"strings"
"sync"
@@ -108,7 +109,11 @@ func (f *defaultFormats) MapStructureHookFunc() mapstructure.DecodeHookFunc {
}
return Date(d), nil
case "datetime":
return ParseDateTime(data.(string))
input := data.(string)
if len(input) == 0 {
return nil, fmt.Errorf("empty string is an invalid datetime format")
}
return ParseDateTime(input)
case "duration":
dur, err := ParseDuration(data.(string))
if err != nil {
@@ -133,6 +138,8 @@ func (f *defaultFormats) MapStructureHookFunc() mapstructure.DecodeHookFunc {
return IPv4(data.(string)), nil
case "ipv6":
return IPv6(data.(string)), nil
case "cidr":
return CIDR(data.(string)), nil
case "mac":
return MAC(data.(string)), nil
case "isbn":

View File

@@ -2,12 +2,12 @@ module github.com/go-openapi/strfmt
require (
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb
github.com/go-openapi/errors v0.17.0
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/pborman/uuid v1.2.0
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.2.2
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)

View File

@@ -4,16 +4,22 @@ 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:47T+LqPrQUxFXQnB22aLBfsTRFSqWp5y4OiFgQm+/Lw=
github.com/go-openapi/errors v0.17.0/go.mod h1:La0D2x9HoXenv7MDEiAv6vWoe84CXFo0PQRk/jdQlww=
github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
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/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/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
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=

View File

@@ -193,3 +193,18 @@ func (t *DateTime) SetBSON(raw bson.Raw) error {
return errors.New("couldn't unmarshal bson raw value as Duration")
}
// DeepCopyInto copies the receiver and writes its value into out.
func (t *DateTime) DeepCopyInto(out *DateTime) {
*out = *t
}
// DeepCopy copies the receiver into a new DateTime.
func (t *DateTime) DeepCopy() *DateTime {
if t == nil {
return nil
}
out := new(DateTime)
t.DeepCopyInto(out)
return out
}