vendorify
diff --git a/go/vendor/github.com/go-openapi/strfmt/.editorconfig b/go/vendor/github.com/go-openapi/strfmt/.editorconfig
new file mode 100644
index 0000000..3152da6
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/.editorconfig
@@ -0,0 +1,26 @@
+# top-most EditorConfig file
+root = true
+
+# Unix-style newlines with a newline ending every file
+[*]
+end_of_line = lf
+insert_final_newline = true
+indent_style = space
+indent_size = 2
+trim_trailing_whitespace = true
+
+# Set default charset
+[*.{js,py,go,scala,rb,java,html,css,less,sass,md}]
+charset = utf-8
+
+# Tab indentation (no size specified)
+[*.go]
+indent_style = tab
+
+[*.md]
+trim_trailing_whitespace = false
+
+# Matches the exact files either package.json or .travis.yml
+[{package.json,.travis.yml}]
+indent_style = space
+indent_size = 2
diff --git a/go/vendor/github.com/go-openapi/strfmt/.gitignore b/go/vendor/github.com/go-openapi/strfmt/.gitignore
new file mode 100644
index 0000000..dd91ed6
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/.gitignore
@@ -0,0 +1,2 @@
+secrets.yml
+coverage.out
diff --git a/go/vendor/github.com/go-openapi/strfmt/.golangci.yml b/go/vendor/github.com/go-openapi/strfmt/.golangci.yml
new file mode 100644
index 0000000..4029779
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/.golangci.yml
@@ -0,0 +1,19 @@
+linters-settings:
+ govet:
+ check-shadowing: true
+ golint:
+ min-confidence: 0
+ gocyclo:
+ min-complexity: 25
+ maligned:
+ suggest-new: true
+ dupl:
+ threshold: 100
+ goconst:
+ min-len: 2
+ min-occurrences: 2
+
+linters:
+ enable-all: true
+ disable:
+ - maligned
diff --git a/go/vendor/github.com/go-openapi/strfmt/.travis.yml b/go/vendor/github.com/go-openapi/strfmt/.travis.yml
new file mode 100644
index 0000000..613ee97
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/.travis.yml
@@ -0,0 +1,20 @@
+after_success:
+- bash <(curl -s https://codecov.io/bash)
+go:
+- '1.9'
+- 1.10.x
+- 1.11.x
+install:
+- go get -u github.com/stretchr/testify/assert
+- go get -u github.com/pborman/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
+language: go
+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
diff --git a/go/vendor/github.com/go-openapi/strfmt/CODE_OF_CONDUCT.md b/go/vendor/github.com/go-openapi/strfmt/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..9322b06
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/CODE_OF_CONDUCT.md
@@ -0,0 +1,74 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of experience,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at ivan+abuse@flanders.co.nz. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/go/vendor/github.com/go-openapi/strfmt/LICENSE b/go/vendor/github.com/go-openapi/strfmt/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/go/vendor/github.com/go-openapi/strfmt/README.md b/go/vendor/github.com/go-openapi/strfmt/README.md
new file mode 100644
index 0000000..55f8804
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/README.md
@@ -0,0 +1,71 @@
+# Strfmt [![Build Status](https://travis-ci.org/go-openapi/strfmt.svg?branch=master)](https://travis-ci.org/go-openapi/strfmt) [![codecov](https://codecov.io/gh/go-openapi/strfmt/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/strfmt) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io)
+
+[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/strfmt/master/LICENSE)
+[![GoDoc](https://godoc.org/github.com/go-openapi/strfmt?status.svg)](http://godoc.org/github.com/go-openapi/strfmt)
+[![GolangCI](https://golangci.com/badges/github.com/go-openapi/strfmt.svg)](https://golangci.com)
+[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/strfmt)](https://goreportcard.com/report/github.com/go-openapi/strfmt)
+
+This package exposes a registry of data types to support string formats in the go-openapi toolkit.
+
+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
+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.
+
+- [x] JSON-schema draft 4 formats
+ - date-time
+ - email
+ - hostname
+ - ipv4
+ - ipv6
+ - uri
+- [x] swagger 2.0 format extensions
+ - binary
+ - byte (e.g. base64 encoded string)
+ - date (e.g. "1970-01-01")
+ - password
+- [x] go-openapi custom format extensions
+ - bsonobjectid (BSON objectID)
+ - creditcard
+ - duration (e.g. "3 weeks", "1ms")
+ - hexcolor (e.g. "#FFFFFF")
+ - isbn, isbn10, isbn13
+ - mac (e.g "01:02:03:04:05:06")
+ - rgbcolor (e.g. "rgb(100,100,100)")
+ - ssn
+ - uuid, uuid3, uuid4, uuid5
+
+> 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
+Types defined in strfmt expose marshaling and validation capabilities.
+
+List of defined types:
+- Base64
+- CreditCard
+- Date
+- DateTime
+- Duration
+- Email
+- HexColor
+- Hostname
+- IPv4
+- IPv6
+- ISBN
+- ISBN10
+- ISBN13
+- MAC
+- ObjectId
+- Password
+- RGBColor
+- SSN
+- URI
+- UUID
+- UUID3
+- UUID4
+- UUID5
diff --git a/go/vendor/github.com/go-openapi/strfmt/bson.go b/go/vendor/github.com/go-openapi/strfmt/bson.go
new file mode 100644
index 0000000..be8ae2d
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/bson.go
@@ -0,0 +1,127 @@
+// Copyright 2015 go-swagger maintainers
+//
+// 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
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package strfmt
+
+import (
+ "database/sql/driver"
+ "errors"
+ "fmt"
+
+ "github.com/globalsign/mgo/bson"
+ "github.com/mailru/easyjson/jlexer"
+ "github.com/mailru/easyjson/jwriter"
+)
+
+func init() {
+ var id ObjectId
+ // register this format in the default registry
+ Default.Add("bsonobjectid", &id, IsBSONObjectID)
+}
+
+// IsBSONObjectID returns true when the string is a valid BSON.ObjectId
+func IsBSONObjectID(str string) bool {
+ return bson.IsObjectIdHex(str)
+}
+
+// ObjectId represents a BSON object ID (alias to github.com/globalsign/mgo/bson.ObjectId)
+//
+// swagger:strfmt bsonobjectid
+type ObjectId bson.ObjectId
+
+// NewObjectId creates a ObjectId from a Hex String
+func NewObjectId(hex string) ObjectId {
+ return ObjectId(bson.ObjectIdHex(hex))
+}
+
+// MarshalText turns this instance into text
+func (id *ObjectId) MarshalText() ([]byte, error) {
+ return []byte(bson.ObjectId(*id).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)))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (id *ObjectId) Scan(raw interface{}) error {
+ var data []byte
+ switch v := raw.(type) {
+ case []byte:
+ data = v
+ case string:
+ data = []byte(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.URI from: %#v", v)
+ }
+
+ return id.UnmarshalText(data)
+}
+
+// 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) String() string {
+ return string(*id)
+}
+
+// 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())
+}
+
+// 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 {
+ return err
+ }
+
+ if data, ok := m["data"].(string); ok {
+ *id = NewObjectId(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as ObjectId")
+}
diff --git a/go/vendor/github.com/go-openapi/strfmt/date.go b/go/vendor/github.com/go-openapi/strfmt/date.go
new file mode 100644
index 0000000..ccdba44
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/date.go
@@ -0,0 +1,150 @@
+// Copyright 2015 go-swagger maintainers
+//
+// 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
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package strfmt
+
+import (
+ "database/sql/driver"
+ "errors"
+ "fmt"
+ "time"
+
+ "github.com/globalsign/mgo/bson"
+ "github.com/mailru/easyjson/jlexer"
+ "github.com/mailru/easyjson/jwriter"
+)
+
+func init() {
+ d := Date{}
+ // register this format in the default registry
+ Default.Add("date", &d, IsDate)
+}
+
+// IsDate returns true when the string is a valid date
+func IsDate(str string) bool {
+ _, err := time.Parse(RFC3339FullDate, str)
+ return err == nil
+}
+
+const (
+ // RFC3339FullDate represents a full-date as specified by RFC3339
+ // See: http://goo.gl/xXOvVd
+ RFC3339FullDate = "2006-01-02"
+)
+
+// Date represents a date from the API
+//
+// swagger:strfmt date
+type Date time.Time
+
+// String converts this date into a string
+func (d Date) String() string {
+ return time.Time(d).Format(RFC3339FullDate)
+}
+
+// UnmarshalText parses a text representation into a date type
+func (d *Date) UnmarshalText(text []byte) error {
+ if len(text) == 0 {
+ return nil
+ }
+ dd, err := time.Parse(RFC3339FullDate, string(text))
+ if err != nil {
+ return err
+ }
+ *d = Date(dd)
+ return nil
+}
+
+// MarshalText serializes this date type to string
+func (d Date) MarshalText() ([]byte, error) {
+ return []byte(d.String()), nil
+}
+
+// Scan scans a Date value from database driver type.
+func (d *Date) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ return d.UnmarshalText(v)
+ case string:
+ return d.UnmarshalText([]byte(v))
+ case time.Time:
+ *d = Date(v)
+ return nil
+ case nil:
+ *d = Date{}
+ return nil
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.Date from: %#v", v)
+ }
+}
+
+// Value converts Date to a primitive value ready to written to a database.
+func (d Date) Value() (driver.Value, error) {
+ return driver.Value(d.String()), nil
+}
+
+// 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))
+}
+
+// UnmarshalJSON sets the Date from JSON
+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)
+ }
+}
+
+// GetBSON returns the Date as a bson.M{} map.
+func (d *Date) GetBSON() (interface{}, error) {
+ return bson.M{"data": d.String()}, nil
+}
+
+// SetBSON sets the Date from raw bson data
+func (d *Date) 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 {
+ rd, err := time.Parse(RFC3339FullDate, data)
+ *d = Date(rd)
+ return err
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as Date")
+}
diff --git a/go/vendor/github.com/go-openapi/strfmt/default.go b/go/vendor/github.com/go-openapi/strfmt/default.go
new file mode 100644
index 0000000..13235ec
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/default.go
@@ -0,0 +1,1853 @@
+// Copyright 2015 go-swagger maintainers
+//
+// 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
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package strfmt
+
+import (
+ "database/sql/driver"
+ "encoding/base64"
+ "errors"
+ "fmt"
+ "net/mail"
+ "regexp"
+ "strings"
+
+ "github.com/asaskevich/govalidator"
+ "github.com/globalsign/mgo/bson"
+ "github.com/mailru/easyjson/jlexer"
+ "github.com/mailru/easyjson/jwriter"
+)
+
+const (
+ // HostnamePattern http://json-schema.org/latest/json-schema-validation.html#anchor114
+ // A string instance is valid against this attribute if it is a valid
+ // representation for an Internet host name, as defined by RFC 1034, section 3.1 [RFC1034].
+ // http://tools.ietf.org/html/rfc1034#section-3.5
+ // <digit> ::= any one of the ten digits 0 through 9
+ // var digit = /[0-9]/;
+ // <letter> ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case
+ // var letter = /[a-zA-Z]/;
+ // <let-dig> ::= <letter> | <digit>
+ // var letDig = /[0-9a-zA-Z]/;
+ // <let-dig-hyp> ::= <let-dig> | "-"
+ // var letDigHyp = /[-0-9a-zA-Z]/;
+ // <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
+ // var ldhStr = /[-0-9a-zA-Z]+/;
+ // <label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]
+ // var label = /[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?/;
+ // <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])?)*$`
+ // 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
+ UUID3Pattern = `(?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?3[0-9a-f]{3}-?[0-9a-f]{4}-?[0-9a-f]{12}$`
+ // UUID4Pattern Regex for UUID4 that allows uppercase
+ UUID4Pattern = `(?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$`
+ // UUID5Pattern Regex for UUID5 that allows uppercase
+ UUID5Pattern = `(?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?5[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$`
+ // json null type
+ jsonNull = "null"
+)
+
+var (
+ rxHostname = regexp.MustCompile(HostnamePattern)
+ rxUUID = regexp.MustCompile(UUIDPattern)
+ rxUUID3 = regexp.MustCompile(UUID3Pattern)
+ rxUUID4 = regexp.MustCompile(UUID4Pattern)
+ rxUUID5 = regexp.MustCompile(UUID5Pattern)
+)
+
+// IsHostname returns true when the string is a valid hostname
+func IsHostname(str string) bool {
+ if !rxHostname.MatchString(str) {
+ return false
+ }
+
+ // the sum of all label octets and label lengths is limited to 255.
+ if len(str) > 255 {
+ return false
+ }
+
+ // Each node has a label, which is zero to 63 octets in length
+ parts := strings.Split(str, ".")
+ valid := true
+ for _, p := range parts {
+ if len(p) > 63 {
+ valid = false
+ }
+ }
+ return valid
+}
+
+// IsUUID returns true is the string matches a UUID, upper case is allowed
+func IsUUID(str string) bool {
+ return rxUUID.MatchString(str)
+}
+
+// IsUUID3 returns true is the string matches a UUID, upper case is allowed
+func IsUUID3(str string) bool {
+ return rxUUID3.MatchString(str)
+}
+
+// IsUUID4 returns true is the string matches a UUID, upper case is allowed
+func IsUUID4(str string) bool {
+ return rxUUID4.MatchString(str)
+}
+
+// IsUUID5 returns true is the string matches a UUID, upper case is allowed
+func IsUUID5(str string) bool {
+ return rxUUID5.MatchString(str)
+}
+
+// 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
+ // - creditcard
+ // - email
+ // - hexcolor
+ // - hostname
+ // - ipv4
+ // - ipv6
+ // - isbn
+ // - isbn10
+ // - isbn13
+ // - mac
+ // - password
+ // - rgbcolor
+ // - ssn
+ // - uri
+ // - uuid
+ // - uuid3
+ // - uuid4
+ // - uuid5
+ u := URI("")
+ Default.Add("uri", &u, govalidator.IsRequestURI)
+
+ eml := Email("")
+ Default.Add("email", &eml, IsEmail)
+
+ hn := Hostname("")
+ Default.Add("hostname", &hn, IsHostname)
+
+ ip4 := IPv4("")
+ Default.Add("ipv4", &ip4, govalidator.IsIPv4)
+
+ ip6 := IPv6("")
+ Default.Add("ipv6", &ip6, govalidator.IsIPv6)
+
+ mac := MAC("")
+ Default.Add("mac", &mac, govalidator.IsMAC)
+
+ uid := UUID("")
+ Default.Add("uuid", &uid, IsUUID)
+
+ uid3 := UUID3("")
+ Default.Add("uuid3", &uid3, IsUUID3)
+
+ uid4 := UUID4("")
+ Default.Add("uuid4", &uid4, IsUUID4)
+
+ uid5 := UUID5("")
+ Default.Add("uuid5", &uid5, IsUUID5)
+
+ isbn := ISBN("")
+ Default.Add("isbn", &isbn, func(str string) bool { return govalidator.IsISBN10(str) || govalidator.IsISBN13(str) })
+
+ isbn10 := ISBN10("")
+ Default.Add("isbn10", &isbn10, govalidator.IsISBN10)
+
+ isbn13 := ISBN13("")
+ Default.Add("isbn13", &isbn13, govalidator.IsISBN13)
+
+ cc := CreditCard("")
+ Default.Add("creditcard", &cc, govalidator.IsCreditCard)
+
+ ssn := SSN("")
+ Default.Add("ssn", &ssn, govalidator.IsSSN)
+
+ hc := HexColor("")
+ Default.Add("hexcolor", &hc, govalidator.IsHexcolor)
+
+ rc := RGBColor("")
+ Default.Add("rgbcolor", &rc, govalidator.IsRGBcolor)
+
+ b64 := Base64([]byte(nil))
+ Default.Add("byte", &b64, govalidator.IsBase64)
+
+ pw := Password("")
+ Default.Add("password", &pw, func(_ string) bool { return true })
+}
+
+/* unused:
+var formatCheckers = map[string]Validator{
+ "byte": govalidator.IsBase64,
+}
+*/
+
+// Base64 represents a base64 encoded string
+//
+// swagger:strfmt byte
+type Base64 []byte
+
+// MarshalText turns this instance into text
+func (b Base64) MarshalText() ([]byte, error) {
+ enc := base64.URLEncoding
+ src := []byte(b)
+ buf := make([]byte, enc.EncodedLen(len(src)))
+ enc.Encode(buf, src)
+ return buf, nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (b *Base64) UnmarshalText(data []byte) error { // validation is performed later on
+ enc := base64.URLEncoding
+ dbuf := make([]byte, enc.DecodedLen(len(data)))
+
+ n, err := enc.Decode(dbuf, data)
+ if err != nil {
+ return err
+ }
+
+ *b = dbuf[:n]
+ return nil
+}
+
+// Scan read a value from a database driver
+func (b *Base64) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *b = Base64(string(v))
+ case string:
+ *b = Base64(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.Base64 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (b Base64) Value() (driver.Value, error) {
+ return driver.Value(string(b)), nil
+}
+
+func (b Base64) String() string {
+ return string(b)
+}
+
+// MarshalJSON returns the Base64 as JSON
+func (b Base64) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ b.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the Base64 to a easyjson.Writer
+func (b Base64) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(base64.StdEncoding.EncodeToString([]byte(b)))
+}
+
+// UnmarshalJSON sets the Base64 from JSON
+func (b *Base64) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ b.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the Base64 from a easyjson.Lexer
+func (b *Base64) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ enc := base64.StdEncoding
+ dbuf := make([]byte, enc.DecodedLen(len(data)))
+
+ n, err := enc.Decode(dbuf, []byte(data))
+ if err != nil {
+ in.AddError(err)
+ return
+ }
+
+ *b = dbuf[:n]
+ }
+}
+
+// GetBSON returns the Base64 as a bson.M{} map.
+func (b *Base64) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*b)}, nil
+}
+
+// SetBSON sets the Base64 from raw bson data
+func (b *Base64) 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 {
+ *b = Base64(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as Base64")
+}
+
+// URI represents the uri string format as specified by the json schema spec
+//
+// swagger:strfmt uri
+type URI string
+
+// MarshalText turns this instance into text
+func (u URI) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *URI) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = URI(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *URI) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = URI(string(v))
+ case string:
+ *u = URI(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.URI from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u URI) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u URI) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the URI as JSON
+func (u URI) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ u.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the URI to a easyjson.Writer
+func (u URI) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(u))
+}
+
+// UnmarshalJSON sets the URI from JSON
+func (u *URI) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ u.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the URI from a easyjson.Lexer
+func (u *URI) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *u = URI(data)
+ }
+}
+
+// GetBSON returns the URI as a bson.M{} map.
+func (u *URI) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*u)}, nil
+}
+
+// SetBSON sets the URI from raw bson data
+func (u *URI) 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 = URI(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as URI")
+}
+
+// Email represents the email string format as specified by the json schema spec
+//
+// swagger:strfmt email
+type Email string
+
+// MarshalText turns this instance into text
+func (e Email) MarshalText() ([]byte, error) {
+ return []byte(string(e)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (e *Email) UnmarshalText(data []byte) error { // validation is performed later on
+ *e = Email(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (e *Email) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *e = Email(string(v))
+ case string:
+ *e = Email(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.Email from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (e Email) Value() (driver.Value, error) {
+ return driver.Value(string(e)), nil
+}
+
+func (e Email) String() string {
+ return string(e)
+}
+
+// MarshalJSON returns the Email as JSON
+func (e Email) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ e.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the Email to a easyjson.Writer
+func (e Email) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(e))
+}
+
+// UnmarshalJSON sets the Email from JSON
+func (e *Email) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ e.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the Email from a easyjson.Lexer
+func (e *Email) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *e = Email(data)
+ }
+}
+
+// GetBSON returns the Email as a bson.M{} map.
+func (e *Email) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*e)}, nil
+}
+
+// SetBSON sets the Email from raw bson data
+func (e *Email) 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 {
+ *e = Email(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as Email")
+}
+
+// Hostname represents the hostname string format as specified by the json schema spec
+//
+// swagger:strfmt hostname
+type Hostname string
+
+// MarshalText turns this instance into text
+func (h Hostname) MarshalText() ([]byte, error) {
+ return []byte(string(h)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (h *Hostname) UnmarshalText(data []byte) error { // validation is performed later on
+ *h = Hostname(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (h *Hostname) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *h = Hostname(string(v))
+ case string:
+ *h = Hostname(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.Hostname from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (h Hostname) Value() (driver.Value, error) {
+ return driver.Value(string(h)), nil
+}
+
+func (h Hostname) String() string {
+ return string(h)
+}
+
+// MarshalJSON returns the Hostname as JSON
+func (h Hostname) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ h.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the Hostname to a easyjson.Writer
+func (h Hostname) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(h))
+}
+
+// UnmarshalJSON sets the Hostname from JSON
+func (h *Hostname) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ h.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the Hostname from a easyjson.Lexer
+func (h *Hostname) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *h = Hostname(data)
+ }
+}
+
+// GetBSON returns the Hostname as a bson.M{} map.
+func (h *Hostname) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*h)}, nil
+}
+
+// SetBSON sets the Hostname from raw bson data
+func (h *Hostname) 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 {
+ *h = Hostname(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as Hostname")
+}
+
+// IPv4 represents an IP v4 address
+//
+// swagger:strfmt ipv4
+type IPv4 string
+
+// MarshalText turns this instance into text
+func (u IPv4) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *IPv4) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = IPv4(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *IPv4) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = IPv4(string(v))
+ case string:
+ *u = IPv4(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.IPv4 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u IPv4) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u IPv4) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the IPv4 as JSON
+func (u IPv4) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ u.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the IPv4 to a easyjson.Writer
+func (u IPv4) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(u))
+}
+
+// UnmarshalJSON sets the IPv4 from JSON
+func (u *IPv4) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ u.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the IPv4 from a easyjson.Lexer
+func (u *IPv4) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *u = IPv4(data)
+ }
+}
+
+// GetBSON returns the IPv4 as a bson.M{} map.
+func (u *IPv4) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*u)}, nil
+}
+
+// SetBSON sets the IPv4 from raw bson data
+func (u *IPv4) 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 = IPv4(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as IPv4")
+}
+
+// IPv6 represents an IP v6 address
+//
+// swagger:strfmt ipv6
+type IPv6 string
+
+// MarshalText turns this instance into text
+func (u IPv6) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *IPv6) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = IPv6(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *IPv6) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = IPv6(string(v))
+ case string:
+ *u = IPv6(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.IPv6 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u IPv6) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u IPv6) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the IPv6 as JSON
+func (u IPv6) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ u.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the IPv6 to a easyjson.Writer
+func (u IPv6) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(u))
+}
+
+// UnmarshalJSON sets the IPv6 from JSON
+func (u *IPv6) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ u.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the IPv6 from a easyjson.Lexer
+func (u *IPv6) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *u = IPv6(data)
+ }
+}
+
+// GetBSON returns the IPv6 as a bson.M{} map.
+func (u *IPv6) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*u)}, nil
+}
+
+// SetBSON sets the IPv6 from raw bson data
+func (u *IPv6) 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 = IPv6(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as IPv6")
+}
+
+// MAC represents a 48 bit MAC address
+//
+// swagger:strfmt mac
+type MAC string
+
+// MarshalText turns this instance into text
+func (u MAC) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *MAC) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = MAC(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *MAC) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = MAC(string(v))
+ case string:
+ *u = MAC(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.IPv4 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u MAC) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u MAC) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the MAC as JSON
+func (u MAC) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ u.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the MAC to a easyjson.Writer
+func (u MAC) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(u))
+}
+
+// UnmarshalJSON sets the MAC from JSON
+func (u *MAC) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ u.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the MAC from a easyjson.Lexer
+func (u *MAC) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *u = MAC(data)
+ }
+}
+
+// GetBSON returns the MAC as a bson.M{} map.
+func (u *MAC) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*u)}, nil
+}
+
+// SetBSON sets the MAC from raw bson data
+func (u *MAC) 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 = MAC(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as MAC")
+}
+
+// UUID represents a uuid string format
+//
+// swagger:strfmt uuid
+type UUID string
+
+// MarshalText turns this instance into text
+func (u UUID) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *UUID) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = UUID(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *UUID) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = UUID(string(v))
+ case string:
+ *u = UUID(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.UUID from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u UUID) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u UUID) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the UUID as JSON
+func (u UUID) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ u.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the UUID to a easyjson.Writer
+func (u UUID) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(u))
+}
+
+// UnmarshalJSON sets the UUID from JSON
+func (u *UUID) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ l := jlexer.Lexer{Data: data}
+ u.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the UUID from a easyjson.Lexer
+func (u *UUID) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *u = UUID(data)
+ }
+}
+
+// GetBSON returns the UUID as a bson.M{} map.
+func (u *UUID) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*u)}, nil
+}
+
+// SetBSON sets the UUID from raw bson data
+func (u *UUID) 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 = UUID(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as UUID")
+}
+
+// UUID3 represents a uuid3 string format
+//
+// swagger:strfmt uuid3
+type UUID3 string
+
+// MarshalText turns this instance into text
+func (u UUID3) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *UUID3) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = UUID3(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *UUID3) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = UUID3(string(v))
+ case string:
+ *u = UUID3(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.UUID3 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u UUID3) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u UUID3) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the UUID3 as JSON
+func (u UUID3) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ u.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the UUID3 to a easyjson.Writer
+func (u UUID3) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(u))
+}
+
+// UnmarshalJSON sets the UUID3 from JSON
+func (u *UUID3) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ l := jlexer.Lexer{Data: data}
+ u.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the UUID3 from a easyjson.Lexer
+func (u *UUID3) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *u = UUID3(data)
+ }
+}
+
+// GetBSON returns the UUID3 as a bson.M{} map.
+func (u *UUID3) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*u)}, nil
+}
+
+// SetBSON sets the UUID3 from raw bson data
+func (u *UUID3) 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 = UUID3(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as UUID3")
+}
+
+// UUID4 represents a uuid4 string format
+//
+// swagger:strfmt uuid4
+type UUID4 string
+
+// MarshalText turns this instance into text
+func (u UUID4) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *UUID4) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = UUID4(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *UUID4) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = UUID4(string(v))
+ case string:
+ *u = UUID4(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.UUID4 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u UUID4) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u UUID4) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the UUID4 as JSON
+func (u UUID4) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ u.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the UUID4 to a easyjson.Writer
+func (u UUID4) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(u))
+}
+
+// UnmarshalJSON sets the UUID4 from JSON
+func (u *UUID4) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ l := jlexer.Lexer{Data: data}
+ u.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the UUID4 from a easyjson.Lexer
+func (u *UUID4) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *u = UUID4(data)
+ }
+}
+
+// GetBSON returns the UUID4 as a bson.M{} map.
+func (u *UUID4) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*u)}, nil
+}
+
+// SetBSON sets the UUID4 from raw bson data
+func (u *UUID4) 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 = UUID4(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as UUID4")
+}
+
+// UUID5 represents a uuid5 string format
+//
+// swagger:strfmt uuid5
+type UUID5 string
+
+// MarshalText turns this instance into text
+func (u UUID5) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *UUID5) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = UUID5(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *UUID5) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = UUID5(string(v))
+ case string:
+ *u = UUID5(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.UUID5 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u UUID5) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u UUID5) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the UUID5 as JSON
+func (u UUID5) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ u.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the UUID5 to a easyjson.Writer
+func (u UUID5) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(u))
+}
+
+// UnmarshalJSON sets the UUID5 from JSON
+func (u *UUID5) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
+ return nil
+ }
+ l := jlexer.Lexer{Data: data}
+ u.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the UUID5 from a easyjson.Lexer
+func (u *UUID5) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *u = UUID5(data)
+ }
+}
+
+// GetBSON returns the UUID5 as a bson.M{} map.
+func (u *UUID5) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*u)}, nil
+}
+
+// SetBSON sets the UUID5 from raw bson data
+func (u *UUID5) 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 = UUID5(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as UUID5")
+}
+
+// ISBN represents an isbn string format
+//
+// swagger:strfmt isbn
+type ISBN string
+
+// MarshalText turns this instance into text
+func (u ISBN) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *ISBN) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = ISBN(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *ISBN) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = ISBN(string(v))
+ case string:
+ *u = ISBN(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.ISBN from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u ISBN) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u ISBN) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the ISBN as JSON
+func (u ISBN) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ u.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the ISBN to a easyjson.Writer
+func (u ISBN) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(u))
+}
+
+// UnmarshalJSON sets the ISBN from JSON
+func (u *ISBN) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ u.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the ISBN from a easyjson.Lexer
+func (u *ISBN) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *u = ISBN(data)
+ }
+}
+
+// GetBSON returns the ISBN as a bson.M{} map.
+func (u *ISBN) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*u)}, nil
+}
+
+// SetBSON sets the ISBN from raw bson data
+func (u *ISBN) 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 = ISBN(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as ISBN")
+}
+
+// ISBN10 represents an isbn 10 string format
+//
+// swagger:strfmt isbn10
+type ISBN10 string
+
+// MarshalText turns this instance into text
+func (u ISBN10) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *ISBN10) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = ISBN10(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *ISBN10) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = ISBN10(string(v))
+ case string:
+ *u = ISBN10(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.ISBN10 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u ISBN10) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u ISBN10) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the ISBN10 as JSON
+func (u ISBN10) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ u.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the ISBN10 to a easyjson.Writer
+func (u ISBN10) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(u))
+}
+
+// UnmarshalJSON sets the ISBN10 from JSON
+func (u *ISBN10) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ u.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the ISBN10 from a easyjson.Lexer
+func (u *ISBN10) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *u = ISBN10(data)
+ }
+}
+
+// GetBSON returns the ISBN10 as a bson.M{} map.
+func (u *ISBN10) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*u)}, nil
+}
+
+// SetBSON sets the ISBN10 from raw bson data
+func (u *ISBN10) 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 = ISBN10(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as ISBN10")
+}
+
+// ISBN13 represents an isbn 13 string format
+//
+// swagger:strfmt isbn13
+type ISBN13 string
+
+// MarshalText turns this instance into text
+func (u ISBN13) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *ISBN13) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = ISBN13(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *ISBN13) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = ISBN13(string(v))
+ case string:
+ *u = ISBN13(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.ISBN13 from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u ISBN13) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u ISBN13) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the ISBN13 as JSON
+func (u ISBN13) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ u.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the ISBN13 to a easyjson.Writer
+func (u ISBN13) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(u))
+}
+
+// UnmarshalJSON sets the ISBN13 from JSON
+func (u *ISBN13) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ u.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the ISBN13 from a easyjson.Lexer
+func (u *ISBN13) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *u = ISBN13(data)
+ }
+}
+
+// GetBSON returns the ISBN13 as a bson.M{} map.
+func (u *ISBN13) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*u)}, nil
+}
+
+// SetBSON sets the ISBN13 from raw bson data
+func (u *ISBN13) 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 = ISBN13(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as ISBN13")
+}
+
+// CreditCard represents a credit card string format
+//
+// swagger:strfmt creditcard
+type CreditCard string
+
+// MarshalText turns this instance into text
+func (u CreditCard) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *CreditCard) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = CreditCard(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *CreditCard) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = CreditCard(string(v))
+ case string:
+ *u = CreditCard(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.CreditCard from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u CreditCard) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u CreditCard) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the CreditCard as JSON
+func (u CreditCard) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ u.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the CreditCard to a easyjson.Writer
+func (u CreditCard) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(u))
+}
+
+// UnmarshalJSON sets the CreditCard from JSON
+func (u *CreditCard) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ u.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the CreditCard from a easyjson.Lexer
+func (u *CreditCard) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *u = CreditCard(data)
+ }
+}
+
+// GetBSON returns the CreditCard as a bson.M{} map.
+func (u *CreditCard) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*u)}, nil
+}
+
+// SetBSON sets the CreditCard from raw bson data
+func (u *CreditCard) 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 = CreditCard(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as CreditCard")
+}
+
+// SSN represents a social security string format
+//
+// swagger:strfmt ssn
+type SSN string
+
+// MarshalText turns this instance into text
+func (u SSN) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *SSN) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = SSN(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *SSN) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = SSN(string(v))
+ case string:
+ *u = SSN(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.SSN from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u SSN) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u SSN) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the SSN as JSON
+func (u SSN) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ u.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the SSN to a easyjson.Writer
+func (u SSN) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(u))
+}
+
+// UnmarshalJSON sets the SSN from JSON
+func (u *SSN) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ u.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the SSN from a easyjson.Lexer
+func (u *SSN) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *u = SSN(data)
+ }
+}
+
+// GetBSON returns the SSN as a bson.M{} map.
+func (u *SSN) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*u)}, nil
+}
+
+// SetBSON sets the SSN from raw bson data
+func (u *SSN) 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 = SSN(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as SSN")
+}
+
+// HexColor represents a hex color string format
+//
+// swagger:strfmt hexcolor
+type HexColor string
+
+// MarshalText turns this instance into text
+func (h HexColor) MarshalText() ([]byte, error) {
+ return []byte(string(h)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (h *HexColor) UnmarshalText(data []byte) error { // validation is performed later on
+ *h = HexColor(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (h *HexColor) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *h = HexColor(string(v))
+ case string:
+ *h = HexColor(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.HexColor from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (h HexColor) Value() (driver.Value, error) {
+ return driver.Value(string(h)), nil
+}
+
+func (h HexColor) String() string {
+ return string(h)
+}
+
+// MarshalJSON returns the HexColor as JSON
+func (h HexColor) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ h.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the HexColor to a easyjson.Writer
+func (h HexColor) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(h))
+}
+
+// UnmarshalJSON sets the HexColor from JSON
+func (h *HexColor) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ h.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the HexColor from a easyjson.Lexer
+func (h *HexColor) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *h = HexColor(data)
+ }
+}
+
+// GetBSON returns the HexColor as a bson.M{} map.
+func (h *HexColor) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*h)}, nil
+}
+
+// SetBSON sets the HexColor from raw bson data
+func (h *HexColor) 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 {
+ *h = HexColor(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as HexColor")
+}
+
+// RGBColor represents a RGB color string format
+//
+// swagger:strfmt rgbcolor
+type RGBColor string
+
+// MarshalText turns this instance into text
+func (r RGBColor) MarshalText() ([]byte, error) {
+ return []byte(string(r)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (r *RGBColor) UnmarshalText(data []byte) error { // validation is performed later on
+ *r = RGBColor(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (r *RGBColor) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *r = RGBColor(string(v))
+ case string:
+ *r = RGBColor(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.RGBColor from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (r RGBColor) Value() (driver.Value, error) {
+ return driver.Value(string(r)), nil
+}
+
+func (r RGBColor) String() string {
+ return string(r)
+}
+
+// MarshalJSON returns the RGBColor as JSON
+func (r RGBColor) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ r.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the RGBColor to a easyjson.Writer
+func (r RGBColor) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(r))
+}
+
+// UnmarshalJSON sets the RGBColor from JSON
+func (r *RGBColor) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ r.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the RGBColor from a easyjson.Lexer
+func (r *RGBColor) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *r = RGBColor(data)
+ }
+}
+
+// GetBSON returns the RGBColor as a bson.M{} map.
+func (r *RGBColor) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*r)}, nil
+}
+
+// SetBSON sets the RGBColor from raw bson data
+func (r *RGBColor) 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 {
+ *r = RGBColor(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as RGBColor")
+}
+
+// Password represents a password.
+// This has no validations and is mainly used as a marker for UI components.
+//
+// swagger:strfmt password
+type Password string
+
+// MarshalText turns this instance into text
+func (r Password) MarshalText() ([]byte, error) {
+ return []byte(string(r)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (r *Password) UnmarshalText(data []byte) error { // validation is performed later on
+ *r = Password(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (r *Password) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ case []byte:
+ *r = Password(string(v))
+ case string:
+ *r = Password(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.Password from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (r Password) Value() (driver.Value, error) {
+ return driver.Value(string(r)), nil
+}
+
+func (r Password) String() string {
+ return string(r)
+}
+
+// MarshalJSON returns the Password as JSON
+func (r Password) MarshalJSON() ([]byte, error) {
+ var w jwriter.Writer
+ r.MarshalEasyJSON(&w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON writes the Password to a easyjson.Writer
+func (r Password) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(string(r))
+}
+
+// UnmarshalJSON sets the Password from JSON
+func (r *Password) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ r.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON sets the Password from a easyjson.Lexer
+func (r *Password) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if data := in.String(); in.Ok() {
+ *r = Password(data)
+ }
+}
+
+// GetBSON returns the Password as a bson.M{} map.
+func (r *Password) GetBSON() (interface{}, error) {
+ return bson.M{"data": string(*r)}, nil
+}
+
+// SetBSON sets the Password from raw bson data
+func (r *Password) 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 {
+ *r = Password(data)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as Password")
+}
diff --git a/go/vendor/github.com/go-openapi/strfmt/doc.go b/go/vendor/github.com/go-openapi/strfmt/doc.go
new file mode 100644
index 0000000..41aebe6
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/doc.go
@@ -0,0 +1,18 @@
+// Copyright 2015 go-swagger maintainers
+//
+// 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
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package strfmt contains custom string formats
+//
+// TODO: add info on how to define and register a custom format
+package strfmt
diff --git a/go/vendor/github.com/go-openapi/strfmt/duration.go b/go/vendor/github.com/go-openapi/strfmt/duration.go
new file mode 100644
index 0000000..28df8e4
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/duration.go
@@ -0,0 +1,203 @@
+// Copyright 2015 go-swagger maintainers
+//
+// 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
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package strfmt
+
+import (
+ "database/sql/driver"
+ "errors"
+ "fmt"
+ "regexp"
+ "strconv"
+ "strings"
+ "time"
+
+ "github.com/globalsign/mgo/bson"
+ "github.com/mailru/easyjson/jlexer"
+ "github.com/mailru/easyjson/jwriter"
+)
+
+func init() {
+ d := Duration(0)
+ // register this format in the default registry
+ Default.Add("duration", &d, IsDuration)
+}
+
+var (
+ timeUnits = [][]string{
+ {"ns", "nano"},
+ {"us", "µs", "micro"},
+ {"ms", "milli"},
+ {"s", "sec"},
+ {"m", "min"},
+ {"h", "hr", "hour"},
+ {"d", "day"},
+ {"w", "wk", "week"},
+ }
+
+ timeMultiplier = map[string]time.Duration{
+ "ns": time.Nanosecond,
+ "us": time.Microsecond,
+ "ms": time.Millisecond,
+ "s": time.Second,
+ "m": time.Minute,
+ "h": time.Hour,
+ "d": 24 * time.Hour,
+ "w": 7 * 24 * time.Hour,
+ }
+
+ durationMatcher = regexp.MustCompile(`((\d+)\s*([A-Za-zµ]+))`)
+)
+
+// IsDuration returns true if the provided string is a valid duration
+func IsDuration(str string) bool {
+ _, err := ParseDuration(str)
+ return err == nil
+}
+
+// Duration represents a duration
+//
+// Duration stores a period of time as a nanosecond count, with the largest
+// repesentable duration being approximately 290 years.
+//
+// swagger:strfmt duration
+type Duration time.Duration
+
+// MarshalText turns this instance into text
+func (d Duration) MarshalText() ([]byte, error) {
+ return []byte(time.Duration(d).String()), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (d *Duration) UnmarshalText(data []byte) error { // validation is performed later on
+ dd, err := ParseDuration(string(data))
+ if err != nil {
+ return err
+ }
+ *d = Duration(dd)
+ return nil
+}
+
+// ParseDuration parses a duration from a string, compatible with scala duration syntax
+func ParseDuration(cand string) (time.Duration, error) {
+ if dur, err := time.ParseDuration(cand); err == nil {
+ return dur, nil
+ }
+
+ var dur time.Duration
+ ok := false
+ for _, match := range durationMatcher.FindAllStringSubmatch(cand, -1) {
+
+ factor, err := strconv.Atoi(match[2]) // converts string to int
+ if err != nil {
+ return 0, err
+ }
+ unit := strings.ToLower(strings.TrimSpace(match[3]))
+
+ for _, variants := range timeUnits {
+ last := len(variants) - 1
+ multiplier := timeMultiplier[variants[0]]
+
+ for i, variant := range variants {
+ if (last == i && strings.HasPrefix(unit, variant)) || strings.EqualFold(variant, unit) {
+ ok = true
+ dur += (time.Duration(factor) * multiplier)
+ }
+ }
+ }
+ }
+
+ if ok {
+ return dur, nil
+ }
+ return 0, fmt.Errorf("Unable to parse %s as duration", cand)
+}
+
+// Scan reads a Duration value from database driver type.
+func (d *Duration) Scan(raw interface{}) error {
+ switch v := raw.(type) {
+ // TODO: case []byte: // ?
+ case int64:
+ *d = Duration(v)
+ case float64:
+ *d = Duration(int64(v))
+ case nil:
+ *d = Duration(0)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.Duration from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts Duration to a primitive value ready to be written to a database.
+func (d Duration) Value() (driver.Value, error) {
+ return driver.Value(int64(d)), nil
+}
+
+// String converts this duration to a string
+func (d Duration) String() string {
+ return time.Duration(d).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())
+}
+
+// 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)
+ return nil
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as Duration")
+}
diff --git a/go/vendor/github.com/go-openapi/strfmt/format.go b/go/vendor/github.com/go-openapi/strfmt/format.go
new file mode 100644
index 0000000..8afccbd
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/format.go
@@ -0,0 +1,307 @@
+// Copyright 2015 go-swagger maintainers
+//
+// 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
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package strfmt
+
+import (
+ "encoding"
+ "reflect"
+ "strings"
+ "sync"
+ "time"
+
+ "github.com/go-openapi/errors"
+ "github.com/mitchellh/mapstructure"
+)
+
+// Default is the default formats registry
+var Default = NewSeededFormats(nil, nil)
+
+// Validator represents a validator for a string format.
+type Validator func(string) bool
+
+// Format represents a string format.
+//
+// All implementations of Format provide a string representation and text
+// marshaling/unmarshaling interface to be used by encoders (e.g. encoding/json).
+type Format interface {
+ String() string
+ encoding.TextMarshaler
+ encoding.TextUnmarshaler
+}
+
+// Registry is a registry of string formats, with a validation method.
+type Registry interface {
+ Add(string, Format, Validator) bool
+ DelByName(string) bool
+ GetType(string) (reflect.Type, bool)
+ ContainsName(string) bool
+ Validates(string, string) bool
+ Parse(string, string) (interface{}, error)
+ MapStructureHookFunc() mapstructure.DecodeHookFunc
+}
+
+type knownFormat struct {
+ Name string
+ OrigName string
+ Type reflect.Type
+ Validator Validator
+}
+
+// NameNormalizer is a function that normalizes a format name.
+type NameNormalizer func(string) string
+
+// DefaultNameNormalizer removes all dashes
+func DefaultNameNormalizer(name string) string {
+ return strings.Replace(name, "-", "", -1)
+}
+
+type defaultFormats struct {
+ sync.Mutex
+ data []knownFormat
+ normalizeName NameNormalizer
+}
+
+// NewFormats creates a new formats registry seeded with the values from the default
+func NewFormats() Registry {
+ return NewSeededFormats(Default.(*defaultFormats).data, nil)
+}
+
+// NewSeededFormats creates a new formats registry
+func NewSeededFormats(seeds []knownFormat, normalizer NameNormalizer) Registry {
+ if normalizer == nil {
+ normalizer = DefaultNameNormalizer
+ }
+ // copy here, don't modify original
+ d := append([]knownFormat(nil), seeds...)
+ return &defaultFormats{
+ data: d,
+ normalizeName: normalizer,
+ }
+}
+
+// MapStructureHookFunc is a decode hook function for mapstructure
+func (f *defaultFormats) MapStructureHookFunc() mapstructure.DecodeHookFunc {
+ return func(from reflect.Type, to reflect.Type, data interface{}) (interface{}, error) {
+ if from.Kind() != reflect.String {
+ return data, nil
+ }
+ for _, v := range f.data {
+ tpe, _ := f.GetType(v.Name)
+ if to == tpe {
+ switch v.Name {
+ case "date":
+ d, err := time.Parse(RFC3339FullDate, data.(string))
+ if err != nil {
+ return nil, err
+ }
+ return Date(d), nil
+ case "datetime":
+ return ParseDateTime(data.(string))
+ case "duration":
+ dur, err := ParseDuration(data.(string))
+ if err != nil {
+ return nil, err
+ }
+ return Duration(dur), nil
+ case "uri":
+ return URI(data.(string)), nil
+ case "email":
+ return Email(data.(string)), nil
+ case "uuid":
+ return UUID(data.(string)), nil
+ case "uuid3":
+ return UUID3(data.(string)), nil
+ case "uuid4":
+ return UUID4(data.(string)), nil
+ case "uuid5":
+ return UUID5(data.(string)), nil
+ case "hostname":
+ return Hostname(data.(string)), nil
+ case "ipv4":
+ return IPv4(data.(string)), nil
+ case "ipv6":
+ return IPv6(data.(string)), nil
+ case "mac":
+ return MAC(data.(string)), nil
+ case "isbn":
+ return ISBN(data.(string)), nil
+ case "isbn10":
+ return ISBN10(data.(string)), nil
+ case "isbn13":
+ return ISBN13(data.(string)), nil
+ case "creditcard":
+ return CreditCard(data.(string)), nil
+ case "ssn":
+ return SSN(data.(string)), nil
+ case "hexcolor":
+ return HexColor(data.(string)), nil
+ case "rgbcolor":
+ return RGBColor(data.(string)), nil
+ case "byte":
+ return Base64(data.(string)), nil
+ case "password":
+ return Password(data.(string)), nil
+ default:
+ return nil, errors.InvalidTypeName(v.Name)
+ }
+ }
+ }
+ return data, nil
+ }
+}
+
+// Add adds a new format, return true if this was a new item instead of a replacement
+func (f *defaultFormats) Add(name string, strfmt Format, validator Validator) bool {
+ f.Lock()
+ defer f.Unlock()
+
+ nme := f.normalizeName(name)
+
+ tpe := reflect.TypeOf(strfmt)
+ if tpe.Kind() == reflect.Ptr {
+ tpe = tpe.Elem()
+ }
+
+ for i := range f.data {
+ v := &f.data[i]
+ if v.Name == nme {
+ v.Type = tpe
+ v.Validator = validator
+ return false
+ }
+ }
+
+ // turns out it's new after all
+ f.data = append(f.data, knownFormat{Name: nme, OrigName: name, Type: tpe, Validator: validator})
+ return true
+}
+
+// GetType gets the type for the specified name
+func (f *defaultFormats) GetType(name string) (reflect.Type, bool) {
+ f.Lock()
+ defer f.Unlock()
+ nme := f.normalizeName(name)
+ for _, v := range f.data {
+ if v.Name == nme {
+ return v.Type, true
+ }
+ }
+ return nil, false
+}
+
+// DelByName removes the format by the specified name, returns true when an item was actually removed
+func (f *defaultFormats) DelByName(name string) bool {
+ f.Lock()
+ defer f.Unlock()
+
+ nme := f.normalizeName(name)
+
+ for i, v := range f.data {
+ if v.Name == nme {
+ f.data[i] = knownFormat{} // release
+ f.data = append(f.data[:i], f.data[i+1:]...)
+ return true
+ }
+ }
+ return false
+}
+
+// DelByType removes the specified format, returns true when an item was actually removed
+func (f *defaultFormats) DelByFormat(strfmt Format) bool {
+ f.Lock()
+ defer f.Unlock()
+
+ tpe := reflect.TypeOf(strfmt)
+ if tpe.Kind() == reflect.Ptr {
+ tpe = tpe.Elem()
+ }
+
+ for i, v := range f.data {
+ if v.Type == tpe {
+ f.data[i] = knownFormat{} // release
+ f.data = append(f.data[:i], f.data[i+1:]...)
+ return true
+ }
+ }
+ return false
+}
+
+// ContainsName returns true if this registry contains the specified name
+func (f *defaultFormats) ContainsName(name string) bool {
+ f.Lock()
+ defer f.Unlock()
+ nme := f.normalizeName(name)
+ for _, v := range f.data {
+ if v.Name == nme {
+ return true
+ }
+ }
+ return false
+}
+
+// ContainsFormat returns true if this registry contains the specified format
+func (f *defaultFormats) ContainsFormat(strfmt Format) bool {
+ f.Lock()
+ defer f.Unlock()
+ tpe := reflect.TypeOf(strfmt)
+ if tpe.Kind() == reflect.Ptr {
+ tpe = tpe.Elem()
+ }
+
+ for _, v := range f.data {
+ if v.Type == tpe {
+ return true
+ }
+ }
+ return false
+}
+
+// Validates passed data against format.
+//
+// Note that the format name is automatically normalized, e.g. one may
+// use "date-time" to use the "datetime" format validator.
+func (f *defaultFormats) Validates(name, data string) bool {
+ f.Lock()
+ defer f.Unlock()
+ nme := f.normalizeName(name)
+ for _, v := range f.data {
+ if v.Name == nme {
+ return v.Validator(data)
+ }
+ }
+ return false
+}
+
+// Parse a string into the appropriate format representation type.
+//
+// E.g. parsing a string a "date" will return a Date type.
+func (f *defaultFormats) Parse(name, data string) (interface{}, error) {
+ f.Lock()
+ defer f.Unlock()
+ nme := f.normalizeName(name)
+ for _, v := range f.data {
+ if v.Name == nme {
+ nw := reflect.New(v.Type).Interface()
+ if dec, ok := nw.(encoding.TextUnmarshaler); ok {
+ if err := dec.UnmarshalText([]byte(data)); err != nil {
+ return nil, err
+ }
+ return nw, nil
+ }
+ return nil, errors.InvalidTypeName(name)
+ }
+ }
+ return nil, errors.InvalidTypeName(name)
+}
diff --git a/go/vendor/github.com/go-openapi/strfmt/go.mod b/go/vendor/github.com/go-openapi/strfmt/go.mod
new file mode 100644
index 0000000..19c0939
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/go.mod
@@ -0,0 +1,13 @@
+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/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
+)
diff --git a/go/vendor/github.com/go-openapi/strfmt/go.sum b/go/vendor/github.com/go-openapi/strfmt/go.sum
new file mode 100644
index 0000000..77349a2
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/go.sum
@@ -0,0 +1,19 @@
+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/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/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/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=
diff --git a/go/vendor/github.com/go-openapi/strfmt/time.go b/go/vendor/github.com/go-openapi/strfmt/time.go
new file mode 100644
index 0000000..987deab
--- /dev/null
+++ b/go/vendor/github.com/go-openapi/strfmt/time.go
@@ -0,0 +1,195 @@
+// Copyright 2015 go-swagger maintainers
+//
+// 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
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package strfmt
+
+import (
+ "database/sql/driver"
+ "errors"
+ "fmt"
+ "regexp"
+ "strings"
+ "time"
+
+ "github.com/globalsign/mgo/bson"
+ "github.com/mailru/easyjson/jlexer"
+ "github.com/mailru/easyjson/jwriter"
+)
+
+func init() {
+ dt := DateTime{}
+ Default.Add("datetime", &dt, IsDateTime)
+}
+
+// IsDateTime returns true when the string is a valid date-time
+func IsDateTime(str string) bool {
+ if len(str) < 4 {
+ return false
+ }
+ s := strings.Split(strings.ToLower(str), "t")
+ if len(s) < 2 || !IsDate(s[0]) {
+ return false
+ }
+
+ matches := rxDateTime.FindAllStringSubmatch(s[1], -1)
+ if len(matches) == 0 || len(matches[0]) == 0 {
+ return false
+ }
+ m := matches[0]
+ res := m[1] <= "23" && m[2] <= "59" && m[3] <= "59"
+ return res
+}
+
+const (
+ // RFC3339Millis represents a ISO8601 format to millis instead of to nanos
+ 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"
+ // 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}
+ rxDateTime = regexp.MustCompile(DateTimePattern)
+ // MarshalFormat sets the time resolution format used for marshaling time (set to milliseconds)
+ MarshalFormat = RFC3339Millis
+)
+
+// ParseDateTime parses a string that represents an ISO8601 time or a unix epoch
+func ParseDateTime(data string) (DateTime, error) {
+ if data == "" {
+ return NewDateTime(), nil
+ }
+ var lastError error
+ for _, layout := range dateTimeFormats {
+ dd, err := time.Parse(layout, data)
+ if err != nil {
+ lastError = err
+ continue
+ }
+ lastError = nil
+ return DateTime(dd), nil
+ }
+ return DateTime{}, lastError
+}
+
+// DateTime is a time but it serializes to ISO8601 format with millis
+// It knows how to read 3 different variations of a RFC3339 date time.
+// Most APIs we encounter want either millisecond or second precision times.
+// This just tries to make it worry-free.
+//
+// swagger:strfmt date-time
+type DateTime time.Time
+
+// NewDateTime is a representation of zero value for DateTime type
+func NewDateTime() DateTime {
+ return DateTime(time.Unix(0, 0).UTC())
+}
+
+// String converts this time to a string
+func (t DateTime) String() string {
+ return time.Time(t).Format(MarshalFormat)
+}
+
+// MarshalText implements the text marshaller interface
+func (t DateTime) MarshalText() ([]byte, error) {
+ return []byte(t.String()), nil
+}
+
+// UnmarshalText implements the text unmarshaller interface
+func (t *DateTime) UnmarshalText(text []byte) error {
+ tt, err := ParseDateTime(string(text))
+ if err != nil {
+ return err
+ }
+ *t = tt
+ return nil
+}
+
+// Scan scans a DateTime value from database driver type.
+func (t *DateTime) Scan(raw interface{}) error {
+ // TODO: case int64: and case float64: ?
+ switch v := raw.(type) {
+ case []byte:
+ return t.UnmarshalText(v)
+ case string:
+ return t.UnmarshalText([]byte(v))
+ case time.Time:
+ *t = DateTime(v)
+ case nil:
+ *t = DateTime{}
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.DateTime from: %#v", v)
+ }
+
+ return nil
+}
+
+// Value converts DateTime to a primitive value ready to written to a database.
+func (t DateTime) Value() (driver.Value, error) {
+ return driver.Value(t.String()), nil
+}
+
+// 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))
+}
+
+// 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
+ }
+}
+
+// GetBSON returns the DateTime as a bson.M{} map.
+func (t *DateTime) GetBSON() (interface{}, error) {
+ return bson.M{"data": t.String()}, nil
+}
+
+// SetBSON sets the DateTime from raw bson data
+func (t *DateTime) 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 {
+ var err error
+ *t, err = ParseDateTime(data)
+ return err
+ }
+
+ return errors.New("couldn't unmarshal bson raw value as Duration")
+}