lives in
- // table - The table name
- QuotedTableForQuery(schema string, table string) string
-
- // Existence clause for table creation / deletion
- IfSchemaNotExists(command, schema string) string
- IfTableExists(command, schema, table string) string
- IfTableNotExists(command, schema, table string) string
-}
-
-// IntegerAutoIncrInserter is implemented by dialects that can perform
-// inserts with automatically incremented integer primary keys. If
-// the dialect can handle automatic assignment of more than just
-// integers, see TargetedAutoIncrInserter.
-type IntegerAutoIncrInserter interface {
- InsertAutoIncr(exec SqlExecutor, insertSql string, params ...interface{}) (int64, error)
-}
-
-// TargetedAutoIncrInserter is implemented by dialects that can
-// perform automatic assignment of any primary key type (i.e. strings
-// for uuids, integers for serials, etc).
-type TargetedAutoIncrInserter interface {
- // InsertAutoIncrToTarget runs an insert operation and assigns the
- // automatically generated primary key directly to the passed in
- // target. The target should be a pointer to the primary key
- // field of the value being inserted.
- InsertAutoIncrToTarget(exec SqlExecutor, insertSql string, target interface{}, params ...interface{}) error
-}
-
-// TargetQueryInserter is implemented by dialects that can perform
-// assignment of integer primary key type by executing a query
-// like "select sequence.currval from dual".
-type TargetQueryInserter interface {
- // TargetQueryInserter runs an insert operation and assigns the
- // automatically generated primary key retrived by the query
- // extracted from the GeneratedIdQuery field of the id column.
- InsertQueryToTarget(exec SqlExecutor, insertSql, idSql string, target interface{}, params ...interface{}) error
-}
-
-func standardInsertAutoIncr(exec SqlExecutor, insertSql string, params ...interface{}) (int64, error) {
- res, err := exec.Exec(insertSql, params...)
- if err != nil {
- return 0, err
- }
- return res.LastInsertId()
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/dialect_mysql.go b/vendor/github.com/go-gorp/gorp/v3/dialect_mysql.go
deleted file mode 100644
index 071f6ea..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/dialect_mysql.go
+++ /dev/null
@@ -1,275 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import (
- "fmt"
- "reflect"
- "strings"
- "time"
-)
-
-// Implementation of Dialect for MySQL databases.
-
-type MySQLDialect struct {
-
- // Engine is the storage engine to use "InnoDB" vs "MyISAM" for example
-
- Engine string
-
- // Encoding is the character encoding to use for created tables
-
- Encoding string
-}
-
-func (d MySQLDialect) QuerySuffix() string { return ";" }
-
-func (d MySQLDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string {
-
- switch val.Kind() {
-
- case reflect.Ptr:
-
- return d.ToSqlType(val.Elem(), maxsize, isAutoIncr)
-
- case reflect.Bool:
-
- return "boolean"
-
- case reflect.Int8:
-
- return "tinyint"
-
- case reflect.Uint8:
-
- return "tinyint unsigned"
-
- case reflect.Int16:
-
- return "smallint"
-
- case reflect.Uint16:
-
- return "smallint unsigned"
-
- case reflect.Int, reflect.Int32:
-
- return "int"
-
- case reflect.Uint, reflect.Uint32:
-
- return "int unsigned"
-
- case reflect.Int64:
-
- return "bigint"
-
- case reflect.Uint64:
-
- return "bigint unsigned"
-
- case reflect.Float64, reflect.Float32:
-
- return "double"
-
- case reflect.Slice:
-
- if val.Elem().Kind() == reflect.Uint8 {
-
- return "mediumblob"
-
- }
-
- }
-
- switch val.Name() {
-
- case "NullInt64":
-
- return "bigint"
-
- case "NullFloat64":
-
- return "double"
-
- case "NullBool":
-
- return "tinyint"
-
- case "Time":
-
- return "datetime"
-
- }
-
- if maxsize < 1 {
-
- maxsize = 255
-
- }
-
- /* == About varchar(N) ==
-
- * N is number of characters.
-
- * A varchar column can store up to 65535 bytes.
-
- * Remember that 1 character is 3 bytes in utf-8 charset.
-
- * Also remember that each row can store up to 65535 bytes,
-
- * and you have some overheads, so it's not possible for a
-
- * varchar column to have 65535/3 characters really.
-
- * So it would be better to use 'text' type in stead of
-
- * large varchar type.
-
- */
-
- if maxsize < 256 {
-
- return fmt.Sprintf("varchar(%d)", maxsize)
-
- } else {
-
- return "text"
-
- }
-
-}
-
-// Returns auto_increment
-
-func (d MySQLDialect) AutoIncrStr() string {
-
- return "auto_increment"
-
-}
-
-func (d MySQLDialect) AutoIncrBindValue() string {
-
- return "null"
-
-}
-
-func (d MySQLDialect) AutoIncrInsertSuffix(col *ColumnMap) string {
-
- return ""
-
-}
-
-// Returns engine=%s charset=%s based on values stored on struct
-
-func (d MySQLDialect) CreateTableSuffix() string {
-
- if d.Engine == "" || d.Encoding == "" {
-
- msg := "gorp - undefined"
-
- if d.Engine == "" {
-
- msg += " MySQLDialect.Engine"
-
- }
-
- if d.Engine == "" && d.Encoding == "" {
-
- msg += ","
-
- }
-
- if d.Encoding == "" {
-
- msg += " MySQLDialect.Encoding"
-
- }
-
- msg += ". Check that your MySQLDialect was correctly initialized when declared."
-
- panic(msg)
-
- }
-
- return fmt.Sprintf(" engine=%s charset=%s", d.Engine, d.Encoding)
-
-}
-
-func (d MySQLDialect) CreateIndexSuffix() string {
-
- return "using"
-
-}
-
-func (d MySQLDialect) DropIndexSuffix() string {
-
- return "on"
-
-}
-
-func (d MySQLDialect) TruncateClause() string {
-
- return "truncate"
-
-}
-
-func (d MySQLDialect) SleepClause(s time.Duration) string {
-
- return fmt.Sprintf("sleep(%f)", s.Seconds())
-
-}
-
-// Returns "?"
-
-func (d MySQLDialect) BindVar(i int) string {
-
- return "?"
-
-}
-
-func (d MySQLDialect) InsertAutoIncr(exec SqlExecutor, insertSql string, params ...interface{}) (int64, error) {
-
- return standardInsertAutoIncr(exec, insertSql, params...)
-
-}
-
-func (d MySQLDialect) QuoteField(f string) string {
-
- return "`" + f + "`"
-
-}
-
-func (d MySQLDialect) QuotedTableForQuery(schema string, table string) string {
-
- if strings.TrimSpace(schema) == "" {
-
- return d.QuoteField(table)
-
- }
-
- return schema + "." + d.QuoteField(table)
-
-}
-
-func (d MySQLDialect) IfSchemaNotExists(command, schema string) string {
-
- return fmt.Sprintf("%s if not exists", command)
-
-}
-
-func (d MySQLDialect) IfTableExists(command, schema, table string) string {
-
- return fmt.Sprintf("%s if exists", command)
-
-}
-
-func (d MySQLDialect) IfTableNotExists(command, schema, table string) string {
-
- return fmt.Sprintf("%s if not exists", command)
-
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/dialect_oracle.go b/vendor/github.com/go-gorp/gorp/v3/dialect_oracle.go
deleted file mode 100644
index 6753622..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/dialect_oracle.go
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import (
- "fmt"
- "reflect"
- "strings"
-)
-
-// Implementation of Dialect for Oracle databases.
-
-type OracleDialect struct{}
-
-func (d OracleDialect) QuerySuffix() string { return "" }
-
-func (d OracleDialect) CreateIndexSuffix() string { return "" }
-
-func (d OracleDialect) DropIndexSuffix() string { return "" }
-
-func (d OracleDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string {
-
- switch val.Kind() {
-
- case reflect.Ptr:
-
- return d.ToSqlType(val.Elem(), maxsize, isAutoIncr)
-
- case reflect.Bool:
-
- return "boolean"
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32:
-
- if isAutoIncr {
-
- return "serial"
-
- }
-
- return "integer"
-
- case reflect.Int64, reflect.Uint64:
-
- if isAutoIncr {
-
- return "bigserial"
-
- }
-
- return "bigint"
-
- case reflect.Float64:
-
- return "double precision"
-
- case reflect.Float32:
-
- return "real"
-
- case reflect.Slice:
-
- if val.Elem().Kind() == reflect.Uint8 {
-
- return "bytea"
-
- }
-
- }
-
- switch val.Name() {
-
- case "NullInt64":
-
- return "bigint"
-
- case "NullFloat64":
-
- return "double precision"
-
- case "NullBool":
-
- return "boolean"
-
- case "NullTime", "Time":
-
- return "timestamp with time zone"
-
- }
-
- if maxsize > 0 {
-
- return fmt.Sprintf("varchar(%d)", maxsize)
-
- } else {
-
- return "text"
-
- }
-
-}
-
-// Returns empty string
-
-func (d OracleDialect) AutoIncrStr() string {
-
- return ""
-
-}
-
-func (d OracleDialect) AutoIncrBindValue() string {
-
- return "NULL"
-
-}
-
-func (d OracleDialect) AutoIncrInsertSuffix(col *ColumnMap) string {
-
- return ""
-
-}
-
-// Returns suffix
-
-func (d OracleDialect) CreateTableSuffix() string {
-
- return ""
-
-}
-
-func (d OracleDialect) TruncateClause() string {
-
- return "truncate"
-
-}
-
-// Returns "$(i+1)"
-
-func (d OracleDialect) BindVar(i int) string {
-
- return fmt.Sprintf(":%d", i+1)
-
-}
-
-// After executing the insert uses the ColMap IdQuery to get the generated id
-
-func (d OracleDialect) InsertQueryToTarget(exec SqlExecutor, insertSql, idSql string, target interface{}, params ...interface{}) error {
-
- _, err := exec.Exec(insertSql, params...)
-
- if err != nil {
-
- return err
-
- }
-
- id, err := exec.SelectInt(idSql)
-
- if err != nil {
-
- return err
-
- }
-
- switch target.(type) {
-
- case *int64:
-
- *(target.(*int64)) = id
-
- case *int32:
-
- *(target.(*int32)) = int32(id)
-
- case int:
-
- *(target.(*int)) = int(id)
-
- default:
-
- return fmt.Errorf("Id field can be int, int32 or int64")
-
- }
-
- return nil
-
-}
-
-func (d OracleDialect) QuoteField(f string) string {
-
- return `"` + strings.ToUpper(f) + `"`
-
-}
-
-func (d OracleDialect) QuotedTableForQuery(schema string, table string) string {
-
- if strings.TrimSpace(schema) == "" {
-
- return d.QuoteField(table)
-
- }
-
- return schema + "." + d.QuoteField(table)
-
-}
-
-func (d OracleDialect) IfSchemaNotExists(command, schema string) string {
-
- return fmt.Sprintf("%s if not exists", command)
-
-}
-
-func (d OracleDialect) IfTableExists(command, schema, table string) string {
-
- return fmt.Sprintf("%s if exists", command)
-
-}
-
-func (d OracleDialect) IfTableNotExists(command, schema, table string) string {
-
- return fmt.Sprintf("%s if not exists", command)
-
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/dialect_postgres.go b/vendor/github.com/go-gorp/gorp/v3/dialect_postgres.go
deleted file mode 100644
index d514a6e..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/dialect_postgres.go
+++ /dev/null
@@ -1,240 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import (
- "fmt"
- "reflect"
- "strings"
- "time"
-)
-
-type PostgresDialect struct {
- suffix string
-
- LowercaseFields bool
-}
-
-func (d PostgresDialect) QuerySuffix() string { return ";" }
-
-func (d PostgresDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string {
-
- switch val.Kind() {
-
- case reflect.Ptr:
-
- return d.ToSqlType(val.Elem(), maxsize, isAutoIncr)
-
- case reflect.Bool:
-
- return "boolean"
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32:
-
- if isAutoIncr {
-
- return "serial"
-
- }
-
- return "integer"
-
- case reflect.Int64, reflect.Uint64:
-
- if isAutoIncr {
-
- return "bigserial"
-
- }
-
- return "bigint"
-
- case reflect.Float64:
-
- return "double precision"
-
- case reflect.Float32:
-
- return "real"
-
- case reflect.Slice:
-
- if val.Elem().Kind() == reflect.Uint8 {
-
- return "bytea"
-
- }
-
- }
-
- switch val.Name() {
-
- case "NullInt64":
-
- return "bigint"
-
- case "NullFloat64":
-
- return "double precision"
-
- case "NullBool":
-
- return "boolean"
-
- case "Time", "NullTime":
-
- return "timestamp with time zone"
-
- }
-
- if maxsize > 0 {
-
- return fmt.Sprintf("varchar(%d)", maxsize)
-
- } else {
-
- return "text"
-
- }
-
-}
-
-// Returns empty string
-
-func (d PostgresDialect) AutoIncrStr() string {
-
- return ""
-
-}
-
-func (d PostgresDialect) AutoIncrBindValue() string {
-
- return "default"
-
-}
-
-func (d PostgresDialect) AutoIncrInsertSuffix(col *ColumnMap) string {
-
- return " returning " + d.QuoteField(col.ColumnName)
-
-}
-
-// Returns suffix
-
-func (d PostgresDialect) CreateTableSuffix() string {
-
- return d.suffix
-
-}
-
-func (d PostgresDialect) CreateIndexSuffix() string {
-
- return "using"
-
-}
-
-func (d PostgresDialect) DropIndexSuffix() string {
-
- return ""
-
-}
-
-func (d PostgresDialect) TruncateClause() string {
-
- return "truncate"
-
-}
-
-func (d PostgresDialect) SleepClause(s time.Duration) string {
-
- return fmt.Sprintf("pg_sleep(%f)", s.Seconds())
-
-}
-
-// Returns "$(i+1)"
-
-func (d PostgresDialect) BindVar(i int) string {
-
- return fmt.Sprintf("$%d", i+1)
-
-}
-
-func (d PostgresDialect) InsertAutoIncrToTarget(exec SqlExecutor, insertSql string, target interface{}, params ...interface{}) error {
-
- rows, err := exec.Query(insertSql, params...)
-
- if err != nil {
-
- return err
-
- }
-
- defer rows.Close()
-
- if !rows.Next() {
-
- return fmt.Errorf("No serial value returned for insert: %s Encountered error: %s", insertSql, rows.Err())
-
- }
-
- if err := rows.Scan(target); err != nil {
-
- return err
-
- }
-
- if rows.Next() {
-
- return fmt.Errorf("more than two serial value returned for insert: %s", insertSql)
-
- }
-
- return rows.Err()
-
-}
-
-func (d PostgresDialect) QuoteField(f string) string {
-
- if d.LowercaseFields {
-
- return `"` + strings.ToLower(f) + `"`
-
- }
-
- return `"` + f + `"`
-
-}
-
-func (d PostgresDialect) QuotedTableForQuery(schema string, table string) string {
-
- if strings.TrimSpace(schema) == "" {
-
- return d.QuoteField(table)
-
- }
-
- return schema + "." + d.QuoteField(table)
-
-}
-
-func (d PostgresDialect) IfSchemaNotExists(command, schema string) string {
-
- return fmt.Sprintf("%s if not exists", command)
-
-}
-
-func (d PostgresDialect) IfTableExists(command, schema, table string) string {
-
- return fmt.Sprintf("%s if exists", command)
-
-}
-
-func (d PostgresDialect) IfTableNotExists(command, schema, table string) string {
-
- return fmt.Sprintf("%s if not exists", command)
-
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/dialect_snowflake.go b/vendor/github.com/go-gorp/gorp/v3/dialect_snowflake.go
deleted file mode 100644
index 459b649..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/dialect_snowflake.go
+++ /dev/null
@@ -1,247 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import (
- "fmt"
- "reflect"
- "strings"
-)
-
-type SnowflakeDialect struct {
- suffix string
-
- LowercaseFields bool
-}
-
-func (d SnowflakeDialect) QuerySuffix() string { return ";" }
-
-func (d SnowflakeDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string {
-
- switch val.Kind() {
-
- case reflect.Ptr:
-
- return d.ToSqlType(val.Elem(), maxsize, isAutoIncr)
-
- case reflect.Bool:
-
- return "boolean"
-
- case reflect.Int,
-
- reflect.Int8,
-
- reflect.Int16,
-
- reflect.Int32,
-
- reflect.Uint,
-
- reflect.Uint8,
-
- reflect.Uint16,
-
- reflect.Uint32:
-
- if isAutoIncr {
-
- return "serial"
-
- }
-
- return "integer"
-
- case reflect.Int64, reflect.Uint64:
-
- if isAutoIncr {
-
- return "bigserial"
-
- }
-
- return "bigint"
-
- case reflect.Float64:
-
- return "double precision"
-
- case reflect.Float32:
-
- return "real"
-
- case reflect.Slice:
-
- if val.Elem().Kind() == reflect.Uint8 {
-
- return "binary"
-
- }
-
- }
-
- switch val.Name() {
-
- case "NullInt64":
-
- return "bigint"
-
- case "NullFloat64":
-
- return "double precision"
-
- case "NullBool":
-
- return "boolean"
-
- case "Time", "NullTime":
-
- return "timestamp with time zone"
-
- }
-
- if maxsize > 0 {
-
- return fmt.Sprintf("varchar(%d)", maxsize)
-
- } else {
-
- return "text"
-
- }
-
-}
-
-// Returns empty string
-
-func (d SnowflakeDialect) AutoIncrStr() string {
-
- return ""
-
-}
-
-func (d SnowflakeDialect) AutoIncrBindValue() string {
-
- return "default"
-
-}
-
-func (d SnowflakeDialect) AutoIncrInsertSuffix(col *ColumnMap) string {
-
- return ""
-
-}
-
-// Returns suffix
-
-func (d SnowflakeDialect) CreateTableSuffix() string {
-
- return d.suffix
-
-}
-
-func (d SnowflakeDialect) CreateIndexSuffix() string {
-
- return ""
-
-}
-
-func (d SnowflakeDialect) DropIndexSuffix() string {
-
- return ""
-
-}
-
-func (d SnowflakeDialect) TruncateClause() string {
-
- return "truncate"
-
-}
-
-// Returns "$(i+1)"
-
-func (d SnowflakeDialect) BindVar(i int) string {
-
- return "?"
-
-}
-
-func (d SnowflakeDialect) InsertAutoIncrToTarget(exec SqlExecutor, insertSql string, target interface{}, params ...interface{}) error {
-
- rows, err := exec.Query(insertSql, params...)
-
- if err != nil {
-
- return err
-
- }
-
- defer rows.Close()
-
- if !rows.Next() {
-
- return fmt.Errorf("No serial value returned for insert: %s Encountered error: %s", insertSql, rows.Err())
-
- }
-
- if err := rows.Scan(target); err != nil {
-
- return err
-
- }
-
- if rows.Next() {
-
- return fmt.Errorf("more than two serial value returned for insert: %s", insertSql)
-
- }
-
- return rows.Err()
-
-}
-
-func (d SnowflakeDialect) QuoteField(f string) string {
-
- if d.LowercaseFields {
-
- return `"` + strings.ToLower(f) + `"`
-
- }
-
- return `"` + f + `"`
-
-}
-
-func (d SnowflakeDialect) QuotedTableForQuery(schema string, table string) string {
-
- if strings.TrimSpace(schema) == "" {
-
- return d.QuoteField(table)
-
- }
-
- return schema + "." + d.QuoteField(table)
-
-}
-
-func (d SnowflakeDialect) IfSchemaNotExists(command, schema string) string {
-
- return fmt.Sprintf("%s if not exists", command)
-
-}
-
-func (d SnowflakeDialect) IfTableExists(command, schema, table string) string {
-
- return fmt.Sprintf("%s if exists", command)
-
-}
-
-func (d SnowflakeDialect) IfTableNotExists(command, schema, table string) string {
-
- return fmt.Sprintf("%s if not exists", command)
-
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/dialect_sqlite.go b/vendor/github.com/go-gorp/gorp/v3/dialect_sqlite.go
deleted file mode 100644
index 04b750b..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/dialect_sqlite.go
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import (
- "fmt"
- "reflect"
-)
-
-type SqliteDialect struct {
- suffix string
-}
-
-func (d SqliteDialect) QuerySuffix() string { return ";" }
-
-func (d SqliteDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string {
-
- switch val.Kind() {
-
- case reflect.Ptr:
-
- return d.ToSqlType(val.Elem(), maxsize, isAutoIncr)
-
- case reflect.Bool:
-
- return "integer"
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
-
- return "integer"
-
- case reflect.Float64, reflect.Float32:
-
- return "real"
-
- case reflect.Slice:
-
- if val.Elem().Kind() == reflect.Uint8 {
-
- return "blob"
-
- }
-
- }
-
- switch val.Name() {
-
- case "NullInt64":
-
- return "integer"
-
- case "NullFloat64":
-
- return "real"
-
- case "NullBool":
-
- return "integer"
-
- case "Time":
-
- return "datetime"
-
- }
-
- if maxsize < 1 {
-
- maxsize = 255
-
- }
-
- return fmt.Sprintf("varchar(%d)", maxsize)
-
-}
-
-// Returns autoincrement
-
-func (d SqliteDialect) AutoIncrStr() string {
-
- return "autoincrement"
-
-}
-
-func (d SqliteDialect) AutoIncrBindValue() string {
-
- return "null"
-
-}
-
-func (d SqliteDialect) AutoIncrInsertSuffix(col *ColumnMap) string {
-
- return ""
-
-}
-
-// Returns suffix
-
-func (d SqliteDialect) CreateTableSuffix() string {
-
- return d.suffix
-
-}
-
-func (d SqliteDialect) CreateIndexSuffix() string {
-
- return ""
-
-}
-
-func (d SqliteDialect) DropIndexSuffix() string {
-
- return ""
-
-}
-
-// With sqlite, there technically isn't a TRUNCATE statement,
-
-// but a DELETE FROM uses a truncate optimization:
-
-// http://www.sqlite.org/lang_delete.html
-
-func (d SqliteDialect) TruncateClause() string {
-
- return "delete from"
-
-}
-
-// Returns "?"
-
-func (d SqliteDialect) BindVar(i int) string {
-
- return "?"
-
-}
-
-func (d SqliteDialect) InsertAutoIncr(exec SqlExecutor, insertSql string, params ...interface{}) (int64, error) {
-
- return standardInsertAutoIncr(exec, insertSql, params...)
-
-}
-
-func (d SqliteDialect) QuoteField(f string) string {
-
- return `"` + f + `"`
-
-}
-
-// sqlite does not have schemas like PostgreSQL does, so just escape it like normal
-
-func (d SqliteDialect) QuotedTableForQuery(schema string, table string) string {
-
- return d.QuoteField(table)
-
-}
-
-func (d SqliteDialect) IfSchemaNotExists(command, schema string) string {
-
- return fmt.Sprintf("%s if not exists", command)
-
-}
-
-func (d SqliteDialect) IfTableExists(command, schema, table string) string {
-
- return fmt.Sprintf("%s if exists", command)
-
-}
-
-func (d SqliteDialect) IfTableNotExists(command, schema, table string) string {
-
- return fmt.Sprintf("%s if not exists", command)
-
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/dialect_sqlserver.go b/vendor/github.com/go-gorp/gorp/v3/dialect_sqlserver.go
deleted file mode 100644
index 675f195..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/dialect_sqlserver.go
+++ /dev/null
@@ -1,240 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import (
- "fmt"
- "reflect"
- "strings"
-)
-
-// Implementation of Dialect for Microsoft SQL Server databases.
-
-// Use gorp.SqlServerDialect{"2005"} for legacy datatypes.
-
-// Tested with driver: github.com/denisenkom/go-mssqldb
-
-type SqlServerDialect struct {
-
- // If set to "2005" legacy datatypes will be used
-
- Version string
-}
-
-func (d SqlServerDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string {
-
- switch val.Kind() {
-
- case reflect.Ptr:
-
- return d.ToSqlType(val.Elem(), maxsize, isAutoIncr)
-
- case reflect.Bool:
-
- return "bit"
-
- case reflect.Int8:
-
- return "tinyint"
-
- case reflect.Uint8:
-
- return "smallint"
-
- case reflect.Int16:
-
- return "smallint"
-
- case reflect.Uint16:
-
- return "int"
-
- case reflect.Int, reflect.Int32:
-
- return "int"
-
- case reflect.Uint, reflect.Uint32:
-
- return "bigint"
-
- case reflect.Int64:
-
- return "bigint"
-
- case reflect.Uint64:
-
- return "numeric(20,0)"
-
- case reflect.Float32:
-
- return "float(24)"
-
- case reflect.Float64:
-
- return "float(53)"
-
- case reflect.Slice:
-
- if val.Elem().Kind() == reflect.Uint8 {
-
- return "varbinary"
-
- }
-
- }
-
- switch val.Name() {
-
- case "NullInt64":
-
- return "bigint"
-
- case "NullFloat64":
-
- return "float(53)"
-
- case "NullBool":
-
- return "bit"
-
- case "NullTime", "Time":
-
- if d.Version == "2005" {
-
- return "datetime"
-
- }
-
- return "datetime2"
-
- }
-
- if maxsize < 1 {
-
- if d.Version == "2005" {
-
- maxsize = 255
-
- } else {
-
- return fmt.Sprintf("nvarchar(max)")
-
- }
-
- }
-
- return fmt.Sprintf("nvarchar(%d)", maxsize)
-
-}
-
-// Returns auto_increment
-
-func (d SqlServerDialect) AutoIncrStr() string {
-
- return "identity(0,1)"
-
-}
-
-// Empty string removes autoincrement columns from the INSERT statements.
-
-func (d SqlServerDialect) AutoIncrBindValue() string {
-
- return ""
-
-}
-
-func (d SqlServerDialect) AutoIncrInsertSuffix(col *ColumnMap) string {
-
- return ""
-
-}
-
-func (d SqlServerDialect) CreateTableSuffix() string { return ";" }
-
-func (d SqlServerDialect) TruncateClause() string {
-
- return "truncate table"
-
-}
-
-// Returns "?"
-
-func (d SqlServerDialect) BindVar(i int) string {
-
- return "?"
-
-}
-
-func (d SqlServerDialect) InsertAutoIncr(exec SqlExecutor, insertSql string, params ...interface{}) (int64, error) {
-
- return standardInsertAutoIncr(exec, insertSql, params...)
-
-}
-
-func (d SqlServerDialect) QuoteField(f string) string {
-
- return "[" + strings.Replace(f, "]", "]]", -1) + "]"
-
-}
-
-func (d SqlServerDialect) QuotedTableForQuery(schema string, table string) string {
-
- if strings.TrimSpace(schema) == "" {
-
- return d.QuoteField(table)
-
- }
-
- return d.QuoteField(schema) + "." + d.QuoteField(table)
-
-}
-
-func (d SqlServerDialect) QuerySuffix() string { return ";" }
-
-func (d SqlServerDialect) IfSchemaNotExists(command, schema string) string {
-
- s := fmt.Sprintf("if schema_id(N'%s') is null %s", schema, command)
-
- return s
-
-}
-
-func (d SqlServerDialect) IfTableExists(command, schema, table string) string {
-
- var schema_clause string
-
- if strings.TrimSpace(schema) != "" {
-
- schema_clause = fmt.Sprintf("%s.", d.QuoteField(schema))
-
- }
-
- s := fmt.Sprintf("if object_id('%s%s') is not null %s", schema_clause, d.QuoteField(table), command)
-
- return s
-
-}
-
-func (d SqlServerDialect) IfTableNotExists(command, schema, table string) string {
-
- var schema_clause string
-
- if strings.TrimSpace(schema) != "" {
-
- schema_clause = fmt.Sprintf("%s.", schema)
-
- }
-
- s := fmt.Sprintf("if object_id('%s%s') is null %s", schema_clause, table, command)
-
- return s
-
-}
-
-func (d SqlServerDialect) CreateIndexSuffix() string { return "" }
-
-func (d SqlServerDialect) DropIndexSuffix() string { return "" }
diff --git a/vendor/github.com/go-gorp/gorp/v3/doc.go b/vendor/github.com/go-gorp/gorp/v3/doc.go
deleted file mode 100644
index 593f1c3..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/doc.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-// Package gorp provides a simple way to marshal Go structs to and from
-// SQL databases. It uses the database/sql package, and should work with any
-// compliant database/sql driver.
-//
-// Source code and project home:
-// https://github.com/go-gorp/gorp
-package gorp
diff --git a/vendor/github.com/go-gorp/gorp/v3/errors.go b/vendor/github.com/go-gorp/gorp/v3/errors.go
deleted file mode 100644
index 752ad1b..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/errors.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import (
- "fmt"
-)
-
-// A non-fatal error, when a select query returns columns that do not exist
-// as fields in the struct it is being mapped to
-// TODO: discuss wether this needs an error. encoding/json silently ignores missing fields
-type NoFieldInTypeError struct {
- TypeName string
- MissingColNames []string
-}
-
-func (err *NoFieldInTypeError) Error() string {
- return fmt.Sprintf("gorp: no fields %+v in type %s", err.MissingColNames, err.TypeName)
-}
-
-// returns true if the error is non-fatal (ie, we shouldn't immediately return)
-func NonFatalError(err error) bool {
- switch err.(type) {
- case *NoFieldInTypeError:
- return true
- default:
- return false
- }
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/gorp.go b/vendor/github.com/go-gorp/gorp/v3/gorp.go
deleted file mode 100644
index e3826b7..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/gorp.go
+++ /dev/null
@@ -1,1133 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import (
- "context"
- "database/sql"
- "database/sql/driver"
- "fmt"
- "reflect"
- "regexp"
- "strings"
- "time"
-)
-
-// OracleString (empty string is null)
-
-// TODO: move to dialect/oracle?, rename to String?
-
-type OracleString struct {
- sql.NullString
-}
-
-// Scan implements the Scanner interface.
-
-func (os *OracleString) Scan(value interface{}) error {
-
- if value == nil {
-
- os.String, os.Valid = "", false
-
- return nil
-
- }
-
- os.Valid = true
-
- return os.NullString.Scan(value)
-
-}
-
-// Value implements the driver Valuer interface.
-
-func (os OracleString) Value() (driver.Value, error) {
-
- if !os.Valid || os.String == "" {
-
- return nil, nil
-
- }
-
- return os.String, nil
-
-}
-
-// SqlTyper is a type that returns its database type. Most of the
-
-// time, the type can just use "database/sql/driver".Valuer; but when
-
-// it returns nil for its empty value, it needs to implement SqlTyper
-
-// to have its column type detected properly during table creation.
-
-type SqlTyper interface {
- SqlType() driver.Value
-}
-
-// legacySqlTyper prevents breaking clients who depended on the previous
-
-// SqlTyper interface
-
-type legacySqlTyper interface {
- SqlType() driver.Valuer
-}
-
-// for fields that exists in DB table, but not exists in struct
-
-type dummyField struct{}
-
-// Scan implements the Scanner interface.
-
-func (nt *dummyField) Scan(value interface{}) error {
-
- return nil
-
-}
-
-var zeroVal reflect.Value
-
-var versFieldConst = "[gorp_ver_field]"
-
-// The TypeConverter interface provides a way to map a value of one
-
-// type to another type when persisting to, or loading from, a database.
-
-//
-
-// Example use cases: Implement type converter to convert bool types to "y"/"n" strings,
-
-// or serialize a struct member as a JSON blob.
-
-type TypeConverter interface {
-
- // ToDb converts val to another type. Called before INSERT/UPDATE operations
-
- ToDb(val interface{}) (interface{}, error)
-
- // FromDb returns a CustomScanner appropriate for this type. This will be used
-
- // to hold values returned from SELECT queries.
-
- //
-
- // In particular the CustomScanner returned should implement a Binder
-
- // function appropriate for the Go type you wish to convert the db value to
-
- //
-
- // If bool==false, then no custom scanner will be used for this field.
-
- FromDb(target interface{}) (CustomScanner, bool)
-}
-
-// SqlExecutor exposes gorp operations that can be run from Pre/Post
-
-// hooks. This hides whether the current operation that triggered the
-
-// hook is in a transaction.
-
-//
-
-// See the DbMap function docs for each of the functions below for more
-
-// information.
-
-type SqlExecutor interface {
- WithContext(ctx context.Context) SqlExecutor
-
- Get(i interface{}, keys ...interface{}) (interface{}, error)
-
- Insert(list ...interface{}) error
-
- Update(list ...interface{}) (int64, error)
-
- Delete(list ...interface{}) (int64, error)
-
- Exec(query string, args ...interface{}) (sql.Result, error)
-
- Select(i interface{}, query string, args ...interface{}) ([]interface{}, error)
-
- SelectInt(query string, args ...interface{}) (int64, error)
-
- SelectNullInt(query string, args ...interface{}) (sql.NullInt64, error)
-
- SelectFloat(query string, args ...interface{}) (float64, error)
-
- SelectNullFloat(query string, args ...interface{}) (sql.NullFloat64, error)
-
- SelectStr(query string, args ...interface{}) (string, error)
-
- SelectNullStr(query string, args ...interface{}) (sql.NullString, error)
-
- SelectOne(holder interface{}, query string, args ...interface{}) error
-
- Query(query string, args ...interface{}) (*sql.Rows, error)
-
- QueryRow(query string, args ...interface{}) *sql.Row
-}
-
-// DynamicTable allows the users of gorp to dynamically
-
-// use different database table names during runtime
-
-// while sharing the same golang struct for in-memory data
-
-type DynamicTable interface {
- TableName() string
-
- SetTableName(string)
-}
-
-// Compile-time check that DbMap and Transaction implement the SqlExecutor
-
-// interface.
-
-var _, _ SqlExecutor = &DbMap{}, &Transaction{}
-
-func argValue(a interface{}) interface{} {
-
- v, ok := a.(driver.Valuer)
-
- if !ok {
-
- return a
-
- }
-
- vV := reflect.ValueOf(v)
-
- if vV.Kind() == reflect.Ptr && vV.IsNil() {
-
- return nil
-
- }
-
- ret, err := v.Value()
-
- if err != nil {
-
- return a
-
- }
-
- return ret
-
-}
-
-func argsString(args ...interface{}) string {
-
- var margs string
-
- for i, a := range args {
-
- v := argValue(a)
-
- switch v.(type) {
-
- case string:
-
- v = fmt.Sprintf("%q", v)
-
- default:
-
- v = fmt.Sprintf("%v", v)
-
- }
-
- margs += fmt.Sprintf("%d:%s", i+1, v)
-
- if i+1 < len(args) {
-
- margs += " "
-
- }
-
- }
-
- return margs
-
-}
-
-// Calls the Exec function on the executor, but attempts to expand any eligible named
-
-// query arguments first.
-
-func maybeExpandNamedQueryAndExec(e SqlExecutor, query string, args ...interface{}) (sql.Result, error) {
-
- dbMap := extractDbMap(e)
-
- if len(args) == 1 {
-
- query, args = maybeExpandNamedQuery(dbMap, query, args)
-
- }
-
- return exec(e, query, args...)
-
-}
-
-func extractDbMap(e SqlExecutor) *DbMap {
-
- switch m := e.(type) {
-
- case *DbMap:
-
- return m
-
- case *Transaction:
-
- return m.dbmap
-
- }
-
- return nil
-
-}
-
-// executor exposes the sql.DB and sql.Tx functions so that it can be used
-
-// on internal functions that need to be agnostic to the underlying object.
-
-type executor interface {
- Exec(query string, args ...interface{}) (sql.Result, error)
-
- Prepare(query string) (*sql.Stmt, error)
-
- QueryRow(query string, args ...interface{}) *sql.Row
-
- Query(query string, args ...interface{}) (*sql.Rows, error)
-
- ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
-
- PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
-
- QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
-
- QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
-}
-
-func extractExecutorAndContext(e SqlExecutor) (executor, context.Context) {
-
- switch m := e.(type) {
-
- case *DbMap:
-
- return m.Db, m.ctx
-
- case *Transaction:
-
- return m.tx, m.ctx
-
- }
-
- return nil, nil
-
-}
-
-// maybeExpandNamedQuery checks the given arg to see if it's eligible to be used
-
-// as input to a named query. If so, it rewrites the query to use
-
-// dialect-dependent bindvars and instantiates the corresponding slice of
-
-// parameters by extracting data from the map / struct.
-
-// If not, returns the input values unchanged.
-
-func maybeExpandNamedQuery(m *DbMap, query string, args []interface{}) (string, []interface{}) {
-
- var (
- arg = args[0]
-
- argval = reflect.ValueOf(arg)
- )
-
- if argval.Kind() == reflect.Ptr {
-
- argval = argval.Elem()
-
- }
-
- if argval.Kind() == reflect.Map && argval.Type().Key().Kind() == reflect.String {
-
- return expandNamedQuery(m, query, func(key string) reflect.Value {
-
- return argval.MapIndex(reflect.ValueOf(key))
-
- })
-
- }
-
- if argval.Kind() != reflect.Struct {
-
- return query, args
-
- }
-
- if _, ok := arg.(time.Time); ok {
-
- // time.Time is driver.Value
-
- return query, args
-
- }
-
- if _, ok := arg.(driver.Valuer); ok {
-
- // driver.Valuer will be converted to driver.Value.
-
- return query, args
-
- }
-
- return expandNamedQuery(m, query, argval.FieldByName)
-
-}
-
-var keyRegexp = regexp.MustCompile(`:[[:word:]]+`)
-
-// expandNamedQuery accepts a query with placeholders of the form ":key", and a
-
-// single arg of Kind Struct or Map[string]. It returns the query with the
-
-// dialect's placeholders, and a slice of args ready for positional insertion
-
-// into the query.
-
-func expandNamedQuery(m *DbMap, query string, keyGetter func(key string) reflect.Value) (string, []interface{}) {
-
- var (
- n int
-
- args []interface{}
- )
-
- return keyRegexp.ReplaceAllStringFunc(query, func(key string) string {
-
- val := keyGetter(key[1:])
-
- if !val.IsValid() {
-
- return key
-
- }
-
- args = append(args, val.Interface())
-
- newVar := m.Dialect.BindVar(n)
-
- n++
-
- return newVar
-
- }), args
-
-}
-
-func columnToFieldIndex(m *DbMap, t reflect.Type, name string, cols []string) ([][]int, error) {
-
- colToFieldIndex := make([][]int, len(cols))
-
- // check if type t is a mapped table - if so we'll
-
- // check the table for column aliasing below
-
- tableMapped := false
-
- table := tableOrNil(m, t, name)
-
- if table != nil {
-
- tableMapped = true
-
- }
-
- // Loop over column names and find field in i to bind to
-
- // based on column name. all returned columns must match
-
- // a field in the i struct
-
- missingColNames := []string{}
-
- for x := range cols {
-
- colName := strings.ToLower(cols[x])
-
- field, found := t.FieldByNameFunc(func(fieldName string) bool {
-
- field, _ := t.FieldByName(fieldName)
-
- cArguments := strings.Split(field.Tag.Get("db"), ",")
-
- fieldName = cArguments[0]
-
- if fieldName == "-" {
-
- return false
-
- } else if fieldName == "" {
-
- fieldName = field.Name
-
- }
-
- if tableMapped {
-
- colMap := colMapOrNil(table, fieldName)
-
- if colMap != nil {
-
- fieldName = colMap.ColumnName
-
- }
-
- }
-
- return colName == strings.ToLower(fieldName)
-
- })
-
- if found {
-
- colToFieldIndex[x] = field.Index
-
- }
-
- if colToFieldIndex[x] == nil {
-
- missingColNames = append(missingColNames, colName)
-
- }
-
- }
-
- if len(missingColNames) > 0 {
-
- return colToFieldIndex, &NoFieldInTypeError{
-
- TypeName: t.Name(),
-
- MissingColNames: missingColNames,
- }
-
- }
-
- return colToFieldIndex, nil
-
-}
-
-func fieldByName(val reflect.Value, fieldName string) *reflect.Value {
-
- // try to find field by exact match
-
- f := val.FieldByName(fieldName)
-
- if f != zeroVal {
-
- return &f
-
- }
-
- // try to find by case insensitive match - only the Postgres driver
-
- // seems to require this - in the case where columns are aliased in the sql
-
- fieldNameL := strings.ToLower(fieldName)
-
- fieldCount := val.NumField()
-
- t := val.Type()
-
- for i := 0; i < fieldCount; i++ {
-
- sf := t.Field(i)
-
- if strings.ToLower(sf.Name) == fieldNameL {
-
- f := val.Field(i)
-
- return &f
-
- }
-
- }
-
- return nil
-
-}
-
-// toSliceType returns the element type of the given object, if the object is a
-
-// "*[]*Element" or "*[]Element". If not, returns nil.
-
-// err is returned if the user was trying to pass a pointer-to-slice but failed.
-
-func toSliceType(i interface{}) (reflect.Type, error) {
-
- t := reflect.TypeOf(i)
-
- if t.Kind() != reflect.Ptr {
-
- // If it's a slice, return a more helpful error message
-
- if t.Kind() == reflect.Slice {
-
- return nil, fmt.Errorf("gorp: cannot SELECT into a non-pointer slice: %v", t)
-
- }
-
- return nil, nil
-
- }
-
- if t = t.Elem(); t.Kind() != reflect.Slice {
-
- return nil, nil
-
- }
-
- return t.Elem(), nil
-
-}
-
-func toType(i interface{}) (reflect.Type, error) {
-
- t := reflect.TypeOf(i)
-
- // If a Pointer to a type, follow
-
- for t.Kind() == reflect.Ptr {
-
- t = t.Elem()
-
- }
-
- if t.Kind() != reflect.Struct {
-
- return nil, fmt.Errorf("gorp: cannot SELECT into this type: %v", reflect.TypeOf(i))
-
- }
-
- return t, nil
-
-}
-
-type foundTable struct {
- table *TableMap
-
- dynName *string
-}
-
-func tableFor(m *DbMap, t reflect.Type, i interface{}) (*foundTable, error) {
-
- if dyn, isDynamic := i.(DynamicTable); isDynamic {
-
- tableName := dyn.TableName()
-
- table, err := m.DynamicTableFor(tableName, true)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return &foundTable{
-
- table: table,
-
- dynName: &tableName,
- }, nil
-
- }
-
- table, err := m.TableFor(t, true)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return &foundTable{table: table}, nil
-
-}
-
-func get(m *DbMap, exec SqlExecutor, i interface{},
-
- keys ...interface{}) (interface{}, error) {
-
- t, err := toType(i)
-
- if err != nil {
-
- return nil, err
-
- }
-
- foundTable, err := tableFor(m, t, i)
-
- if err != nil {
-
- return nil, err
-
- }
-
- table := foundTable.table
-
- plan := table.bindGet()
-
- v := reflect.New(t)
-
- if foundTable.dynName != nil {
-
- retDyn := v.Interface().(DynamicTable)
-
- retDyn.SetTableName(*foundTable.dynName)
-
- }
-
- dest := make([]interface{}, len(plan.argFields))
-
- conv := m.TypeConverter
-
- custScan := make([]CustomScanner, 0)
-
- for x, fieldName := range plan.argFields {
-
- f := v.Elem().FieldByName(fieldName)
-
- target := f.Addr().Interface()
-
- if conv != nil {
-
- scanner, ok := conv.FromDb(target)
-
- if ok {
-
- target = scanner.Holder
-
- custScan = append(custScan, scanner)
-
- }
-
- }
-
- dest[x] = target
-
- }
-
- row := exec.QueryRow(plan.query, keys...)
-
- err = row.Scan(dest...)
-
- if err != nil {
-
- if err == sql.ErrNoRows {
-
- err = nil
-
- }
-
- return nil, err
-
- }
-
- for _, c := range custScan {
-
- err = c.Bind()
-
- if err != nil {
-
- return nil, err
-
- }
-
- }
-
- if v, ok := v.Interface().(HasPostGet); ok {
-
- err := v.PostGet(exec)
-
- if err != nil {
-
- return nil, err
-
- }
-
- }
-
- return v.Interface(), nil
-
-}
-
-func delete(m *DbMap, exec SqlExecutor, list ...interface{}) (int64, error) {
-
- count := int64(0)
-
- for _, ptr := range list {
-
- table, elem, err := m.tableForPointer(ptr, true)
-
- if err != nil {
-
- return -1, err
-
- }
-
- eval := elem.Addr().Interface()
-
- if v, ok := eval.(HasPreDelete); ok {
-
- err = v.PreDelete(exec)
-
- if err != nil {
-
- return -1, err
-
- }
-
- }
-
- bi, err := table.bindDelete(elem)
-
- if err != nil {
-
- return -1, err
-
- }
-
- res, err := exec.Exec(bi.query, bi.args...)
-
- if err != nil {
-
- return -1, err
-
- }
-
- rows, err := res.RowsAffected()
-
- if err != nil {
-
- return -1, err
-
- }
-
- if rows == 0 && bi.existingVersion > 0 {
-
- return lockError(m, exec, table.TableName,
-
- bi.existingVersion, elem, bi.keys...)
-
- }
-
- count += rows
-
- if v, ok := eval.(HasPostDelete); ok {
-
- err := v.PostDelete(exec)
-
- if err != nil {
-
- return -1, err
-
- }
-
- }
-
- }
-
- return count, nil
-
-}
-
-func update(m *DbMap, exec SqlExecutor, colFilter ColumnFilter, list ...interface{}) (int64, error) {
-
- count := int64(0)
-
- for _, ptr := range list {
-
- table, elem, err := m.tableForPointer(ptr, true)
-
- if err != nil {
-
- return -1, err
-
- }
-
- eval := elem.Addr().Interface()
-
- if v, ok := eval.(HasPreUpdate); ok {
-
- err = v.PreUpdate(exec)
-
- if err != nil {
-
- return -1, err
-
- }
-
- }
-
- bi, err := table.bindUpdate(elem, colFilter)
-
- if err != nil {
-
- return -1, err
-
- }
-
- res, err := exec.Exec(bi.query, bi.args...)
-
- if err != nil {
-
- return -1, err
-
- }
-
- rows, err := res.RowsAffected()
-
- if err != nil {
-
- return -1, err
-
- }
-
- if rows == 0 && bi.existingVersion > 0 {
-
- return lockError(m, exec, table.TableName,
-
- bi.existingVersion, elem, bi.keys...)
-
- }
-
- if bi.versField != "" {
-
- elem.FieldByName(bi.versField).SetInt(bi.existingVersion + 1)
-
- }
-
- count += rows
-
- if v, ok := eval.(HasPostUpdate); ok {
-
- err = v.PostUpdate(exec)
-
- if err != nil {
-
- return -1, err
-
- }
-
- }
-
- }
-
- return count, nil
-
-}
-
-func insert(m *DbMap, exec SqlExecutor, list ...interface{}) error {
-
- for _, ptr := range list {
-
- table, elem, err := m.tableForPointer(ptr, false)
-
- if err != nil {
-
- return err
-
- }
-
- eval := elem.Addr().Interface()
-
- if v, ok := eval.(HasPreInsert); ok {
-
- err := v.PreInsert(exec)
-
- if err != nil {
-
- return err
-
- }
-
- }
-
- bi, err := table.bindInsert(elem)
-
- if err != nil {
-
- return err
-
- }
-
- if bi.autoIncrIdx > -1 {
-
- f := elem.FieldByName(bi.autoIncrFieldName)
-
- switch inserter := m.Dialect.(type) {
-
- case IntegerAutoIncrInserter:
-
- id, err := inserter.InsertAutoIncr(exec, bi.query, bi.args...)
-
- if err != nil {
-
- return err
-
- }
-
- k := f.Kind()
-
- if (k == reflect.Int) || (k == reflect.Int16) || (k == reflect.Int32) || (k == reflect.Int64) {
-
- f.SetInt(id)
-
- } else if (k == reflect.Uint) || (k == reflect.Uint16) || (k == reflect.Uint32) || (k == reflect.Uint64) {
-
- f.SetUint(uint64(id))
-
- } else {
-
- return fmt.Errorf("gorp: cannot set autoincrement value on non-Int field. SQL=%s autoIncrIdx=%d autoIncrFieldName=%s", bi.query, bi.autoIncrIdx, bi.autoIncrFieldName)
-
- }
-
- case TargetedAutoIncrInserter:
-
- err := inserter.InsertAutoIncrToTarget(exec, bi.query, f.Addr().Interface(), bi.args...)
-
- if err != nil {
-
- return err
-
- }
-
- case TargetQueryInserter:
-
- var idQuery = table.ColMap(bi.autoIncrFieldName).GeneratedIdQuery
-
- if idQuery == "" {
-
- return fmt.Errorf("gorp: cannot set %s value if its ColumnMap.GeneratedIdQuery is empty", bi.autoIncrFieldName)
-
- }
-
- err := inserter.InsertQueryToTarget(exec, bi.query, idQuery, f.Addr().Interface(), bi.args...)
-
- if err != nil {
-
- return err
-
- }
-
- default:
-
- return fmt.Errorf("gorp: cannot use autoincrement fields on dialects that do not implement an autoincrementing interface")
-
- }
-
- } else {
-
- _, err := exec.Exec(bi.query, bi.args...)
-
- if err != nil {
-
- return err
-
- }
-
- }
-
- if v, ok := eval.(HasPostInsert); ok {
-
- err := v.PostInsert(exec)
-
- if err != nil {
-
- return err
-
- }
-
- }
-
- }
-
- return nil
-
-}
-
-func exec(e SqlExecutor, query string, args ...interface{}) (sql.Result, error) {
-
- executor, ctx := extractExecutorAndContext(e)
-
- if ctx != nil {
-
- return executor.ExecContext(ctx, query, args...)
-
- }
-
- return executor.Exec(query, args...)
-
-}
-
-func prepare(e SqlExecutor, query string) (*sql.Stmt, error) {
-
- executor, ctx := extractExecutorAndContext(e)
-
- if ctx != nil {
-
- return executor.PrepareContext(ctx, query)
-
- }
-
- return executor.Prepare(query)
-
-}
-
-func queryRow(e SqlExecutor, query string, args ...interface{}) *sql.Row {
-
- executor, ctx := extractExecutorAndContext(e)
-
- if ctx != nil {
-
- return executor.QueryRowContext(ctx, query, args...)
-
- }
-
- return executor.QueryRow(query, args...)
-
-}
-
-func query(e SqlExecutor, query string, args ...interface{}) (*sql.Rows, error) {
-
- executor, ctx := extractExecutorAndContext(e)
-
- if ctx != nil {
-
- return executor.QueryContext(ctx, query, args...)
-
- }
-
- return executor.Query(query, args...)
-
-}
-
-func begin(m *DbMap) (*sql.Tx, error) {
-
- if m.ctx != nil {
-
- return m.Db.BeginTx(m.ctx, nil)
-
- }
-
- return m.Db.Begin()
-
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/hooks.go b/vendor/github.com/go-gorp/gorp/v3/hooks.go
deleted file mode 100644
index 1e80bca..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/hooks.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package gorp
-
-//++ TODO v2-phase3: HasPostGet => PostGetter, HasPostDelete => PostDeleter, etc.
-
-// HasPostGet provides PostGet() which will be executed after the GET statement.
-type HasPostGet interface {
- PostGet(SqlExecutor) error
-}
-
-// HasPostDelete provides PostDelete() which will be executed after the DELETE statement
-type HasPostDelete interface {
- PostDelete(SqlExecutor) error
-}
-
-// HasPostUpdate provides PostUpdate() which will be executed after the UPDATE statement
-type HasPostUpdate interface {
- PostUpdate(SqlExecutor) error
-}
-
-// HasPostInsert provides PostInsert() which will be executed after the INSERT statement
-type HasPostInsert interface {
- PostInsert(SqlExecutor) error
-}
-
-// HasPreDelete provides PreDelete() which will be executed before the DELETE statement.
-type HasPreDelete interface {
- PreDelete(SqlExecutor) error
-}
-
-// HasPreUpdate provides PreUpdate() which will be executed before UPDATE statement.
-type HasPreUpdate interface {
- PreUpdate(SqlExecutor) error
-}
-
-// HasPreInsert provides PreInsert() which will be executed before INSERT statement.
-type HasPreInsert interface {
- PreInsert(SqlExecutor) error
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/index.go b/vendor/github.com/go-gorp/gorp/v3/index.go
deleted file mode 100644
index df1cf55..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/index.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package gorp
-
-// IndexMap represents a mapping between a Go struct field and a single
-// index in a table.
-// Unique and MaxSize only inform the
-// CreateTables() function and are not used by Insert/Update/Delete/Get.
-type IndexMap struct {
- // Index name in db table
- IndexName string
-
- // If true, " unique" is added to create index statements.
- // Not used elsewhere
- Unique bool
-
- // Index type supported by Dialect
- // Postgres: B-tree, Hash, GiST and GIN.
- // Mysql: Btree, Hash.
- // Sqlite: nil.
- IndexType string
-
- // Columns name for single and multiple indexes
- columns []string
-}
-
-// Rename allows you to specify the index name in the table
-//
-// Example: table.IndMap("customer_test_idx").Rename("customer_idx")
-//
-func (idx *IndexMap) Rename(indname string) *IndexMap {
- idx.IndexName = indname
- return idx
-}
-
-// SetUnique adds "unique" to the create index statements for this
-// index, if b is true.
-func (idx *IndexMap) SetUnique(b bool) *IndexMap {
- idx.Unique = b
- return idx
-}
-
-// SetIndexType specifies the index type supported by chousen SQL Dialect
-func (idx *IndexMap) SetIndexType(indtype string) *IndexMap {
- idx.IndexType = indtype
- return idx
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/lockerror.go b/vendor/github.com/go-gorp/gorp/v3/lockerror.go
deleted file mode 100644
index 6c1ff5e..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/lockerror.go
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import (
- "fmt"
- "reflect"
-)
-
-// OptimisticLockError is returned by Update() or Delete() if the
-
-// struct being modified has a Version field and the value is not equal to
-
-// the current value in the database
-
-type OptimisticLockError struct {
-
- // Table name where the lock error occurred
-
- TableName string
-
- // Primary key values of the row being updated/deleted
-
- Keys []interface{}
-
- // true if a row was found with those keys, indicating the
-
- // LocalVersion is stale. false if no value was found with those
-
- // keys, suggesting the row has been deleted since loaded, or
-
- // was never inserted to begin with
-
- RowExists bool
-
- // Version value on the struct passed to Update/Delete. This value is
-
- // out of sync with the database.
-
- LocalVersion int64
-}
-
-// Error returns a description of the cause of the lock error
-
-func (e OptimisticLockError) Error() string {
-
- if e.RowExists {
-
- return fmt.Sprintf("gorp: OptimisticLockError table=%s keys=%v out of date version=%d", e.TableName, e.Keys, e.LocalVersion)
-
- }
-
- return fmt.Sprintf("gorp: OptimisticLockError no row found for table=%s keys=%v", e.TableName, e.Keys)
-
-}
-
-func lockError(m *DbMap, exec SqlExecutor, tableName string,
-
- existingVer int64, elem reflect.Value,
-
- keys ...interface{}) (int64, error) {
-
- existing, err := get(m, exec, elem.Interface(), keys...)
-
- if err != nil {
-
- return -1, err
-
- }
-
- ole := OptimisticLockError{tableName, keys, true, existingVer}
-
- if existing == nil {
-
- ole.RowExists = false
-
- }
-
- return -1, ole
-
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/logging.go b/vendor/github.com/go-gorp/gorp/v3/logging.go
deleted file mode 100644
index e8cba3d..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/logging.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import "fmt"
-
-// GorpLogger is a deprecated alias of Logger.
-type GorpLogger = Logger
-
-// Logger is the type that gorp uses to log SQL statements.
-// See DbMap.TraceOn.
-type Logger interface {
- Printf(format string, v ...interface{})
-}
-
-// TraceOn turns on SQL statement logging for this DbMap. After this is
-// called, all SQL statements will be sent to the logger. If prefix is
-// a non-empty string, it will be written to the front of all logged
-// strings, which can aid in filtering log lines.
-//
-// Use TraceOn if you want to spy on the SQL statements that gorp
-// generates.
-//
-// Note that the base log.Logger type satisfies Logger, but adapters can
-// easily be written for other logging packages (e.g., the golang-sanctioned
-// glog framework).
-func (m *DbMap) TraceOn(prefix string, logger Logger) {
- m.logger = logger
- if prefix == "" {
- m.logPrefix = prefix
- } else {
- m.logPrefix = fmt.Sprintf("%s ", prefix)
- }
-}
-
-// TraceOff turns off tracing. It is idempotent.
-func (m *DbMap) TraceOff() {
- m.logger = nil
- m.logPrefix = ""
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/nulltypes.go b/vendor/github.com/go-gorp/gorp/v3/nulltypes.go
deleted file mode 100644
index 81da1f7..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/nulltypes.go
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import (
- "database/sql/driver"
- "log"
- "time"
-)
-
-// A nullable Time value
-
-type NullTime struct {
- Time time.Time
-
- Valid bool // Valid is true if Time is not NULL
-
-}
-
-// Scan implements the Scanner interface.
-
-func (nt *NullTime) Scan(value interface{}) error {
-
- log.Printf("Time scan value is: %#v", value)
-
- switch t := value.(type) {
-
- case time.Time:
-
- nt.Time, nt.Valid = t, true
-
- case []byte:
-
- v := strToTime(string(t))
-
- if v != nil {
-
- nt.Valid = true
-
- nt.Time = *v
-
- }
-
- case string:
-
- v := strToTime(t)
-
- if v != nil {
-
- nt.Valid = true
-
- nt.Time = *v
-
- }
-
- }
-
- return nil
-
-}
-
-func strToTime(v string) *time.Time {
-
- for _, dtfmt := range []string{
-
- "2006-01-02 15:04:05.999999999",
-
- "2006-01-02T15:04:05.999999999",
-
- "2006-01-02 15:04:05",
-
- "2006-01-02T15:04:05",
-
- "2006-01-02 15:04",
-
- "2006-01-02T15:04",
-
- "2006-01-02",
-
- "2006-01-02 15:04:05-07:00",
- } {
-
- if t, err := time.Parse(dtfmt, v); err == nil {
-
- return &t
-
- }
-
- }
-
- return nil
-
-}
-
-// Value implements the driver Valuer interface.
-
-func (nt NullTime) Value() (driver.Value, error) {
-
- if !nt.Valid {
-
- return nil, nil
-
- }
-
- return nt.Time, nil
-
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/select.go b/vendor/github.com/go-gorp/gorp/v3/select.go
deleted file mode 100644
index 9ca2bae..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/select.go
+++ /dev/null
@@ -1,616 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import (
- "database/sql"
- "fmt"
- "reflect"
-)
-
-// SelectInt executes the given query, which should be a SELECT statement for a single
-
-// integer column, and returns the value of the first row returned. If no rows are
-
-// found, zero is returned.
-
-func SelectInt(e SqlExecutor, query string, args ...interface{}) (int64, error) {
-
- var h int64
-
- err := selectVal(e, &h, query, args...)
-
- if err != nil && err != sql.ErrNoRows {
-
- return 0, err
-
- }
-
- return h, nil
-
-}
-
-// SelectNullInt executes the given query, which should be a SELECT statement for a single
-
-// integer column, and returns the value of the first row returned. If no rows are
-
-// found, the empty sql.NullInt64 value is returned.
-
-func SelectNullInt(e SqlExecutor, query string, args ...interface{}) (sql.NullInt64, error) {
-
- var h sql.NullInt64
-
- err := selectVal(e, &h, query, args...)
-
- if err != nil && err != sql.ErrNoRows {
-
- return h, err
-
- }
-
- return h, nil
-
-}
-
-// SelectFloat executes the given query, which should be a SELECT statement for a single
-
-// float column, and returns the value of the first row returned. If no rows are
-
-// found, zero is returned.
-
-func SelectFloat(e SqlExecutor, query string, args ...interface{}) (float64, error) {
-
- var h float64
-
- err := selectVal(e, &h, query, args...)
-
- if err != nil && err != sql.ErrNoRows {
-
- return 0, err
-
- }
-
- return h, nil
-
-}
-
-// SelectNullFloat executes the given query, which should be a SELECT statement for a single
-
-// float column, and returns the value of the first row returned. If no rows are
-
-// found, the empty sql.NullInt64 value is returned.
-
-func SelectNullFloat(e SqlExecutor, query string, args ...interface{}) (sql.NullFloat64, error) {
-
- var h sql.NullFloat64
-
- err := selectVal(e, &h, query, args...)
-
- if err != nil && err != sql.ErrNoRows {
-
- return h, err
-
- }
-
- return h, nil
-
-}
-
-// SelectStr executes the given query, which should be a SELECT statement for a single
-
-// char/varchar column, and returns the value of the first row returned. If no rows are
-
-// found, an empty string is returned.
-
-func SelectStr(e SqlExecutor, query string, args ...interface{}) (string, error) {
-
- var h string
-
- err := selectVal(e, &h, query, args...)
-
- if err != nil && err != sql.ErrNoRows {
-
- return "", err
-
- }
-
- return h, nil
-
-}
-
-// SelectNullStr executes the given query, which should be a SELECT
-
-// statement for a single char/varchar column, and returns the value
-
-// of the first row returned. If no rows are found, the empty
-
-// sql.NullString is returned.
-
-func SelectNullStr(e SqlExecutor, query string, args ...interface{}) (sql.NullString, error) {
-
- var h sql.NullString
-
- err := selectVal(e, &h, query, args...)
-
- if err != nil && err != sql.ErrNoRows {
-
- return h, err
-
- }
-
- return h, nil
-
-}
-
-// SelectOne executes the given query (which should be a SELECT statement)
-
-// and binds the result to holder, which must be a pointer.
-
-//
-
-// # If no row is found, an error (sql.ErrNoRows specifically) will be returned
-
-//
-
-// If more than one row is found, an error will be returned.
-
-func SelectOne(m *DbMap, e SqlExecutor, holder interface{}, query string, args ...interface{}) error {
-
- t := reflect.TypeOf(holder)
-
- if t.Kind() == reflect.Ptr {
-
- t = t.Elem()
-
- } else {
-
- return fmt.Errorf("gorp: SelectOne holder must be a pointer, but got: %t", holder)
-
- }
-
- // Handle pointer to pointer
-
- isptr := false
-
- if t.Kind() == reflect.Ptr {
-
- isptr = true
-
- t = t.Elem()
-
- }
-
- if t.Kind() == reflect.Struct {
-
- var nonFatalErr error
-
- list, err := hookedselect(m, e, holder, query, args...)
-
- if err != nil {
-
- if !NonFatalError(err) { // FIXME: double negative, rename NonFatalError to FatalError
-
- return err
-
- }
-
- nonFatalErr = err
-
- }
-
- dest := reflect.ValueOf(holder)
-
- if isptr {
-
- dest = dest.Elem()
-
- }
-
- if list != nil && len(list) > 0 { // FIXME: invert if/else
-
- // check for multiple rows
-
- if len(list) > 1 {
-
- return fmt.Errorf("gorp: multiple rows returned for: %s - %v", query, args)
-
- }
-
- // Initialize if nil
-
- if dest.IsNil() {
-
- dest.Set(reflect.New(t))
-
- }
-
- // only one row found
-
- src := reflect.ValueOf(list[0])
-
- dest.Elem().Set(src.Elem())
-
- } else {
-
- // No rows found, return a proper error.
-
- return sql.ErrNoRows
-
- }
-
- return nonFatalErr
-
- }
-
- return selectVal(e, holder, query, args...)
-
-}
-
-func selectVal(e SqlExecutor, holder interface{}, query string, args ...interface{}) error {
-
- if len(args) == 1 {
-
- switch m := e.(type) {
-
- case *DbMap:
-
- query, args = maybeExpandNamedQuery(m, query, args)
-
- case *Transaction:
-
- query, args = maybeExpandNamedQuery(m.dbmap, query, args)
-
- }
-
- }
-
- rows, err := e.Query(query, args...)
-
- if err != nil {
-
- return err
-
- }
-
- defer rows.Close()
-
- if !rows.Next() {
-
- if err := rows.Err(); err != nil {
-
- return err
-
- }
-
- return sql.ErrNoRows
-
- }
-
- return rows.Scan(holder)
-
-}
-
-func hookedselect(m *DbMap, exec SqlExecutor, i interface{}, query string,
-
- args ...interface{}) ([]interface{}, error) {
-
- var nonFatalErr error
-
- list, err := rawselect(m, exec, i, query, args...)
-
- if err != nil {
-
- if !NonFatalError(err) {
-
- return nil, err
-
- }
-
- nonFatalErr = err
-
- }
-
- // Determine where the results are: written to i, or returned in list
-
- if t, _ := toSliceType(i); t == nil {
-
- for _, v := range list {
-
- if v, ok := v.(HasPostGet); ok {
-
- err := v.PostGet(exec)
-
- if err != nil {
-
- return nil, err
-
- }
-
- }
-
- }
-
- } else {
-
- resultsValue := reflect.Indirect(reflect.ValueOf(i))
-
- for i := 0; i < resultsValue.Len(); i++ {
-
- if v, ok := resultsValue.Index(i).Interface().(HasPostGet); ok {
-
- err := v.PostGet(exec)
-
- if err != nil {
-
- return nil, err
-
- }
-
- }
-
- }
-
- }
-
- return list, nonFatalErr
-
-}
-
-func rawselect(m *DbMap, exec SqlExecutor, i interface{}, query string,
-
- args ...interface{}) ([]interface{}, error) {
-
- var (
- appendToSlice = false // Write results to i directly?
-
- intoStruct = true // Selecting into a struct?
-
- pointerElements = true // Are the slice elements pointers (vs values)?
-
- )
-
- var nonFatalErr error
-
- tableName := ""
-
- var dynObj DynamicTable
-
- isDynamic := false
-
- if dynObj, isDynamic = i.(DynamicTable); isDynamic {
-
- tableName = dynObj.TableName()
-
- }
-
- // get type for i, verifying it's a supported destination
-
- t, err := toType(i)
-
- if err != nil {
-
- var err2 error
-
- if t, err2 = toSliceType(i); t == nil {
-
- if err2 != nil {
-
- return nil, err2
-
- }
-
- return nil, err
-
- }
-
- pointerElements = t.Kind() == reflect.Ptr
-
- if pointerElements {
-
- t = t.Elem()
-
- }
-
- appendToSlice = true
-
- intoStruct = t.Kind() == reflect.Struct
-
- }
-
- // If the caller supplied a single struct/map argument, assume a "named
-
- // parameter" query. Extract the named arguments from the struct/map, create
-
- // the flat arg slice, and rewrite the query to use the dialect's placeholder.
-
- if len(args) == 1 {
-
- query, args = maybeExpandNamedQuery(m, query, args)
-
- }
-
- // Run the query
-
- rows, err := exec.Query(query, args...)
-
- if err != nil {
-
- return nil, err
-
- }
-
- defer rows.Close()
-
- // Fetch the column names as returned from db
-
- cols, err := rows.Columns()
-
- if err != nil {
-
- return nil, err
-
- }
-
- if !intoStruct && len(cols) > 1 {
-
- return nil, fmt.Errorf("gorp: select into non-struct slice requires 1 column, got %d", len(cols))
-
- }
-
- var colToFieldIndex [][]int
-
- if intoStruct {
-
- colToFieldIndex, err = columnToFieldIndex(m, t, tableName, cols)
-
- if err != nil {
-
- if !NonFatalError(err) {
-
- return nil, err
-
- }
-
- nonFatalErr = err
-
- }
-
- }
-
- conv := m.TypeConverter
-
- // Add results to one of these two slices.
-
- var (
- list = make([]interface{}, 0)
-
- sliceValue = reflect.Indirect(reflect.ValueOf(i))
- )
-
- for {
-
- if !rows.Next() {
-
- // if error occured return rawselect
-
- if rows.Err() != nil {
-
- return nil, rows.Err()
-
- }
-
- // time to exit from outer "for" loop
-
- break
-
- }
-
- v := reflect.New(t)
-
- if isDynamic {
-
- v.Interface().(DynamicTable).SetTableName(tableName)
-
- }
-
- dest := make([]interface{}, len(cols))
-
- custScan := make([]CustomScanner, 0)
-
- for x := range cols {
-
- f := v.Elem()
-
- if intoStruct {
-
- index := colToFieldIndex[x]
-
- if index == nil {
-
- // this field is not present in the struct, so create a dummy
-
- // value for rows.Scan to scan into
-
- var dummy dummyField
-
- dest[x] = &dummy
-
- continue
-
- }
-
- f = f.FieldByIndex(index)
-
- }
-
- target := f.Addr().Interface()
-
- if conv != nil {
-
- scanner, ok := conv.FromDb(target)
-
- if ok {
-
- target = scanner.Holder
-
- custScan = append(custScan, scanner)
-
- }
-
- }
-
- dest[x] = target
-
- }
-
- err = rows.Scan(dest...)
-
- if err != nil {
-
- return nil, err
-
- }
-
- for _, c := range custScan {
-
- err = c.Bind()
-
- if err != nil {
-
- return nil, err
-
- }
-
- }
-
- if appendToSlice {
-
- if !pointerElements {
-
- v = v.Elem()
-
- }
-
- sliceValue.Set(reflect.Append(sliceValue, v))
-
- } else {
-
- list = append(list, v.Interface())
-
- }
-
- }
-
- if appendToSlice && sliceValue.IsNil() {
-
- sliceValue.Set(reflect.MakeSlice(sliceValue.Type(), 0, 0))
-
- }
-
- return list, nonFatalErr
-
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/table.go b/vendor/github.com/go-gorp/gorp/v3/table.go
deleted file mode 100644
index d3c16d3..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/table.go
+++ /dev/null
@@ -1,455 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "strings"
-)
-
-// TableMap represents a mapping between a Go struct and a database table
-
-// Use dbmap.AddTable() or dbmap.AddTableWithName() to create these
-
-type TableMap struct {
-
- // Name of database table.
-
- TableName string
-
- SchemaName string
-
- gotype reflect.Type
-
- Columns []*ColumnMap
-
- keys []*ColumnMap
-
- indexes []*IndexMap
-
- uniqueTogether [][]string
-
- version *ColumnMap
-
- insertPlan bindPlan
-
- updatePlan bindPlan
-
- deletePlan bindPlan
-
- getPlan bindPlan
-
- dbmap *DbMap
-}
-
-// ResetSql removes cached insert/update/select/delete SQL strings
-
-// associated with this TableMap. Call this if you've modified
-
-// any column names or the table name itself.
-
-func (t *TableMap) ResetSql() {
-
- t.insertPlan = bindPlan{}
-
- t.updatePlan = bindPlan{}
-
- t.deletePlan = bindPlan{}
-
- t.getPlan = bindPlan{}
-
-}
-
-// SetKeys lets you specify the fields on a struct that map to primary
-
-// key columns on the table. If isAutoIncr is set, result.LastInsertId()
-
-// will be used after INSERT to bind the generated id to the Go struct.
-
-//
-
-// Automatically calls ResetSql() to ensure SQL statements are regenerated.
-
-//
-
-// Panics if isAutoIncr is true, and fieldNames length != 1
-
-func (t *TableMap) SetKeys(isAutoIncr bool, fieldNames ...string) *TableMap {
-
- if isAutoIncr && len(fieldNames) != 1 {
-
- panic(fmt.Sprintf(
-
- "gorp: SetKeys: fieldNames length must be 1 if key is auto-increment. (Saw %v fieldNames)",
-
- len(fieldNames)))
-
- }
-
- t.keys = make([]*ColumnMap, 0)
-
- for _, name := range fieldNames {
-
- colmap := t.ColMap(name)
-
- colmap.isPK = true
-
- colmap.isAutoIncr = isAutoIncr
-
- t.keys = append(t.keys, colmap)
-
- }
-
- t.ResetSql()
-
- return t
-
-}
-
-// SetUniqueTogether lets you specify uniqueness constraints across multiple
-
-// columns on the table. Each call adds an additional constraint for the
-
-// specified columns.
-
-//
-
-// Automatically calls ResetSql() to ensure SQL statements are regenerated.
-
-//
-
-// Panics if fieldNames length < 2.
-
-func (t *TableMap) SetUniqueTogether(fieldNames ...string) *TableMap {
-
- if len(fieldNames) < 2 {
-
- panic(fmt.Sprintf(
-
- "gorp: SetUniqueTogether: must provide at least two fieldNames to set uniqueness constraint."))
-
- }
-
- columns := make([]string, 0, len(fieldNames))
-
- for _, name := range fieldNames {
-
- columns = append(columns, name)
-
- }
-
- for _, existingColumns := range t.uniqueTogether {
-
- if equal(existingColumns, columns) {
-
- return t
-
- }
-
- }
-
- t.uniqueTogether = append(t.uniqueTogether, columns)
-
- t.ResetSql()
-
- return t
-
-}
-
-// ColMap returns the ColumnMap pointer matching the given struct field
-
-// name. It panics if the struct does not contain a field matching this
-
-// name.
-
-func (t *TableMap) ColMap(field string) *ColumnMap {
-
- col := colMapOrNil(t, field)
-
- if col == nil {
-
- e := fmt.Sprintf("No ColumnMap in table %s type %s with field %s",
-
- t.TableName, t.gotype.Name(), field)
-
- panic(e)
-
- }
-
- return col
-
-}
-
-func colMapOrNil(t *TableMap, field string) *ColumnMap {
-
- for _, col := range t.Columns {
-
- if col.fieldName == field || col.ColumnName == field {
-
- return col
-
- }
-
- }
-
- return nil
-
-}
-
-// IdxMap returns the IndexMap pointer matching the given index name.
-
-func (t *TableMap) IdxMap(field string) *IndexMap {
-
- for _, idx := range t.indexes {
-
- if idx.IndexName == field {
-
- return idx
-
- }
-
- }
-
- return nil
-
-}
-
-// AddIndex registers the index with gorp for specified table with given parameters.
-
-// This operation is idempotent. If index is already mapped, the
-
-// existing *IndexMap is returned
-
-// Function will panic if one of the given for index columns does not exists
-
-//
-
-// Automatically calls ResetSql() to ensure SQL statements are regenerated.
-
-func (t *TableMap) AddIndex(name string, idxtype string, columns []string) *IndexMap {
-
- // check if we have a index with this name already
-
- for _, idx := range t.indexes {
-
- if idx.IndexName == name {
-
- return idx
-
- }
-
- }
-
- for _, icol := range columns {
-
- if res := t.ColMap(icol); res == nil {
-
- e := fmt.Sprintf("No ColumnName in table %s to create index on", t.TableName)
-
- panic(e)
-
- }
-
- }
-
- idx := &IndexMap{IndexName: name, Unique: false, IndexType: idxtype, columns: columns}
-
- t.indexes = append(t.indexes, idx)
-
- t.ResetSql()
-
- return idx
-
-}
-
-// SetVersionCol sets the column to use as the Version field. By default
-
-// the "Version" field is used. Returns the column found, or panics
-
-// if the struct does not contain a field matching this name.
-
-//
-
-// Automatically calls ResetSql() to ensure SQL statements are regenerated.
-
-func (t *TableMap) SetVersionCol(field string) *ColumnMap {
-
- c := t.ColMap(field)
-
- t.version = c
-
- t.ResetSql()
-
- return c
-
-}
-
-// SqlForCreateTable gets a sequence of SQL commands that will create
-
-// the specified table and any associated schema
-
-func (t *TableMap) SqlForCreate(ifNotExists bool) string {
-
- s := bytes.Buffer{}
-
- dialect := t.dbmap.Dialect
-
- if strings.TrimSpace(t.SchemaName) != "" {
-
- schemaCreate := "create schema"
-
- if ifNotExists {
-
- s.WriteString(dialect.IfSchemaNotExists(schemaCreate, t.SchemaName))
-
- } else {
-
- s.WriteString(schemaCreate)
-
- }
-
- s.WriteString(fmt.Sprintf(" %s;", t.SchemaName))
-
- }
-
- tableCreate := "create table"
-
- if ifNotExists {
-
- s.WriteString(dialect.IfTableNotExists(tableCreate, t.SchemaName, t.TableName))
-
- } else {
-
- s.WriteString(tableCreate)
-
- }
-
- s.WriteString(fmt.Sprintf(" %s (", dialect.QuotedTableForQuery(t.SchemaName, t.TableName)))
-
- x := 0
-
- for _, col := range t.Columns {
-
- if !col.Transient {
-
- if x > 0 {
-
- s.WriteString(", ")
-
- }
-
- stype := dialect.ToSqlType(col.gotype, col.MaxSize, col.isAutoIncr)
-
- s.WriteString(fmt.Sprintf("%s %s", dialect.QuoteField(col.ColumnName), stype))
-
- if col.isPK || col.isNotNull {
-
- s.WriteString(" not null")
-
- }
-
- if col.isPK && len(t.keys) == 1 {
-
- s.WriteString(" primary key")
-
- }
-
- if col.Unique {
-
- s.WriteString(" unique")
-
- }
-
- if col.isAutoIncr {
-
- s.WriteString(fmt.Sprintf(" %s", dialect.AutoIncrStr()))
-
- }
-
- x++
-
- }
-
- }
-
- if len(t.keys) > 1 {
-
- s.WriteString(", primary key (")
-
- for x := range t.keys {
-
- if x > 0 {
-
- s.WriteString(", ")
-
- }
-
- s.WriteString(dialect.QuoteField(t.keys[x].ColumnName))
-
- }
-
- s.WriteString(")")
-
- }
-
- if len(t.uniqueTogether) > 0 {
-
- for _, columns := range t.uniqueTogether {
-
- s.WriteString(", unique (")
-
- for i, column := range columns {
-
- if i > 0 {
-
- s.WriteString(", ")
-
- }
-
- s.WriteString(dialect.QuoteField(column))
-
- }
-
- s.WriteString(")")
-
- }
-
- }
-
- s.WriteString(") ")
-
- s.WriteString(dialect.CreateTableSuffix())
-
- s.WriteString(dialect.QuerySuffix())
-
- return s.String()
-
-}
-
-func equal(a, b []string) bool {
-
- if len(a) != len(b) {
-
- return false
-
- }
-
- for i := range a {
-
- if a[i] != b[i] {
-
- return false
-
- }
-
- }
-
- return true
-
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/table_bindings.go b/vendor/github.com/go-gorp/gorp/v3/table_bindings.go
deleted file mode 100644
index 106afd0..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/table_bindings.go
+++ /dev/null
@@ -1,521 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "sync"
-)
-
-// CustomScanner binds a database column value to a Go type
-
-type CustomScanner struct {
-
- // After a row is scanned, Holder will contain the value from the database column.
-
- // Initialize the CustomScanner with the concrete Go type you wish the database
-
- // driver to scan the raw column into.
-
- Holder interface{}
-
- // Target typically holds a pointer to the target struct field to bind the Holder
-
- // value to.
-
- Target interface{}
-
- // Binder is a custom function that converts the holder value to the target type
-
- // and sets target accordingly. This function should return error if a problem
-
- // occurs converting the holder to the target.
-
- Binder func(holder interface{}, target interface{}) error
-}
-
-// Used to filter columns when selectively updating
-
-type ColumnFilter func(*ColumnMap) bool
-
-func acceptAllFilter(col *ColumnMap) bool {
-
- return true
-
-}
-
-// Bind is called automatically by gorp after Scan()
-
-func (me CustomScanner) Bind() error {
-
- return me.Binder(me.Holder, me.Target)
-
-}
-
-type bindPlan struct {
- query string
-
- argFields []string
-
- keyFields []string
-
- versField string
-
- autoIncrIdx int
-
- autoIncrFieldName string
-
- once sync.Once
-}
-
-func (plan *bindPlan) createBindInstance(elem reflect.Value, conv TypeConverter) (bindInstance, error) {
-
- bi := bindInstance{query: plan.query, autoIncrIdx: plan.autoIncrIdx, autoIncrFieldName: plan.autoIncrFieldName, versField: plan.versField}
-
- if plan.versField != "" {
-
- bi.existingVersion = elem.FieldByName(plan.versField).Int()
-
- }
-
- var err error
-
- for i := 0; i < len(plan.argFields); i++ {
-
- k := plan.argFields[i]
-
- if k == versFieldConst {
-
- newVer := bi.existingVersion + 1
-
- bi.args = append(bi.args, newVer)
-
- if bi.existingVersion == 0 {
-
- elem.FieldByName(plan.versField).SetInt(int64(newVer))
-
- }
-
- } else {
-
- val := elem.FieldByName(k).Interface()
-
- if conv != nil {
-
- val, err = conv.ToDb(val)
-
- if err != nil {
-
- return bindInstance{}, err
-
- }
-
- }
-
- bi.args = append(bi.args, val)
-
- }
-
- }
-
- for i := 0; i < len(plan.keyFields); i++ {
-
- k := plan.keyFields[i]
-
- val := elem.FieldByName(k).Interface()
-
- if conv != nil {
-
- val, err = conv.ToDb(val)
-
- if err != nil {
-
- return bindInstance{}, err
-
- }
-
- }
-
- bi.keys = append(bi.keys, val)
-
- }
-
- return bi, nil
-
-}
-
-type bindInstance struct {
- query string
-
- args []interface{}
-
- keys []interface{}
-
- existingVersion int64
-
- versField string
-
- autoIncrIdx int
-
- autoIncrFieldName string
-}
-
-func (t *TableMap) bindInsert(elem reflect.Value) (bindInstance, error) {
-
- plan := &t.insertPlan
-
- plan.once.Do(func() {
-
- plan.autoIncrIdx = -1
-
- s := bytes.Buffer{}
-
- s2 := bytes.Buffer{}
-
- s.WriteString(fmt.Sprintf("insert into %s (", t.dbmap.Dialect.QuotedTableForQuery(t.SchemaName, t.TableName)))
-
- x := 0
-
- first := true
-
- for y := range t.Columns {
-
- col := t.Columns[y]
-
- if !(col.isAutoIncr && t.dbmap.Dialect.AutoIncrBindValue() == "") {
-
- if !col.Transient {
-
- if !first {
-
- s.WriteString(",")
-
- s2.WriteString(",")
-
- }
-
- s.WriteString(t.dbmap.Dialect.QuoteField(col.ColumnName))
-
- if col.isAutoIncr {
-
- s2.WriteString(t.dbmap.Dialect.AutoIncrBindValue())
-
- plan.autoIncrIdx = y
-
- plan.autoIncrFieldName = col.fieldName
-
- } else {
-
- if col.DefaultValue == "" {
-
- s2.WriteString(t.dbmap.Dialect.BindVar(x))
-
- if col == t.version {
-
- plan.versField = col.fieldName
-
- plan.argFields = append(plan.argFields, versFieldConst)
-
- } else {
-
- plan.argFields = append(plan.argFields, col.fieldName)
-
- }
-
- x++
-
- } else {
-
- s2.WriteString(col.DefaultValue)
-
- }
-
- }
-
- first = false
-
- }
-
- } else {
-
- plan.autoIncrIdx = y
-
- plan.autoIncrFieldName = col.fieldName
-
- }
-
- }
-
- s.WriteString(") values (")
-
- s.WriteString(s2.String())
-
- s.WriteString(")")
-
- if plan.autoIncrIdx > -1 {
-
- s.WriteString(t.dbmap.Dialect.AutoIncrInsertSuffix(t.Columns[plan.autoIncrIdx]))
-
- }
-
- s.WriteString(t.dbmap.Dialect.QuerySuffix())
-
- plan.query = s.String()
-
- })
-
- return plan.createBindInstance(elem, t.dbmap.TypeConverter)
-
-}
-
-func (t *TableMap) bindUpdate(elem reflect.Value, colFilter ColumnFilter) (bindInstance, error) {
-
- if colFilter == nil {
-
- colFilter = acceptAllFilter
-
- }
-
- plan := &t.updatePlan
-
- plan.once.Do(func() {
-
- s := bytes.Buffer{}
-
- s.WriteString(fmt.Sprintf("update %s set ", t.dbmap.Dialect.QuotedTableForQuery(t.SchemaName, t.TableName)))
-
- x := 0
-
- for y := range t.Columns {
-
- col := t.Columns[y]
-
- if !col.isAutoIncr && !col.Transient && colFilter(col) {
-
- if x > 0 {
-
- s.WriteString(", ")
-
- }
-
- s.WriteString(t.dbmap.Dialect.QuoteField(col.ColumnName))
-
- s.WriteString("=")
-
- s.WriteString(t.dbmap.Dialect.BindVar(x))
-
- if col == t.version {
-
- plan.versField = col.fieldName
-
- plan.argFields = append(plan.argFields, versFieldConst)
-
- } else {
-
- plan.argFields = append(plan.argFields, col.fieldName)
-
- }
-
- x++
-
- }
-
- }
-
- s.WriteString(" where ")
-
- for y := range t.keys {
-
- col := t.keys[y]
-
- if y > 0 {
-
- s.WriteString(" and ")
-
- }
-
- s.WriteString(t.dbmap.Dialect.QuoteField(col.ColumnName))
-
- s.WriteString("=")
-
- s.WriteString(t.dbmap.Dialect.BindVar(x))
-
- plan.argFields = append(plan.argFields, col.fieldName)
-
- plan.keyFields = append(plan.keyFields, col.fieldName)
-
- x++
-
- }
-
- if plan.versField != "" {
-
- s.WriteString(" and ")
-
- s.WriteString(t.dbmap.Dialect.QuoteField(t.version.ColumnName))
-
- s.WriteString("=")
-
- s.WriteString(t.dbmap.Dialect.BindVar(x))
-
- plan.argFields = append(plan.argFields, plan.versField)
-
- }
-
- s.WriteString(t.dbmap.Dialect.QuerySuffix())
-
- plan.query = s.String()
-
- })
-
- return plan.createBindInstance(elem, t.dbmap.TypeConverter)
-
-}
-
-func (t *TableMap) bindDelete(elem reflect.Value) (bindInstance, error) {
-
- plan := &t.deletePlan
-
- plan.once.Do(func() {
-
- s := bytes.Buffer{}
-
- s.WriteString(fmt.Sprintf("delete from %s", t.dbmap.Dialect.QuotedTableForQuery(t.SchemaName, t.TableName)))
-
- for y := range t.Columns {
-
- col := t.Columns[y]
-
- if !col.Transient {
-
- if col == t.version {
-
- plan.versField = col.fieldName
-
- }
-
- }
-
- }
-
- s.WriteString(" where ")
-
- for x := range t.keys {
-
- k := t.keys[x]
-
- if x > 0 {
-
- s.WriteString(" and ")
-
- }
-
- s.WriteString(t.dbmap.Dialect.QuoteField(k.ColumnName))
-
- s.WriteString("=")
-
- s.WriteString(t.dbmap.Dialect.BindVar(x))
-
- plan.keyFields = append(plan.keyFields, k.fieldName)
-
- plan.argFields = append(plan.argFields, k.fieldName)
-
- }
-
- if plan.versField != "" {
-
- s.WriteString(" and ")
-
- s.WriteString(t.dbmap.Dialect.QuoteField(t.version.ColumnName))
-
- s.WriteString("=")
-
- s.WriteString(t.dbmap.Dialect.BindVar(len(plan.argFields)))
-
- plan.argFields = append(plan.argFields, plan.versField)
-
- }
-
- s.WriteString(t.dbmap.Dialect.QuerySuffix())
-
- plan.query = s.String()
-
- })
-
- return plan.createBindInstance(elem, t.dbmap.TypeConverter)
-
-}
-
-func (t *TableMap) bindGet() *bindPlan {
-
- plan := &t.getPlan
-
- plan.once.Do(func() {
-
- s := bytes.Buffer{}
-
- s.WriteString("select ")
-
- x := 0
-
- for _, col := range t.Columns {
-
- if !col.Transient {
-
- if x > 0 {
-
- s.WriteString(",")
-
- }
-
- s.WriteString(t.dbmap.Dialect.QuoteField(col.ColumnName))
-
- plan.argFields = append(plan.argFields, col.fieldName)
-
- x++
-
- }
-
- }
-
- s.WriteString(" from ")
-
- s.WriteString(t.dbmap.Dialect.QuotedTableForQuery(t.SchemaName, t.TableName))
-
- s.WriteString(" where ")
-
- for x := range t.keys {
-
- col := t.keys[x]
-
- if x > 0 {
-
- s.WriteString(" and ")
-
- }
-
- s.WriteString(t.dbmap.Dialect.QuoteField(col.ColumnName))
-
- s.WriteString("=")
-
- s.WriteString(t.dbmap.Dialect.BindVar(x))
-
- plan.keyFields = append(plan.keyFields, col.fieldName)
-
- }
-
- s.WriteString(t.dbmap.Dialect.QuerySuffix())
-
- plan.query = s.String()
-
- })
-
- return plan
-
-}
diff --git a/vendor/github.com/go-gorp/gorp/v3/test_all.sh b/vendor/github.com/go-gorp/gorp/v3/test_all.sh
deleted file mode 100644
index 91007d6..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/test_all.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash -ex
-
-# on macs, you may need to:
-# export GOBUILDFLAG=-ldflags -linkmode=external
-
-echo "Running unit tests"
-go test -race
-
-echo "Testing against postgres"
-export GORP_TEST_DSN="host=postgres user=gorptest password=gorptest dbname=gorptest sslmode=disable"
-export GORP_TEST_DIALECT=postgres
-go test -tags integration $GOBUILDFLAG $@ .
-
-echo "Testing against sqlite"
-export GORP_TEST_DSN=/tmp/gorptest.bin
-export GORP_TEST_DIALECT=sqlite
-go test -tags integration $GOBUILDFLAG $@ .
-rm -f /tmp/gorptest.bin
-
-echo "Testing against mysql"
-export GORP_TEST_DSN="gorptest:gorptest@tcp(mysql)/gorptest"
-export GORP_TEST_DIALECT=mysql
-go test -tags integration $GOBUILDFLAG $@ .
diff --git a/vendor/github.com/go-gorp/gorp/v3/transaction.go b/vendor/github.com/go-gorp/gorp/v3/transaction.go
deleted file mode 100644
index c1d59a9..0000000
--- a/vendor/github.com/go-gorp/gorp/v3/transaction.go
+++ /dev/null
@@ -1,393 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package gorp
-
-import (
- "context"
- "database/sql"
- "time"
-)
-
-// Transaction represents a database transaction.
-
-// Insert/Update/Delete/Get/Exec operations will be run in the context
-
-// of that transaction. Transactions should be terminated with
-
-// a call to Commit() or Rollback()
-
-type Transaction struct {
- ctx context.Context
-
- dbmap *DbMap
-
- tx *sql.Tx
-
- closed bool
-}
-
-func (t *Transaction) WithContext(ctx context.Context) SqlExecutor {
-
- copy := &Transaction{}
-
- *copy = *t
-
- copy.ctx = ctx
-
- return copy
-
-}
-
-// Insert has the same behavior as DbMap.Insert(), but runs in a transaction.
-
-func (t *Transaction) Insert(list ...interface{}) error {
-
- return insert(t.dbmap, t, list...)
-
-}
-
-// Update had the same behavior as DbMap.Update(), but runs in a transaction.
-
-func (t *Transaction) Update(list ...interface{}) (int64, error) {
-
- return update(t.dbmap, t, nil, list...)
-
-}
-
-// UpdateColumns had the same behavior as DbMap.UpdateColumns(), but runs in a transaction.
-
-func (t *Transaction) UpdateColumns(filter ColumnFilter, list ...interface{}) (int64, error) {
-
- return update(t.dbmap, t, filter, list...)
-
-}
-
-// Delete has the same behavior as DbMap.Delete(), but runs in a transaction.
-
-func (t *Transaction) Delete(list ...interface{}) (int64, error) {
-
- return delete(t.dbmap, t, list...)
-
-}
-
-// Get has the same behavior as DbMap.Get(), but runs in a transaction.
-
-func (t *Transaction) Get(i interface{}, keys ...interface{}) (interface{}, error) {
-
- return get(t.dbmap, t, i, keys...)
-
-}
-
-// Select has the same behavior as DbMap.Select(), but runs in a transaction.
-
-func (t *Transaction) Select(i interface{}, query string, args ...interface{}) ([]interface{}, error) {
-
- if t.dbmap.ExpandSliceArgs {
-
- expandSliceArgs(&query, args...)
-
- }
-
- return hookedselect(t.dbmap, t, i, query, args...)
-
-}
-
-// Exec has the same behavior as DbMap.Exec(), but runs in a transaction.
-
-func (t *Transaction) Exec(query string, args ...interface{}) (sql.Result, error) {
-
- if t.dbmap.ExpandSliceArgs {
-
- expandSliceArgs(&query, args...)
-
- }
-
- if t.dbmap.logger != nil {
-
- now := time.Now()
-
- defer t.dbmap.trace(now, query, args...)
-
- }
-
- return maybeExpandNamedQueryAndExec(t, query, args...)
-
-}
-
-// SelectInt is a convenience wrapper around the gorp.SelectInt function.
-
-func (t *Transaction) SelectInt(query string, args ...interface{}) (int64, error) {
-
- if t.dbmap.ExpandSliceArgs {
-
- expandSliceArgs(&query, args...)
-
- }
-
- return SelectInt(t, query, args...)
-
-}
-
-// SelectNullInt is a convenience wrapper around the gorp.SelectNullInt function.
-
-func (t *Transaction) SelectNullInt(query string, args ...interface{}) (sql.NullInt64, error) {
-
- if t.dbmap.ExpandSliceArgs {
-
- expandSliceArgs(&query, args...)
-
- }
-
- return SelectNullInt(t, query, args...)
-
-}
-
-// SelectFloat is a convenience wrapper around the gorp.SelectFloat function.
-
-func (t *Transaction) SelectFloat(query string, args ...interface{}) (float64, error) {
-
- if t.dbmap.ExpandSliceArgs {
-
- expandSliceArgs(&query, args...)
-
- }
-
- return SelectFloat(t, query, args...)
-
-}
-
-// SelectNullFloat is a convenience wrapper around the gorp.SelectNullFloat function.
-
-func (t *Transaction) SelectNullFloat(query string, args ...interface{}) (sql.NullFloat64, error) {
-
- if t.dbmap.ExpandSliceArgs {
-
- expandSliceArgs(&query, args...)
-
- }
-
- return SelectNullFloat(t, query, args...)
-
-}
-
-// SelectStr is a convenience wrapper around the gorp.SelectStr function.
-
-func (t *Transaction) SelectStr(query string, args ...interface{}) (string, error) {
-
- if t.dbmap.ExpandSliceArgs {
-
- expandSliceArgs(&query, args...)
-
- }
-
- return SelectStr(t, query, args...)
-
-}
-
-// SelectNullStr is a convenience wrapper around the gorp.SelectNullStr function.
-
-func (t *Transaction) SelectNullStr(query string, args ...interface{}) (sql.NullString, error) {
-
- if t.dbmap.ExpandSliceArgs {
-
- expandSliceArgs(&query, args...)
-
- }
-
- return SelectNullStr(t, query, args...)
-
-}
-
-// SelectOne is a convenience wrapper around the gorp.SelectOne function.
-
-func (t *Transaction) SelectOne(holder interface{}, query string, args ...interface{}) error {
-
- if t.dbmap.ExpandSliceArgs {
-
- expandSliceArgs(&query, args...)
-
- }
-
- return SelectOne(t.dbmap, t, holder, query, args...)
-
-}
-
-// Commit commits the underlying database transaction.
-
-func (t *Transaction) Commit() error {
-
- if !t.closed {
-
- t.closed = true
-
- if t.dbmap.logger != nil {
-
- now := time.Now()
-
- defer t.dbmap.trace(now, "commit;")
-
- }
-
- return t.tx.Commit()
-
- }
-
- return sql.ErrTxDone
-
-}
-
-// Rollback rolls back the underlying database transaction.
-
-func (t *Transaction) Rollback() error {
-
- if !t.closed {
-
- t.closed = true
-
- if t.dbmap.logger != nil {
-
- now := time.Now()
-
- defer t.dbmap.trace(now, "rollback;")
-
- }
-
- return t.tx.Rollback()
-
- }
-
- return sql.ErrTxDone
-
-}
-
-// Savepoint creates a savepoint with the given name. The name is interpolated
-
-// directly into the SQL SAVEPOINT statement, so you must sanitize it if it is
-
-// derived from user input.
-
-func (t *Transaction) Savepoint(name string) error {
-
- query := "savepoint " + t.dbmap.Dialect.QuoteField(name)
-
- if t.dbmap.logger != nil {
-
- now := time.Now()
-
- defer t.dbmap.trace(now, query, nil)
-
- }
-
- _, err := exec(t, query)
-
- return err
-
-}
-
-// RollbackToSavepoint rolls back to the savepoint with the given name. The
-
-// name is interpolated directly into the SQL SAVEPOINT statement, so you must
-
-// sanitize it if it is derived from user input.
-
-func (t *Transaction) RollbackToSavepoint(savepoint string) error {
-
- query := "rollback to savepoint " + t.dbmap.Dialect.QuoteField(savepoint)
-
- if t.dbmap.logger != nil {
-
- now := time.Now()
-
- defer t.dbmap.trace(now, query, nil)
-
- }
-
- _, err := exec(t, query)
-
- return err
-
-}
-
-// ReleaseSavepint releases the savepoint with the given name. The name is
-
-// interpolated directly into the SQL SAVEPOINT statement, so you must sanitize
-
-// it if it is derived from user input.
-
-func (t *Transaction) ReleaseSavepoint(savepoint string) error {
-
- query := "release savepoint " + t.dbmap.Dialect.QuoteField(savepoint)
-
- if t.dbmap.logger != nil {
-
- now := time.Now()
-
- defer t.dbmap.trace(now, query, nil)
-
- }
-
- _, err := exec(t, query)
-
- return err
-
-}
-
-// Prepare has the same behavior as DbMap.Prepare(), but runs in a transaction.
-
-func (t *Transaction) Prepare(query string) (*sql.Stmt, error) {
-
- if t.dbmap.logger != nil {
-
- now := time.Now()
-
- defer t.dbmap.trace(now, query, nil)
-
- }
-
- return prepare(t, query)
-
-}
-
-func (t *Transaction) QueryRow(query string, args ...interface{}) *sql.Row {
-
- if t.dbmap.ExpandSliceArgs {
-
- expandSliceArgs(&query, args...)
-
- }
-
- if t.dbmap.logger != nil {
-
- now := time.Now()
-
- defer t.dbmap.trace(now, query, args...)
-
- }
-
- return queryRow(t, query, args...)
-
-}
-
-func (t *Transaction) Query(q string, args ...interface{}) (*sql.Rows, error) {
-
- if t.dbmap.ExpandSliceArgs {
-
- expandSliceArgs(&q, args...)
-
- }
-
- if t.dbmap.logger != nil {
-
- now := time.Now()
-
- defer t.dbmap.trace(now, q, args...)
-
- }
-
- return query(t, q, args...)
-
-}
diff --git a/vendor/github.com/go-openapi/jsonpointer/.editorconfig b/vendor/github.com/go-openapi/jsonpointer/.editorconfig
deleted file mode 100644
index 3152da6..0000000
--- a/vendor/github.com/go-openapi/jsonpointer/.editorconfig
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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/vendor/github.com/go-openapi/jsonpointer/.gitignore b/vendor/github.com/go-openapi/jsonpointer/.gitignore
deleted file mode 100644
index 769c244..0000000
--- a/vendor/github.com/go-openapi/jsonpointer/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-secrets.yml
diff --git a/vendor/github.com/go-openapi/jsonpointer/.golangci.yml b/vendor/github.com/go-openapi/jsonpointer/.golangci.yml
deleted file mode 100644
index 22f8d21..0000000
--- a/vendor/github.com/go-openapi/jsonpointer/.golangci.yml
+++ /dev/null
@@ -1,61 +0,0 @@
-linters-settings:
- govet:
- check-shadowing: true
- golint:
- min-confidence: 0
- gocyclo:
- min-complexity: 45
- maligned:
- suggest-new: true
- dupl:
- threshold: 200
- goconst:
- min-len: 2
- min-occurrences: 3
-
-linters:
- enable-all: true
- disable:
- - maligned
- - unparam
- - lll
- - gochecknoinits
- - gochecknoglobals
- - funlen
- - godox
- - gocognit
- - whitespace
- - wsl
- - wrapcheck
- - testpackage
- - nlreturn
- - gomnd
- - exhaustivestruct
- - goerr113
- - errorlint
- - nestif
- - godot
- - gofumpt
- - paralleltest
- - tparallel
- - thelper
- - ifshort
- - exhaustruct
- - varnamelen
- - gci
- - depguard
- - errchkjson
- - inamedparam
- - nonamedreturns
- - musttag
- - ireturn
- - forcetypeassert
- - cyclop
- # deprecated linters
- - deadcode
- - interfacer
- - scopelint
- - varcheck
- - structcheck
- - golint
- - nosnakecase
diff --git a/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md
deleted file mode 100644
index 9322b06..0000000
--- a/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# 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/vendor/github.com/go-openapi/jsonpointer/LICENSE b/vendor/github.com/go-openapi/jsonpointer/LICENSE
deleted file mode 100644
index d645695..0000000
--- a/vendor/github.com/go-openapi/jsonpointer/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- 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/vendor/github.com/go-openapi/jsonpointer/README.md b/vendor/github.com/go-openapi/jsonpointer/README.md
deleted file mode 100644
index 0108f1d..0000000
--- a/vendor/github.com/go-openapi/jsonpointer/README.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# gojsonpointer [![Build Status](https://github.com/go-openapi/jsonpointer/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/jsonpointer/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/jsonpointer/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/jsonpointer)
-
-[![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/jsonpointer/master/LICENSE)
-[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/jsonpointer.svg)](https://pkg.go.dev/github.com/go-openapi/jsonpointer)
-[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/jsonpointer)](https://goreportcard.com/report/github.com/go-openapi/jsonpointer)
-
-An implementation of JSON Pointer - Go language
-
-## Status
-Completed YES
-
-Tested YES
-
-## References
-http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07
-
-### Note
-The 4.Evaluation part of the previous reference, starting with 'If the currently referenced value is a JSON array, the reference token MUST contain either...' is not implemented.
diff --git a/vendor/github.com/go-openapi/jsonpointer/pointer.go b/vendor/github.com/go-openapi/jsonpointer/pointer.go
deleted file mode 100644
index 85beff3..0000000
--- a/vendor/github.com/go-openapi/jsonpointer/pointer.go
+++ /dev/null
@@ -1,876 +0,0 @@
-// Copyright 2013 sigu-399 ( https://github.com/sigu-399 )
-
-//
-
-// 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.
-
-// author sigu-399
-
-// author-github https://github.com/sigu-399
-
-// author-mail sigu.399@gmail.com
-
-//
-
-// repository-name jsonpointer
-
-// repository-desc An implementation of JSON Pointer - Go language
-
-//
-
-// description Main and unique file.
-
-//
-
-// created 25-02-2013
-
-package jsonpointer
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "reflect"
- "strconv"
- "strings"
-
- "github.com/go-openapi/swag"
-)
-
-const (
- emptyPointer = ``
-
- pointerSeparator = `/`
-
- invalidStart = `JSON pointer must be empty or start with a "` + pointerSeparator
-
- notFound = `Can't find the pointer in the document`
-)
-
-var jsonPointableType = reflect.TypeOf(new(JSONPointable)).Elem()
-
-var jsonSetableType = reflect.TypeOf(new(JSONSetable)).Elem()
-
-// JSONPointable is an interface for structs to implement when they need to customize the
-
-// json pointer process
-
-type JSONPointable interface {
- JSONLookup(string) (any, error)
-}
-
-// JSONSetable is an interface for structs to implement when they need to customize the
-
-// json pointer process
-
-type JSONSetable interface {
- JSONSet(string, any) error
-}
-
-// New creates a new json pointer for the given string
-
-func New(jsonPointerString string) (Pointer, error) {
-
- var p Pointer
-
- err := p.parse(jsonPointerString)
-
- return p, err
-
-}
-
-// Pointer the json pointer reprsentation
-
-type Pointer struct {
- referenceTokens []string
-}
-
-// "Constructor", parses the given string JSON pointer
-
-func (p *Pointer) parse(jsonPointerString string) error {
-
- var err error
-
- if jsonPointerString != emptyPointer {
-
- if !strings.HasPrefix(jsonPointerString, pointerSeparator) {
-
- err = errors.New(invalidStart)
-
- } else {
-
- referenceTokens := strings.Split(jsonPointerString, pointerSeparator)
-
- p.referenceTokens = append(p.referenceTokens, referenceTokens[1:]...)
-
- }
-
- }
-
- return err
-
-}
-
-// Get uses the pointer to retrieve a value from a JSON document
-
-func (p *Pointer) Get(document any) (any, reflect.Kind, error) {
-
- return p.get(document, swag.DefaultJSONNameProvider)
-
-}
-
-// Set uses the pointer to set a value from a JSON document
-
-func (p *Pointer) Set(document any, value any) (any, error) {
-
- return document, p.set(document, value, swag.DefaultJSONNameProvider)
-
-}
-
-// GetForToken gets a value for a json pointer token 1 level deep
-
-func GetForToken(document any, decodedToken string) (any, reflect.Kind, error) {
-
- return getSingleImpl(document, decodedToken, swag.DefaultJSONNameProvider)
-
-}
-
-// SetForToken gets a value for a json pointer token 1 level deep
-
-func SetForToken(document any, decodedToken string, value any) (any, error) {
-
- return document, setSingleImpl(document, value, decodedToken, swag.DefaultJSONNameProvider)
-
-}
-
-func isNil(input any) bool {
-
- if input == nil {
-
- return true
-
- }
-
- kind := reflect.TypeOf(input).Kind()
-
- switch kind { //nolint:exhaustive
-
- case reflect.Ptr, reflect.Map, reflect.Slice, reflect.Chan:
-
- return reflect.ValueOf(input).IsNil()
-
- default:
-
- return false
-
- }
-
-}
-
-func getSingleImpl(node any, decodedToken string, nameProvider *swag.NameProvider) (any, reflect.Kind, error) {
-
- rValue := reflect.Indirect(reflect.ValueOf(node))
-
- kind := rValue.Kind()
-
- if isNil(node) {
-
- return nil, kind, fmt.Errorf("nil value has not field %q", decodedToken)
-
- }
-
- switch typed := node.(type) {
-
- case JSONPointable:
-
- r, err := typed.JSONLookup(decodedToken)
-
- if err != nil {
-
- return nil, kind, err
-
- }
-
- return r, kind, nil
-
- case *any: // case of a pointer to interface, that is not resolved by reflect.Indirect
-
- return getSingleImpl(*typed, decodedToken, nameProvider)
-
- }
-
- switch kind { //nolint:exhaustive
-
- case reflect.Struct:
-
- nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken)
-
- if !ok {
-
- return nil, kind, fmt.Errorf("object has no field %q", decodedToken)
-
- }
-
- fld := rValue.FieldByName(nm)
-
- return fld.Interface(), kind, nil
-
- case reflect.Map:
-
- kv := reflect.ValueOf(decodedToken)
-
- mv := rValue.MapIndex(kv)
-
- if mv.IsValid() {
-
- return mv.Interface(), kind, nil
-
- }
-
- return nil, kind, fmt.Errorf("object has no key %q", decodedToken)
-
- case reflect.Slice:
-
- tokenIndex, err := strconv.Atoi(decodedToken)
-
- if err != nil {
-
- return nil, kind, err
-
- }
-
- sLength := rValue.Len()
-
- if tokenIndex < 0 || tokenIndex >= sLength {
-
- return nil, kind, fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength-1, tokenIndex)
-
- }
-
- elem := rValue.Index(tokenIndex)
-
- return elem.Interface(), kind, nil
-
- default:
-
- return nil, kind, fmt.Errorf("invalid token reference %q", decodedToken)
-
- }
-
-}
-
-func setSingleImpl(node, data any, decodedToken string, nameProvider *swag.NameProvider) error {
-
- rValue := reflect.Indirect(reflect.ValueOf(node))
-
- if ns, ok := node.(JSONSetable); ok { // pointer impl
-
- return ns.JSONSet(decodedToken, data)
-
- }
-
- if rValue.Type().Implements(jsonSetableType) {
-
- return node.(JSONSetable).JSONSet(decodedToken, data)
-
- }
-
- switch rValue.Kind() { //nolint:exhaustive
-
- case reflect.Struct:
-
- nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken)
-
- if !ok {
-
- return fmt.Errorf("object has no field %q", decodedToken)
-
- }
-
- fld := rValue.FieldByName(nm)
-
- if fld.IsValid() {
-
- fld.Set(reflect.ValueOf(data))
-
- }
-
- return nil
-
- case reflect.Map:
-
- kv := reflect.ValueOf(decodedToken)
-
- rValue.SetMapIndex(kv, reflect.ValueOf(data))
-
- return nil
-
- case reflect.Slice:
-
- tokenIndex, err := strconv.Atoi(decodedToken)
-
- if err != nil {
-
- return err
-
- }
-
- sLength := rValue.Len()
-
- if tokenIndex < 0 || tokenIndex >= sLength {
-
- return fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength, tokenIndex)
-
- }
-
- elem := rValue.Index(tokenIndex)
-
- if !elem.CanSet() {
-
- return fmt.Errorf("can't set slice index %s to %v", decodedToken, data)
-
- }
-
- elem.Set(reflect.ValueOf(data))
-
- return nil
-
- default:
-
- return fmt.Errorf("invalid token reference %q", decodedToken)
-
- }
-
-}
-
-func (p *Pointer) get(node any, nameProvider *swag.NameProvider) (any, reflect.Kind, error) {
-
- if nameProvider == nil {
-
- nameProvider = swag.DefaultJSONNameProvider
-
- }
-
- kind := reflect.Invalid
-
- // Full document when empty
-
- if len(p.referenceTokens) == 0 {
-
- return node, kind, nil
-
- }
-
- for _, token := range p.referenceTokens {
-
- decodedToken := Unescape(token)
-
- r, knd, err := getSingleImpl(node, decodedToken, nameProvider)
-
- if err != nil {
-
- return nil, knd, err
-
- }
-
- node = r
-
- }
-
- rValue := reflect.ValueOf(node)
-
- kind = rValue.Kind()
-
- return node, kind, nil
-
-}
-
-func (p *Pointer) set(node, data any, nameProvider *swag.NameProvider) error {
-
- knd := reflect.ValueOf(node).Kind()
-
- if knd != reflect.Ptr && knd != reflect.Struct && knd != reflect.Map && knd != reflect.Slice && knd != reflect.Array {
-
- return errors.New("only structs, pointers, maps and slices are supported for setting values")
-
- }
-
- if nameProvider == nil {
-
- nameProvider = swag.DefaultJSONNameProvider
-
- }
-
- // Full document when empty
-
- if len(p.referenceTokens) == 0 {
-
- return nil
-
- }
-
- lastI := len(p.referenceTokens) - 1
-
- for i, token := range p.referenceTokens {
-
- isLastToken := i == lastI
-
- decodedToken := Unescape(token)
-
- if isLastToken {
-
- return setSingleImpl(node, data, decodedToken, nameProvider)
-
- }
-
- rValue := reflect.Indirect(reflect.ValueOf(node))
-
- kind := rValue.Kind()
-
- if rValue.Type().Implements(jsonPointableType) {
-
- r, err := node.(JSONPointable).JSONLookup(decodedToken)
-
- if err != nil {
-
- return err
-
- }
-
- fld := reflect.ValueOf(r)
-
- if fld.CanAddr() && fld.Kind() != reflect.Interface && fld.Kind() != reflect.Map && fld.Kind() != reflect.Slice && fld.Kind() != reflect.Ptr {
-
- node = fld.Addr().Interface()
-
- continue
-
- }
-
- node = r
-
- continue
-
- }
-
- switch kind { //nolint:exhaustive
-
- case reflect.Struct:
-
- nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken)
-
- if !ok {
-
- return fmt.Errorf("object has no field %q", decodedToken)
-
- }
-
- fld := rValue.FieldByName(nm)
-
- if fld.CanAddr() && fld.Kind() != reflect.Interface && fld.Kind() != reflect.Map && fld.Kind() != reflect.Slice && fld.Kind() != reflect.Ptr {
-
- node = fld.Addr().Interface()
-
- continue
-
- }
-
- node = fld.Interface()
-
- case reflect.Map:
-
- kv := reflect.ValueOf(decodedToken)
-
- mv := rValue.MapIndex(kv)
-
- if !mv.IsValid() {
-
- return fmt.Errorf("object has no key %q", decodedToken)
-
- }
-
- if mv.CanAddr() && mv.Kind() != reflect.Interface && mv.Kind() != reflect.Map && mv.Kind() != reflect.Slice && mv.Kind() != reflect.Ptr {
-
- node = mv.Addr().Interface()
-
- continue
-
- }
-
- node = mv.Interface()
-
- case reflect.Slice:
-
- tokenIndex, err := strconv.Atoi(decodedToken)
-
- if err != nil {
-
- return err
-
- }
-
- sLength := rValue.Len()
-
- if tokenIndex < 0 || tokenIndex >= sLength {
-
- return fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength, tokenIndex)
-
- }
-
- elem := rValue.Index(tokenIndex)
-
- if elem.CanAddr() && elem.Kind() != reflect.Interface && elem.Kind() != reflect.Map && elem.Kind() != reflect.Slice && elem.Kind() != reflect.Ptr {
-
- node = elem.Addr().Interface()
-
- continue
-
- }
-
- node = elem.Interface()
-
- default:
-
- return fmt.Errorf("invalid token reference %q", decodedToken)
-
- }
-
- }
-
- return nil
-
-}
-
-// DecodedTokens returns the decoded tokens
-
-func (p *Pointer) DecodedTokens() []string {
-
- result := make([]string, 0, len(p.referenceTokens))
-
- for _, t := range p.referenceTokens {
-
- result = append(result, Unescape(t))
-
- }
-
- return result
-
-}
-
-// IsEmpty returns true if this is an empty json pointer
-
-// this indicates that it points to the root document
-
-func (p *Pointer) IsEmpty() bool {
-
- return len(p.referenceTokens) == 0
-
-}
-
-// Pointer to string representation function
-
-func (p *Pointer) String() string {
-
- if len(p.referenceTokens) == 0 {
-
- return emptyPointer
-
- }
-
- pointerString := pointerSeparator + strings.Join(p.referenceTokens, pointerSeparator)
-
- return pointerString
-
-}
-
-func (p *Pointer) Offset(document string) (int64, error) {
-
- dec := json.NewDecoder(strings.NewReader(document))
-
- var offset int64
-
- for _, ttk := range p.DecodedTokens() {
-
- tk, err := dec.Token()
-
- if err != nil {
-
- return 0, err
-
- }
-
- switch tk := tk.(type) {
-
- case json.Delim:
-
- switch tk {
-
- case '{':
-
- offset, err = offsetSingleObject(dec, ttk)
-
- if err != nil {
-
- return 0, err
-
- }
-
- case '[':
-
- offset, err = offsetSingleArray(dec, ttk)
-
- if err != nil {
-
- return 0, err
-
- }
-
- default:
-
- return 0, fmt.Errorf("invalid token %#v", tk)
-
- }
-
- default:
-
- return 0, fmt.Errorf("invalid token %#v", tk)
-
- }
-
- }
-
- return offset, nil
-
-}
-
-func offsetSingleObject(dec *json.Decoder, decodedToken string) (int64, error) {
-
- for dec.More() {
-
- offset := dec.InputOffset()
-
- tk, err := dec.Token()
-
- if err != nil {
-
- return 0, err
-
- }
-
- switch tk := tk.(type) {
-
- case json.Delim:
-
- switch tk {
-
- case '{':
-
- if err = drainSingle(dec); err != nil {
-
- return 0, err
-
- }
-
- case '[':
-
- if err = drainSingle(dec); err != nil {
-
- return 0, err
-
- }
-
- }
-
- case string:
-
- if tk == decodedToken {
-
- return offset, nil
-
- }
-
- default:
-
- return 0, fmt.Errorf("invalid token %#v", tk)
-
- }
-
- }
-
- return 0, fmt.Errorf("token reference %q not found", decodedToken)
-
-}
-
-func offsetSingleArray(dec *json.Decoder, decodedToken string) (int64, error) {
-
- idx, err := strconv.Atoi(decodedToken)
-
- if err != nil {
-
- return 0, fmt.Errorf("token reference %q is not a number: %v", decodedToken, err)
-
- }
-
- var i int
-
- for i = 0; i < idx && dec.More(); i++ {
-
- tk, err := dec.Token()
-
- if err != nil {
-
- return 0, err
-
- }
-
- if delim, isDelim := tk.(json.Delim); isDelim {
-
- switch delim {
-
- case '{':
-
- if err = drainSingle(dec); err != nil {
-
- return 0, err
-
- }
-
- case '[':
-
- if err = drainSingle(dec); err != nil {
-
- return 0, err
-
- }
-
- }
-
- }
-
- }
-
- if !dec.More() {
-
- return 0, fmt.Errorf("token reference %q not found", decodedToken)
-
- }
-
- return dec.InputOffset(), nil
-
-}
-
-// drainSingle drains a single level of object or array.
-
-// The decoder has to guarantee the beginning delim (i.e. '{' or '[') has been consumed.
-
-func drainSingle(dec *json.Decoder) error {
-
- for dec.More() {
-
- tk, err := dec.Token()
-
- if err != nil {
-
- return err
-
- }
-
- if delim, isDelim := tk.(json.Delim); isDelim {
-
- switch delim {
-
- case '{':
-
- if err = drainSingle(dec); err != nil {
-
- return err
-
- }
-
- case '[':
-
- if err = drainSingle(dec); err != nil {
-
- return err
-
- }
-
- }
-
- }
-
- }
-
- // Consumes the ending delim
-
- if _, err := dec.Token(); err != nil {
-
- return err
-
- }
-
- return nil
-
-}
-
-// Specific JSON pointer encoding here
-
-// ~0 => ~
-
-// ~1 => /
-
-// ... and vice versa
-
-const (
- encRefTok0 = `~0`
-
- encRefTok1 = `~1`
-
- decRefTok0 = `~`
-
- decRefTok1 = `/`
-)
-
-// Unescape unescapes a json pointer reference token string to the original representation
-
-func Unescape(token string) string {
-
- step1 := strings.ReplaceAll(token, encRefTok1, decRefTok1)
-
- step2 := strings.ReplaceAll(step1, encRefTok0, decRefTok0)
-
- return step2
-
-}
-
-// Escape escapes a pointer reference token string
-
-func Escape(token string) string {
-
- step1 := strings.ReplaceAll(token, decRefTok0, encRefTok0)
-
- step2 := strings.ReplaceAll(step1, decRefTok1, encRefTok1)
-
- return step2
-
-}
diff --git a/vendor/github.com/go-openapi/jsonreference/.gitignore b/vendor/github.com/go-openapi/jsonreference/.gitignore
deleted file mode 100644
index 769c244..0000000
--- a/vendor/github.com/go-openapi/jsonreference/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-secrets.yml
diff --git a/vendor/github.com/go-openapi/jsonreference/.golangci.yml b/vendor/github.com/go-openapi/jsonreference/.golangci.yml
deleted file mode 100644
index 22f8d21..0000000
--- a/vendor/github.com/go-openapi/jsonreference/.golangci.yml
+++ /dev/null
@@ -1,61 +0,0 @@
-linters-settings:
- govet:
- check-shadowing: true
- golint:
- min-confidence: 0
- gocyclo:
- min-complexity: 45
- maligned:
- suggest-new: true
- dupl:
- threshold: 200
- goconst:
- min-len: 2
- min-occurrences: 3
-
-linters:
- enable-all: true
- disable:
- - maligned
- - unparam
- - lll
- - gochecknoinits
- - gochecknoglobals
- - funlen
- - godox
- - gocognit
- - whitespace
- - wsl
- - wrapcheck
- - testpackage
- - nlreturn
- - gomnd
- - exhaustivestruct
- - goerr113
- - errorlint
- - nestif
- - godot
- - gofumpt
- - paralleltest
- - tparallel
- - thelper
- - ifshort
- - exhaustruct
- - varnamelen
- - gci
- - depguard
- - errchkjson
- - inamedparam
- - nonamedreturns
- - musttag
- - ireturn
- - forcetypeassert
- - cyclop
- # deprecated linters
- - deadcode
- - interfacer
- - scopelint
- - varcheck
- - structcheck
- - golint
- - nosnakecase
diff --git a/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md
deleted file mode 100644
index 9322b06..0000000
--- a/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# 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/vendor/github.com/go-openapi/jsonreference/LICENSE b/vendor/github.com/go-openapi/jsonreference/LICENSE
deleted file mode 100644
index d645695..0000000
--- a/vendor/github.com/go-openapi/jsonreference/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- 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/vendor/github.com/go-openapi/jsonreference/README.md b/vendor/github.com/go-openapi/jsonreference/README.md
deleted file mode 100644
index c7fc204..0000000
--- a/vendor/github.com/go-openapi/jsonreference/README.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# gojsonreference [![Build Status](https://github.com/go-openapi/jsonreference/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/jsonreference/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/jsonreference/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/jsonreference)
-
-[![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/jsonreference/master/LICENSE)
-[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/jsonreference.svg)](https://pkg.go.dev/github.com/go-openapi/jsonreference)
-[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/jsonreference)](https://goreportcard.com/report/github.com/go-openapi/jsonreference)
-
-An implementation of JSON Reference - Go language
-
-## Status
-Feature complete. Stable API
-
-## Dependencies
-* https://github.com/go-openapi/jsonpointer
-
-## References
-
-* http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07
-* http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03
diff --git a/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go b/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go
deleted file mode 100644
index 5308c96..0000000
--- a/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go
+++ /dev/null
@@ -1,113 +0,0 @@
-package internal
-
-import (
- "net/url"
- "regexp"
- "strings"
-)
-
-const (
- defaultHTTPPort = ":80"
-
- defaultHTTPSPort = ":443"
-)
-
-// Regular expressions used by the normalizations
-
-var rxPort = regexp.MustCompile(`(:\d+)/?$`)
-
-var rxDupSlashes = regexp.MustCompile(`/{2,}`)
-
-// NormalizeURL will normalize the specified URL
-
-// This was added to replace a previous call to the no longer maintained purell library:
-
-// The call that was used looked like the following:
-
-//
-
-// url.Parse(purell.NormalizeURL(parsed, purell.FlagsSafe|purell.FlagRemoveDuplicateSlashes))
-
-//
-
-// To explain all that was included in the call above, purell.FlagsSafe was really just the following:
-
-// - FlagLowercaseScheme
-
-// - FlagLowercaseHost
-
-// - FlagRemoveDefaultPort
-
-// - FlagRemoveDuplicateSlashes (and this was mixed in with the |)
-
-//
-
-// This also normalizes the URL into its urlencoded form by removing RawPath and RawFragment.
-
-func NormalizeURL(u *url.URL) {
-
- lowercaseScheme(u)
-
- lowercaseHost(u)
-
- removeDefaultPort(u)
-
- removeDuplicateSlashes(u)
-
- u.RawPath = ""
-
- u.RawFragment = ""
-
-}
-
-func lowercaseScheme(u *url.URL) {
-
- if len(u.Scheme) > 0 {
-
- u.Scheme = strings.ToLower(u.Scheme)
-
- }
-
-}
-
-func lowercaseHost(u *url.URL) {
-
- if len(u.Host) > 0 {
-
- u.Host = strings.ToLower(u.Host)
-
- }
-
-}
-
-func removeDefaultPort(u *url.URL) {
-
- if len(u.Host) > 0 {
-
- scheme := strings.ToLower(u.Scheme)
-
- u.Host = rxPort.ReplaceAllStringFunc(u.Host, func(val string) string {
-
- if (scheme == "http" && val == defaultHTTPPort) || (scheme == "https" && val == defaultHTTPSPort) {
-
- return ""
-
- }
-
- return val
-
- })
-
- }
-
-}
-
-func removeDuplicateSlashes(u *url.URL) {
-
- if len(u.Path) > 0 {
-
- u.Path = rxDupSlashes.ReplaceAllString(u.Path, "/")
-
- }
-
-}
diff --git a/vendor/github.com/go-openapi/jsonreference/reference.go b/vendor/github.com/go-openapi/jsonreference/reference.go
deleted file mode 100644
index 1d37f9e..0000000
--- a/vendor/github.com/go-openapi/jsonreference/reference.go
+++ /dev/null
@@ -1,248 +0,0 @@
-// Copyright 2013 sigu-399 ( https://github.com/sigu-399 )
-
-//
-
-// 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.
-
-// author sigu-399
-
-// author-github https://github.com/sigu-399
-
-// author-mail sigu.399@gmail.com
-
-//
-
-// repository-name jsonreference
-
-// repository-desc An implementation of JSON Reference - Go language
-
-//
-
-// description Main and unique file.
-
-//
-
-// created 26-02-2013
-
-package jsonreference
-
-import (
- "errors"
- "net/url"
- "strings"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/jsonreference/internal"
-)
-
-const (
- fragmentRune = `#`
-)
-
-// New creates a new reference for the given string
-
-func New(jsonReferenceString string) (Ref, error) {
-
- var r Ref
-
- err := r.parse(jsonReferenceString)
-
- return r, err
-
-}
-
-// MustCreateRef parses the ref string and panics when it's invalid.
-
-// Use the New method for a version that returns an error
-
-func MustCreateRef(ref string) Ref {
-
- r, err := New(ref)
-
- if err != nil {
-
- panic(err)
-
- }
-
- return r
-
-}
-
-// Ref represents a json reference object
-
-type Ref struct {
- referenceURL *url.URL
-
- referencePointer jsonpointer.Pointer
-
- HasFullURL bool
-
- HasURLPathOnly bool
-
- HasFragmentOnly bool
-
- HasFileScheme bool
-
- HasFullFilePath bool
-}
-
-// GetURL gets the URL for this reference
-
-func (r *Ref) GetURL() *url.URL {
-
- return r.referenceURL
-
-}
-
-// GetPointer gets the json pointer for this reference
-
-func (r *Ref) GetPointer() *jsonpointer.Pointer {
-
- return &r.referencePointer
-
-}
-
-// String returns the best version of the url for this reference
-
-func (r *Ref) String() string {
-
- if r.referenceURL != nil {
-
- return r.referenceURL.String()
-
- }
-
- if r.HasFragmentOnly {
-
- return fragmentRune + r.referencePointer.String()
-
- }
-
- return r.referencePointer.String()
-
-}
-
-// IsRoot returns true if this reference is a root document
-
-func (r *Ref) IsRoot() bool {
-
- return r.referenceURL != nil &&
-
- !r.IsCanonical() &&
-
- !r.HasURLPathOnly &&
-
- r.referenceURL.Fragment == ""
-
-}
-
-// IsCanonical returns true when this pointer starts with http(s):// or file://
-
-func (r *Ref) IsCanonical() bool {
-
- return (r.HasFileScheme && r.HasFullFilePath) || (!r.HasFileScheme && r.HasFullURL)
-
-}
-
-// "Constructor", parses the given string JSON reference
-
-func (r *Ref) parse(jsonReferenceString string) error {
-
- parsed, err := url.Parse(jsonReferenceString)
-
- if err != nil {
-
- return err
-
- }
-
- internal.NormalizeURL(parsed)
-
- r.referenceURL = parsed
-
- refURL := r.referenceURL
-
- if refURL.Scheme != "" && refURL.Host != "" {
-
- r.HasFullURL = true
-
- } else {
-
- if refURL.Path != "" {
-
- r.HasURLPathOnly = true
-
- } else if refURL.RawQuery == "" && refURL.Fragment != "" {
-
- r.HasFragmentOnly = true
-
- }
-
- }
-
- r.HasFileScheme = refURL.Scheme == "file"
-
- r.HasFullFilePath = strings.HasPrefix(refURL.Path, "/")
-
- // invalid json-pointer error means url has no json-pointer fragment. simply ignore error
-
- r.referencePointer, _ = jsonpointer.New(refURL.Fragment)
-
- return nil
-
-}
-
-// Inherits creates a new reference from a parent and a child
-
-// If the child cannot inherit from the parent, an error is returned
-
-func (r *Ref) Inherits(child Ref) (*Ref, error) {
-
- childURL := child.GetURL()
-
- parentURL := r.GetURL()
-
- if childURL == nil {
-
- return nil, errors.New("child url is nil")
-
- }
-
- if parentURL == nil {
-
- return &child, nil
-
- }
-
- ref, err := New(parentURL.ResolveReference(childURL).String())
-
- if err != nil {
-
- return nil, err
-
- }
-
- return &ref, nil
-
-}
diff --git a/vendor/github.com/go-openapi/spec/.editorconfig b/vendor/github.com/go-openapi/spec/.editorconfig
deleted file mode 100644
index 3152da6..0000000
--- a/vendor/github.com/go-openapi/spec/.editorconfig
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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/vendor/github.com/go-openapi/spec/.gitignore b/vendor/github.com/go-openapi/spec/.gitignore
deleted file mode 100644
index f47cb20..0000000
--- a/vendor/github.com/go-openapi/spec/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.out
diff --git a/vendor/github.com/go-openapi/spec/.golangci.yml b/vendor/github.com/go-openapi/spec/.golangci.yml
deleted file mode 100644
index 22f8d21..0000000
--- a/vendor/github.com/go-openapi/spec/.golangci.yml
+++ /dev/null
@@ -1,61 +0,0 @@
-linters-settings:
- govet:
- check-shadowing: true
- golint:
- min-confidence: 0
- gocyclo:
- min-complexity: 45
- maligned:
- suggest-new: true
- dupl:
- threshold: 200
- goconst:
- min-len: 2
- min-occurrences: 3
-
-linters:
- enable-all: true
- disable:
- - maligned
- - unparam
- - lll
- - gochecknoinits
- - gochecknoglobals
- - funlen
- - godox
- - gocognit
- - whitespace
- - wsl
- - wrapcheck
- - testpackage
- - nlreturn
- - gomnd
- - exhaustivestruct
- - goerr113
- - errorlint
- - nestif
- - godot
- - gofumpt
- - paralleltest
- - tparallel
- - thelper
- - ifshort
- - exhaustruct
- - varnamelen
- - gci
- - depguard
- - errchkjson
- - inamedparam
- - nonamedreturns
- - musttag
- - ireturn
- - forcetypeassert
- - cyclop
- # deprecated linters
- - deadcode
- - interfacer
- - scopelint
- - varcheck
- - structcheck
- - golint
- - nosnakecase
diff --git a/vendor/github.com/go-openapi/spec/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/spec/CODE_OF_CONDUCT.md
deleted file mode 100644
index 9322b06..0000000
--- a/vendor/github.com/go-openapi/spec/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# 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/vendor/github.com/go-openapi/spec/LICENSE b/vendor/github.com/go-openapi/spec/LICENSE
deleted file mode 100644
index d645695..0000000
--- a/vendor/github.com/go-openapi/spec/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- 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/vendor/github.com/go-openapi/spec/README.md b/vendor/github.com/go-openapi/spec/README.md
deleted file mode 100644
index 7fd2810..0000000
--- a/vendor/github.com/go-openapi/spec/README.md
+++ /dev/null
@@ -1,54 +0,0 @@
-# OpenAPI v2 object model [![Build Status](https://github.com/go-openapi/spec/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/spec/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/spec/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/spec)
-
-[![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/spec/master/LICENSE)
-[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/spec.svg)](https://pkg.go.dev/github.com/go-openapi/spec)
-[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/spec)](https://goreportcard.com/report/github.com/go-openapi/spec)
-
-The object model for OpenAPI specification documents.
-
-### FAQ
-
-* What does this do?
-
-> 1. This package knows how to marshal and unmarshal Swagger API specifications into a golang object model
-> 2. It knows how to resolve $ref and expand them to make a single root document
-
-* How does it play with the rest of the go-openapi packages ?
-
-> 1. This package is at the core of the go-openapi suite of packages and [code generator](https://github.com/go-swagger/go-swagger)
-> 2. There is a [spec loading package](https://github.com/go-openapi/loads) to fetch specs as JSON or YAML from local or remote locations
-> 3. There is a [spec validation package](https://github.com/go-openapi/validate) built on top of it
-> 4. There is a [spec analysis package](https://github.com/go-openapi/analysis) built on top of it, to analyze, flatten, fix and merge spec documents
-
-* Does this library support OpenAPI 3?
-
-> No.
-> This package currently only supports OpenAPI 2.0 (aka Swagger 2.0).
-> There is no plan to make it evolve toward supporting OpenAPI 3.x.
-> This [discussion thread](https://github.com/go-openapi/spec/issues/21) relates the full story.
->
-> An early attempt to support Swagger 3 may be found at: https://github.com/go-openapi/spec3
-
-* Does the unmarshaling support YAML?
-
-> Not directly. The exposed types know only how to unmarshal from JSON.
->
-> In order to load a YAML document as a Swagger spec, you need to use the loaders provided by
-> github.com/go-openapi/loads
->
-> Take a look at the example there: https://pkg.go.dev/github.com/go-openapi/loads#example-Spec
->
-> See also https://github.com/go-openapi/spec/issues/164
-
-* How can I validate a spec?
-
-> Validation is provided by [the validate package](http://github.com/go-openapi/validate)
-
-* Why do we have an `ID` field for `Schema` which is not part of the swagger spec?
-
-> We found jsonschema compatibility more important: since `id` in jsonschema influences
-> how `$ref` are resolved.
-> This `id` does not conflict with any property named `id`.
->
-> See also https://github.com/go-openapi/spec/issues/23
diff --git a/vendor/github.com/go-openapi/spec/cache.go b/vendor/github.com/go-openapi/spec/cache.go
deleted file mode 100644
index 122993b..0000000
--- a/vendor/github.com/go-openapi/spec/cache.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// 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 spec
-
-import (
- "sync"
-)
-
-// ResolutionCache a cache for resolving urls
-type ResolutionCache interface {
- Get(string) (interface{}, bool)
- Set(string, interface{})
-}
-
-type simpleCache struct {
- lock sync.RWMutex
- store map[string]interface{}
-}
-
-func (s *simpleCache) ShallowClone() ResolutionCache {
- store := make(map[string]interface{}, len(s.store))
- s.lock.RLock()
- for k, v := range s.store {
- store[k] = v
- }
- s.lock.RUnlock()
-
- return &simpleCache{
- store: store,
- }
-}
-
-// Get retrieves a cached URI
-func (s *simpleCache) Get(uri string) (interface{}, bool) {
- s.lock.RLock()
- v, ok := s.store[uri]
-
- s.lock.RUnlock()
- return v, ok
-}
-
-// Set caches a URI
-func (s *simpleCache) Set(uri string, data interface{}) {
- s.lock.Lock()
- s.store[uri] = data
- s.lock.Unlock()
-}
-
-var (
- // resCache is a package level cache for $ref resolution and expansion.
- // It is initialized lazily by methods that have the need for it: no
- // memory is allocated unless some expander methods are called.
- //
- // It is initialized with JSON schema and swagger schema,
- // which do not mutate during normal operations.
- //
- // All subsequent utilizations of this cache are produced from a shallow
- // clone of this initial version.
- resCache *simpleCache
- onceCache sync.Once
-
- _ ResolutionCache = &simpleCache{}
-)
-
-// initResolutionCache initializes the URI resolution cache. To be wrapped in a sync.Once.Do call.
-func initResolutionCache() {
- resCache = defaultResolutionCache()
-}
-
-func defaultResolutionCache() *simpleCache {
- return &simpleCache{store: map[string]interface{}{
- "http://swagger.io/v2/schema.json": MustLoadSwagger20Schema(),
- "http://json-schema.org/draft-04/schema": MustLoadJSONSchemaDraft04(),
- }}
-}
-
-func cacheOrDefault(cache ResolutionCache) ResolutionCache {
- onceCache.Do(initResolutionCache)
-
- if cache != nil {
- return cache
- }
-
- // get a shallow clone of the base cache with swagger and json schema
- return resCache.ShallowClone()
-}
diff --git a/vendor/github.com/go-openapi/spec/contact_info.go b/vendor/github.com/go-openapi/spec/contact_info.go
deleted file mode 100644
index a160586..0000000
--- a/vendor/github.com/go-openapi/spec/contact_info.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/swag"
-)
-
-// ContactInfo contact information for the exposed API.
-
-//
-
-// For more information: http://goo.gl/8us55a#contactObject
-
-type ContactInfo struct {
- ContactInfoProps
-
- VendorExtensible
-}
-
-// ContactInfoProps hold the properties of a ContactInfo object
-
-type ContactInfoProps struct {
- Name string `json:"name,omitempty"`
-
- URL string `json:"url,omitempty"`
-
- Email string `json:"email,omitempty"`
-}
-
-// UnmarshalJSON hydrates ContactInfo from json
-
-func (c *ContactInfo) UnmarshalJSON(data []byte) error {
-
- if err := json.Unmarshal(data, &c.ContactInfoProps); err != nil {
-
- return err
-
- }
-
- return json.Unmarshal(data, &c.VendorExtensible)
-
-}
-
-// MarshalJSON produces ContactInfo as json
-
-func (c ContactInfo) MarshalJSON() ([]byte, error) {
-
- b1, err := json.Marshal(c.ContactInfoProps)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b2, err := json.Marshal(c.VendorExtensible)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return swag.ConcatJSON(b1, b2), nil
-
-}
diff --git a/vendor/github.com/go-openapi/spec/debug.go b/vendor/github.com/go-openapi/spec/debug.go
deleted file mode 100644
index 207e6b8..0000000
--- a/vendor/github.com/go-openapi/spec/debug.go
+++ /dev/null
@@ -1,76 +0,0 @@
-// 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 spec
-
-import (
- "fmt"
- "log"
- "os"
- "path"
- "runtime"
-)
-
-// Debug is true when the SWAGGER_DEBUG env var is not empty.
-
-//
-
-// It enables a more verbose logging of this package.
-
-var Debug = os.Getenv("SWAGGER_DEBUG") != ""
-
-var (
-
- // specLogger is a debug logger for this package
-
- specLogger *log.Logger
-)
-
-func init() {
-
- debugOptions()
-
-}
-
-func debugOptions() {
-
- specLogger = log.New(os.Stdout, "spec:", log.LstdFlags)
-
-}
-
-func debugLog(msg string, args ...interface{}) {
-
- // A private, trivial trace logger, based on go-openapi/spec/expander.go:debugLog()
-
- if Debug {
-
- _, file1, pos1, _ := runtime.Caller(1)
-
- specLogger.Printf("%s:%d: %s", path.Base(file1), pos1, fmt.Sprintf(msg, args...))
-
- }
-
-}
diff --git a/vendor/github.com/go-openapi/spec/embed.go b/vendor/github.com/go-openapi/spec/embed.go
deleted file mode 100644
index 49d14e4..0000000
--- a/vendor/github.com/go-openapi/spec/embed.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package spec
-
-import (
- "embed"
- "path"
-)
-
-//go:embed schemas/*.json schemas/*/*.json
-
-var assets embed.FS
-
-func jsonschemaDraft04JSONBytes() ([]byte, error) {
-
- return assets.ReadFile(path.Join("schemas", "jsonschema-draft-04.json"))
-
-}
-
-func v2SchemaJSONBytes() ([]byte, error) {
-
- return assets.ReadFile(path.Join("schemas", "v2", "schema.json"))
-
-}
diff --git a/vendor/github.com/go-openapi/spec/errors.go b/vendor/github.com/go-openapi/spec/errors.go
deleted file mode 100644
index 6992c7b..0000000
--- a/vendor/github.com/go-openapi/spec/errors.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package spec
-
-import "errors"
-
-// Error codes
-var (
- // ErrUnknownTypeForReference indicates that a resolved reference was found in an unsupported container type
- ErrUnknownTypeForReference = errors.New("unknown type for the resolved reference")
-
- // ErrResolveRefNeedsAPointer indicates that a $ref target must be a valid JSON pointer
- ErrResolveRefNeedsAPointer = errors.New("resolve ref: target needs to be a pointer")
-
- // ErrDerefUnsupportedType indicates that a resolved reference was found in an unsupported container type.
- // At the moment, $ref are supported only inside: schemas, parameters, responses, path items
- ErrDerefUnsupportedType = errors.New("deref: unsupported type")
-
- // ErrExpandUnsupportedType indicates that $ref expansion is attempted on some invalid type
- ErrExpandUnsupportedType = errors.New("expand: unsupported type. Input should be of type *Parameter or *Response")
-)
diff --git a/vendor/github.com/go-openapi/spec/expander.go b/vendor/github.com/go-openapi/spec/expander.go
deleted file mode 100644
index 74584f6..0000000
--- a/vendor/github.com/go-openapi/spec/expander.go
+++ /dev/null
@@ -1,1017 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
- "fmt"
-)
-
-// ExpandOptions provides options for the spec expander.
-
-//
-
-// RelativeBase is the path to the root document. This can be a remote URL or a path to a local file.
-
-//
-
-// If left empty, the root document is assumed to be located in the current working directory:
-
-// all relative $ref's will be resolved from there.
-
-//
-
-// PathLoader injects a document loading method. By default, this resolves to the function provided by the SpecLoader package variable.
-
-type ExpandOptions struct {
- RelativeBase string // the path to the root document to expand. This is a file, not a directory
-
- SkipSchemas bool // do not expand schemas, just paths, parameters and responses
-
- ContinueOnError bool // continue expanding even after and error is found
-
- PathLoader func(string) (json.RawMessage, error) `json:"-"` // the document loading method that takes a path as input and yields a json document
-
- AbsoluteCircularRef bool // circular $ref remaining after expansion remain absolute URLs
-
-}
-
-func optionsOrDefault(opts *ExpandOptions) *ExpandOptions {
-
- if opts != nil {
-
- clone := *opts // shallow clone to avoid internal changes to be propagated to the caller
-
- if clone.RelativeBase != "" {
-
- clone.RelativeBase = normalizeBase(clone.RelativeBase)
-
- }
-
- // if the relative base is empty, let the schema loader choose a pseudo root document
-
- return &clone
-
- }
-
- return &ExpandOptions{}
-
-}
-
-// ExpandSpec expands the references in a swagger spec
-
-func ExpandSpec(spec *Swagger, options *ExpandOptions) error {
-
- options = optionsOrDefault(options)
-
- resolver := defaultSchemaLoader(spec, options, nil, nil)
-
- specBasePath := options.RelativeBase
-
- if !options.SkipSchemas {
-
- for key, definition := range spec.Definitions {
-
- parentRefs := make([]string, 0, 10)
-
- parentRefs = append(parentRefs, "#/definitions/"+key)
-
- def, err := expandSchema(definition, parentRefs, resolver, specBasePath)
-
- if resolver.shouldStopOnError(err) {
-
- return err
-
- }
-
- if def != nil {
-
- spec.Definitions[key] = *def
-
- }
-
- }
-
- }
-
- for key := range spec.Parameters {
-
- parameter := spec.Parameters[key]
-
- if err := expandParameterOrResponse(¶meter, resolver, specBasePath); resolver.shouldStopOnError(err) {
-
- return err
-
- }
-
- spec.Parameters[key] = parameter
-
- }
-
- for key := range spec.Responses {
-
- response := spec.Responses[key]
-
- if err := expandParameterOrResponse(&response, resolver, specBasePath); resolver.shouldStopOnError(err) {
-
- return err
-
- }
-
- spec.Responses[key] = response
-
- }
-
- if spec.Paths != nil {
-
- for key := range spec.Paths.Paths {
-
- pth := spec.Paths.Paths[key]
-
- if err := expandPathItem(&pth, resolver, specBasePath); resolver.shouldStopOnError(err) {
-
- return err
-
- }
-
- spec.Paths.Paths[key] = pth
-
- }
-
- }
-
- return nil
-
-}
-
-const rootBase = ".root"
-
-// baseForRoot loads in the cache the root document and produces a fake ".root" base path entry
-
-// for further $ref resolution
-
-func baseForRoot(root interface{}, cache ResolutionCache) string {
-
- // cache the root document to resolve $ref's
-
- normalizedBase := normalizeBase(rootBase)
-
- if root == nil {
-
- // ensure that we never leave a nil root: always cache the root base pseudo-document
-
- cachedRoot, found := cache.Get(normalizedBase)
-
- if found && cachedRoot != nil {
-
- // the cache is already preloaded with a root
-
- return normalizedBase
-
- }
-
- root = map[string]interface{}{}
-
- }
-
- cache.Set(normalizedBase, root)
-
- return normalizedBase
-
-}
-
-// ExpandSchema expands the refs in the schema object with reference to the root object.
-
-//
-
-// go-openapi/validate uses this function.
-
-//
-
-// Notice that it is impossible to reference a json schema in a different document other than root
-
-// (use ExpandSchemaWithBasePath to resolve external references).
-
-//
-
-// Setting the cache is optional and this parameter may safely be left to nil.
-
-func ExpandSchema(schema *Schema, root interface{}, cache ResolutionCache) error {
-
- cache = cacheOrDefault(cache)
-
- if root == nil {
-
- root = schema
-
- }
-
- opts := &ExpandOptions{
-
- // when a root is specified, cache the root as an in-memory document for $ref retrieval
-
- RelativeBase: baseForRoot(root, cache),
-
- SkipSchemas: false,
-
- ContinueOnError: false,
- }
-
- return ExpandSchemaWithBasePath(schema, cache, opts)
-
-}
-
-// ExpandSchemaWithBasePath expands the refs in the schema object, base path configured through expand options.
-
-//
-
-// Setting the cache is optional and this parameter may safely be left to nil.
-
-func ExpandSchemaWithBasePath(schema *Schema, cache ResolutionCache, opts *ExpandOptions) error {
-
- if schema == nil {
-
- return nil
-
- }
-
- cache = cacheOrDefault(cache)
-
- opts = optionsOrDefault(opts)
-
- resolver := defaultSchemaLoader(nil, opts, cache, nil)
-
- parentRefs := make([]string, 0, 10)
-
- s, err := expandSchema(*schema, parentRefs, resolver, opts.RelativeBase)
-
- if err != nil {
-
- return err
-
- }
-
- if s != nil {
-
- // guard for when continuing on error
-
- *schema = *s
-
- }
-
- return nil
-
-}
-
-func expandItems(target Schema, parentRefs []string, resolver *schemaLoader, basePath string) (*Schema, error) {
-
- if target.Items == nil {
-
- return &target, nil
-
- }
-
- // array
-
- if target.Items.Schema != nil {
-
- t, err := expandSchema(*target.Items.Schema, parentRefs, resolver, basePath)
-
- if err != nil {
-
- return nil, err
-
- }
-
- *target.Items.Schema = *t
-
- }
-
- // tuple
-
- for i := range target.Items.Schemas {
-
- t, err := expandSchema(target.Items.Schemas[i], parentRefs, resolver, basePath)
-
- if err != nil {
-
- return nil, err
-
- }
-
- target.Items.Schemas[i] = *t
-
- }
-
- return &target, nil
-
-}
-
-func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, basePath string) (*Schema, error) {
-
- if target.Ref.String() == "" && target.Ref.IsRoot() {
-
- newRef := normalizeRef(&target.Ref, basePath)
-
- target.Ref = *newRef
-
- return &target, nil
-
- }
-
- // change the base path of resolution when an ID is encountered
-
- // otherwise the basePath should inherit the parent's
-
- if target.ID != "" {
-
- basePath, _ = resolver.setSchemaID(target, target.ID, basePath)
-
- }
-
- if target.Ref.String() != "" {
-
- if !resolver.options.SkipSchemas {
-
- return expandSchemaRef(target, parentRefs, resolver, basePath)
-
- }
-
- // when "expand" with SkipSchema, we just rebase the existing $ref without replacing
-
- // the full schema.
-
- rebasedRef, err := NewRef(normalizeURI(target.Ref.String(), basePath))
-
- if err != nil {
-
- return nil, err
-
- }
-
- target.Ref = denormalizeRef(&rebasedRef, resolver.context.basePath, resolver.context.rootID)
-
- return &target, nil
-
- }
-
- for k := range target.Definitions {
-
- tt, err := expandSchema(target.Definitions[k], parentRefs, resolver, basePath)
-
- if resolver.shouldStopOnError(err) {
-
- return &target, err
-
- }
-
- if tt != nil {
-
- target.Definitions[k] = *tt
-
- }
-
- }
-
- t, err := expandItems(target, parentRefs, resolver, basePath)
-
- if resolver.shouldStopOnError(err) {
-
- return &target, err
-
- }
-
- if t != nil {
-
- target = *t
-
- }
-
- for i := range target.AllOf {
-
- t, err := expandSchema(target.AllOf[i], parentRefs, resolver, basePath)
-
- if resolver.shouldStopOnError(err) {
-
- return &target, err
-
- }
-
- if t != nil {
-
- target.AllOf[i] = *t
-
- }
-
- }
-
- for i := range target.AnyOf {
-
- t, err := expandSchema(target.AnyOf[i], parentRefs, resolver, basePath)
-
- if resolver.shouldStopOnError(err) {
-
- return &target, err
-
- }
-
- if t != nil {
-
- target.AnyOf[i] = *t
-
- }
-
- }
-
- for i := range target.OneOf {
-
- t, err := expandSchema(target.OneOf[i], parentRefs, resolver, basePath)
-
- if resolver.shouldStopOnError(err) {
-
- return &target, err
-
- }
-
- if t != nil {
-
- target.OneOf[i] = *t
-
- }
-
- }
-
- if target.Not != nil {
-
- t, err := expandSchema(*target.Not, parentRefs, resolver, basePath)
-
- if resolver.shouldStopOnError(err) {
-
- return &target, err
-
- }
-
- if t != nil {
-
- *target.Not = *t
-
- }
-
- }
-
- for k := range target.Properties {
-
- t, err := expandSchema(target.Properties[k], parentRefs, resolver, basePath)
-
- if resolver.shouldStopOnError(err) {
-
- return &target, err
-
- }
-
- if t != nil {
-
- target.Properties[k] = *t
-
- }
-
- }
-
- if target.AdditionalProperties != nil && target.AdditionalProperties.Schema != nil {
-
- t, err := expandSchema(*target.AdditionalProperties.Schema, parentRefs, resolver, basePath)
-
- if resolver.shouldStopOnError(err) {
-
- return &target, err
-
- }
-
- if t != nil {
-
- *target.AdditionalProperties.Schema = *t
-
- }
-
- }
-
- for k := range target.PatternProperties {
-
- t, err := expandSchema(target.PatternProperties[k], parentRefs, resolver, basePath)
-
- if resolver.shouldStopOnError(err) {
-
- return &target, err
-
- }
-
- if t != nil {
-
- target.PatternProperties[k] = *t
-
- }
-
- }
-
- for k := range target.Dependencies {
-
- if target.Dependencies[k].Schema != nil {
-
- t, err := expandSchema(*target.Dependencies[k].Schema, parentRefs, resolver, basePath)
-
- if resolver.shouldStopOnError(err) {
-
- return &target, err
-
- }
-
- if t != nil {
-
- *target.Dependencies[k].Schema = *t
-
- }
-
- }
-
- }
-
- if target.AdditionalItems != nil && target.AdditionalItems.Schema != nil {
-
- t, err := expandSchema(*target.AdditionalItems.Schema, parentRefs, resolver, basePath)
-
- if resolver.shouldStopOnError(err) {
-
- return &target, err
-
- }
-
- if t != nil {
-
- *target.AdditionalItems.Schema = *t
-
- }
-
- }
-
- return &target, nil
-
-}
-
-func expandSchemaRef(target Schema, parentRefs []string, resolver *schemaLoader, basePath string) (*Schema, error) {
-
- // if a Ref is found, all sibling fields are skipped
-
- // Ref also changes the resolution scope of children expandSchema
-
- // here the resolution scope is changed because a $ref was encountered
-
- normalizedRef := normalizeRef(&target.Ref, basePath)
-
- normalizedBasePath := normalizedRef.RemoteURI()
-
- if resolver.isCircular(normalizedRef, basePath, parentRefs...) {
-
- // this means there is a cycle in the recursion tree: return the Ref
-
- // - circular refs cannot be expanded. We leave them as ref.
-
- // - denormalization means that a new local file ref is set relative to the original basePath
-
- debugLog("short circuit circular ref: basePath: %s, normalizedPath: %s, normalized ref: %s",
-
- basePath, normalizedBasePath, normalizedRef.String())
-
- if !resolver.options.AbsoluteCircularRef {
-
- target.Ref = denormalizeRef(normalizedRef, resolver.context.basePath, resolver.context.rootID)
-
- } else {
-
- target.Ref = *normalizedRef
-
- }
-
- return &target, nil
-
- }
-
- var t *Schema
-
- err := resolver.Resolve(&target.Ref, &t, basePath)
-
- if resolver.shouldStopOnError(err) {
-
- return nil, err
-
- }
-
- if t == nil {
-
- // guard for when continuing on error
-
- return &target, nil
-
- }
-
- parentRefs = append(parentRefs, normalizedRef.String())
-
- transitiveResolver := resolver.transitiveResolver(basePath, target.Ref)
-
- basePath = resolver.updateBasePath(transitiveResolver, normalizedBasePath)
-
- return expandSchema(*t, parentRefs, transitiveResolver, basePath)
-
-}
-
-func expandPathItem(pathItem *PathItem, resolver *schemaLoader, basePath string) error {
-
- if pathItem == nil {
-
- return nil
-
- }
-
- parentRefs := make([]string, 0, 10)
-
- if err := resolver.deref(pathItem, parentRefs, basePath); resolver.shouldStopOnError(err) {
-
- return err
-
- }
-
- if pathItem.Ref.String() != "" {
-
- transitiveResolver := resolver.transitiveResolver(basePath, pathItem.Ref)
-
- basePath = transitiveResolver.updateBasePath(resolver, basePath)
-
- resolver = transitiveResolver
-
- }
-
- pathItem.Ref = Ref{}
-
- for i := range pathItem.Parameters {
-
- if err := expandParameterOrResponse(&(pathItem.Parameters[i]), resolver, basePath); resolver.shouldStopOnError(err) {
-
- return err
-
- }
-
- }
-
- ops := []*Operation{
-
- pathItem.Get,
-
- pathItem.Head,
-
- pathItem.Options,
-
- pathItem.Put,
-
- pathItem.Post,
-
- pathItem.Patch,
-
- pathItem.Delete,
- }
-
- for _, op := range ops {
-
- if err := expandOperation(op, resolver, basePath); resolver.shouldStopOnError(err) {
-
- return err
-
- }
-
- }
-
- return nil
-
-}
-
-func expandOperation(op *Operation, resolver *schemaLoader, basePath string) error {
-
- if op == nil {
-
- return nil
-
- }
-
- for i := range op.Parameters {
-
- param := op.Parameters[i]
-
- if err := expandParameterOrResponse(¶m, resolver, basePath); resolver.shouldStopOnError(err) {
-
- return err
-
- }
-
- op.Parameters[i] = param
-
- }
-
- if op.Responses == nil {
-
- return nil
-
- }
-
- responses := op.Responses
-
- if err := expandParameterOrResponse(responses.Default, resolver, basePath); resolver.shouldStopOnError(err) {
-
- return err
-
- }
-
- for code := range responses.StatusCodeResponses {
-
- response := responses.StatusCodeResponses[code]
-
- if err := expandParameterOrResponse(&response, resolver, basePath); resolver.shouldStopOnError(err) {
-
- return err
-
- }
-
- responses.StatusCodeResponses[code] = response
-
- }
-
- return nil
-
-}
-
-// ExpandResponseWithRoot expands a response based on a root document, not a fetchable document
-
-//
-
-// Notice that it is impossible to reference a json schema in a different document other than root
-
-// (use ExpandResponse to resolve external references).
-
-//
-
-// Setting the cache is optional and this parameter may safely be left to nil.
-
-func ExpandResponseWithRoot(response *Response, root interface{}, cache ResolutionCache) error {
-
- cache = cacheOrDefault(cache)
-
- opts := &ExpandOptions{
-
- RelativeBase: baseForRoot(root, cache),
- }
-
- resolver := defaultSchemaLoader(root, opts, cache, nil)
-
- return expandParameterOrResponse(response, resolver, opts.RelativeBase)
-
-}
-
-// ExpandResponse expands a response based on a basepath
-
-//
-
-// All refs inside response will be resolved relative to basePath
-
-func ExpandResponse(response *Response, basePath string) error {
-
- opts := optionsOrDefault(&ExpandOptions{
-
- RelativeBase: basePath,
- })
-
- resolver := defaultSchemaLoader(nil, opts, nil, nil)
-
- return expandParameterOrResponse(response, resolver, opts.RelativeBase)
-
-}
-
-// ExpandParameterWithRoot expands a parameter based on a root document, not a fetchable document.
-
-//
-
-// Notice that it is impossible to reference a json schema in a different document other than root
-
-// (use ExpandParameter to resolve external references).
-
-func ExpandParameterWithRoot(parameter *Parameter, root interface{}, cache ResolutionCache) error {
-
- cache = cacheOrDefault(cache)
-
- opts := &ExpandOptions{
-
- RelativeBase: baseForRoot(root, cache),
- }
-
- resolver := defaultSchemaLoader(root, opts, cache, nil)
-
- return expandParameterOrResponse(parameter, resolver, opts.RelativeBase)
-
-}
-
-// ExpandParameter expands a parameter based on a basepath.
-
-// This is the exported version of expandParameter
-
-// all refs inside parameter will be resolved relative to basePath
-
-func ExpandParameter(parameter *Parameter, basePath string) error {
-
- opts := optionsOrDefault(&ExpandOptions{
-
- RelativeBase: basePath,
- })
-
- resolver := defaultSchemaLoader(nil, opts, nil, nil)
-
- return expandParameterOrResponse(parameter, resolver, opts.RelativeBase)
-
-}
-
-func getRefAndSchema(input interface{}) (*Ref, *Schema, error) {
-
- var (
- ref *Ref
-
- sch *Schema
- )
-
- switch refable := input.(type) {
-
- case *Parameter:
-
- if refable == nil {
-
- return nil, nil, nil
-
- }
-
- ref = &refable.Ref
-
- sch = refable.Schema
-
- case *Response:
-
- if refable == nil {
-
- return nil, nil, nil
-
- }
-
- ref = &refable.Ref
-
- sch = refable.Schema
-
- default:
-
- return nil, nil, fmt.Errorf("unsupported type: %T: %w", input, ErrExpandUnsupportedType)
-
- }
-
- return ref, sch, nil
-
-}
-
-func expandParameterOrResponse(input interface{}, resolver *schemaLoader, basePath string) error {
-
- ref, sch, err := getRefAndSchema(input)
-
- if err != nil {
-
- return err
-
- }
-
- if ref == nil && sch == nil { // nothing to do
-
- return nil
-
- }
-
- parentRefs := make([]string, 0, 10)
-
- if ref != nil {
-
- // dereference this $ref
-
- if err = resolver.deref(input, parentRefs, basePath); resolver.shouldStopOnError(err) {
-
- return err
-
- }
-
- ref, sch, _ = getRefAndSchema(input)
-
- }
-
- if ref.String() != "" {
-
- transitiveResolver := resolver.transitiveResolver(basePath, *ref)
-
- basePath = resolver.updateBasePath(transitiveResolver, basePath)
-
- resolver = transitiveResolver
-
- }
-
- if sch == nil {
-
- // nothing to be expanded
-
- if ref != nil {
-
- *ref = Ref{}
-
- }
-
- return nil
-
- }
-
- if sch.Ref.String() != "" {
-
- rebasedRef, ern := NewRef(normalizeURI(sch.Ref.String(), basePath))
-
- if ern != nil {
-
- return ern
-
- }
-
- if resolver.isCircular(&rebasedRef, basePath, parentRefs...) {
-
- // this is a circular $ref: stop expansion
-
- if !resolver.options.AbsoluteCircularRef {
-
- sch.Ref = denormalizeRef(&rebasedRef, resolver.context.basePath, resolver.context.rootID)
-
- } else {
-
- sch.Ref = rebasedRef
-
- }
-
- }
-
- }
-
- // $ref expansion or rebasing is performed by expandSchema below
-
- if ref != nil {
-
- *ref = Ref{}
-
- }
-
- // expand schema
-
- // yes, we do it even if options.SkipSchema is true: we have to go down that rabbit hole and rebase nested $ref)
-
- s, err := expandSchema(*sch, parentRefs, resolver, basePath)
-
- if resolver.shouldStopOnError(err) {
-
- return err
-
- }
-
- if s != nil { // guard for when continuing on error
-
- *sch = *s
-
- }
-
- return nil
-
-}
diff --git a/vendor/github.com/go-openapi/spec/external_docs.go b/vendor/github.com/go-openapi/spec/external_docs.go
deleted file mode 100644
index 88add91..0000000
--- a/vendor/github.com/go-openapi/spec/external_docs.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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 spec
-
-// ExternalDocumentation allows referencing an external resource for
-// extended documentation.
-//
-// For more information: http://goo.gl/8us55a#externalDocumentationObject
-type ExternalDocumentation struct {
- Description string `json:"description,omitempty"`
- URL string `json:"url,omitempty"`
-}
diff --git a/vendor/github.com/go-openapi/spec/header.go b/vendor/github.com/go-openapi/spec/header.go
deleted file mode 100644
index 22ce942..0000000
--- a/vendor/github.com/go-openapi/spec/header.go
+++ /dev/null
@@ -1,341 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
- "strings"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-const (
- jsonArray = "array"
-)
-
-// HeaderProps describes a response header
-
-type HeaderProps struct {
- Description string `json:"description,omitempty"`
-}
-
-// Header describes a header for a response of the API
-
-//
-
-// For more information: http://goo.gl/8us55a#headerObject
-
-type Header struct {
- CommonValidations
-
- SimpleSchema
-
- VendorExtensible
-
- HeaderProps
-}
-
-// ResponseHeader creates a new header instance for use in a response
-
-func ResponseHeader() *Header {
-
- return new(Header)
-
-}
-
-// WithDescription sets the description on this response, allows for chaining
-
-func (h *Header) WithDescription(description string) *Header {
-
- h.Description = description
-
- return h
-
-}
-
-// Typed a fluent builder method for the type of parameter
-
-func (h *Header) Typed(tpe, format string) *Header {
-
- h.Type = tpe
-
- h.Format = format
-
- return h
-
-}
-
-// CollectionOf a fluent builder method for an array item
-
-func (h *Header) CollectionOf(items *Items, format string) *Header {
-
- h.Type = jsonArray
-
- h.Items = items
-
- h.CollectionFormat = format
-
- return h
-
-}
-
-// WithDefault sets the default value on this item
-
-func (h *Header) WithDefault(defaultValue interface{}) *Header {
-
- h.Default = defaultValue
-
- return h
-
-}
-
-// WithMaxLength sets a max length value
-
-func (h *Header) WithMaxLength(max int64) *Header {
-
- h.MaxLength = &max
-
- return h
-
-}
-
-// WithMinLength sets a min length value
-
-func (h *Header) WithMinLength(min int64) *Header {
-
- h.MinLength = &min
-
- return h
-
-}
-
-// WithPattern sets a pattern value
-
-func (h *Header) WithPattern(pattern string) *Header {
-
- h.Pattern = pattern
-
- return h
-
-}
-
-// WithMultipleOf sets a multiple of value
-
-func (h *Header) WithMultipleOf(number float64) *Header {
-
- h.MultipleOf = &number
-
- return h
-
-}
-
-// WithMaximum sets a maximum number value
-
-func (h *Header) WithMaximum(max float64, exclusive bool) *Header {
-
- h.Maximum = &max
-
- h.ExclusiveMaximum = exclusive
-
- return h
-
-}
-
-// WithMinimum sets a minimum number value
-
-func (h *Header) WithMinimum(min float64, exclusive bool) *Header {
-
- h.Minimum = &min
-
- h.ExclusiveMinimum = exclusive
-
- return h
-
-}
-
-// WithEnum sets a the enum values (replace)
-
-func (h *Header) WithEnum(values ...interface{}) *Header {
-
- h.Enum = append([]interface{}{}, values...)
-
- return h
-
-}
-
-// WithMaxItems sets the max items
-
-func (h *Header) WithMaxItems(size int64) *Header {
-
- h.MaxItems = &size
-
- return h
-
-}
-
-// WithMinItems sets the min items
-
-func (h *Header) WithMinItems(size int64) *Header {
-
- h.MinItems = &size
-
- return h
-
-}
-
-// UniqueValues dictates that this array can only have unique items
-
-func (h *Header) UniqueValues() *Header {
-
- h.UniqueItems = true
-
- return h
-
-}
-
-// AllowDuplicates this array can have duplicates
-
-func (h *Header) AllowDuplicates() *Header {
-
- h.UniqueItems = false
-
- return h
-
-}
-
-// WithValidations is a fluent method to set header validations
-
-func (h *Header) WithValidations(val CommonValidations) *Header {
-
- h.SetValidations(SchemaValidations{CommonValidations: val})
-
- return h
-
-}
-
-// MarshalJSON marshal this to JSON
-
-func (h Header) MarshalJSON() ([]byte, error) {
-
- b1, err := json.Marshal(h.CommonValidations)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b2, err := json.Marshal(h.SimpleSchema)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b3, err := json.Marshal(h.HeaderProps)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return swag.ConcatJSON(b1, b2, b3), nil
-
-}
-
-// UnmarshalJSON unmarshals this header from JSON
-
-func (h *Header) UnmarshalJSON(data []byte) error {
-
- if err := json.Unmarshal(data, &h.CommonValidations); err != nil {
-
- return err
-
- }
-
- if err := json.Unmarshal(data, &h.SimpleSchema); err != nil {
-
- return err
-
- }
-
- if err := json.Unmarshal(data, &h.VendorExtensible); err != nil {
-
- return err
-
- }
-
- return json.Unmarshal(data, &h.HeaderProps)
-
-}
-
-// JSONLookup look up a value by the json property name
-
-func (h Header) JSONLookup(token string) (interface{}, error) {
-
- if ex, ok := h.Extensions[token]; ok {
-
- return &ex, nil
-
- }
-
- r, _, err := jsonpointer.GetForToken(h.CommonValidations, token)
-
- if err != nil && !strings.HasPrefix(err.Error(), "object has no field") {
-
- return nil, err
-
- }
-
- if r != nil {
-
- return r, nil
-
- }
-
- r, _, err = jsonpointer.GetForToken(h.SimpleSchema, token)
-
- if err != nil && !strings.HasPrefix(err.Error(), "object has no field") {
-
- return nil, err
-
- }
-
- if r != nil {
-
- return r, nil
-
- }
-
- r, _, err = jsonpointer.GetForToken(h.HeaderProps, token)
-
- return r, err
-
-}
diff --git a/vendor/github.com/go-openapi/spec/info.go b/vendor/github.com/go-openapi/spec/info.go
deleted file mode 100644
index 193e804..0000000
--- a/vendor/github.com/go-openapi/spec/info.go
+++ /dev/null
@@ -1,316 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
- "strconv"
- "strings"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-// Extensions vendor specific extensions
-
-type Extensions map[string]interface{}
-
-// Add adds a value to these extensions
-
-func (e Extensions) Add(key string, value interface{}) {
-
- realKey := strings.ToLower(key)
-
- e[realKey] = value
-
-}
-
-// GetString gets a string value from the extensions
-
-func (e Extensions) GetString(key string) (string, bool) {
-
- if v, ok := e[strings.ToLower(key)]; ok {
-
- str, ok := v.(string)
-
- return str, ok
-
- }
-
- return "", false
-
-}
-
-// GetInt gets a int value from the extensions
-
-func (e Extensions) GetInt(key string) (int, bool) {
-
- realKey := strings.ToLower(key)
-
- if v, ok := e.GetString(realKey); ok {
-
- if r, err := strconv.Atoi(v); err == nil {
-
- return r, true
-
- }
-
- }
-
- if v, ok := e[realKey]; ok {
-
- if r, rOk := v.(float64); rOk {
-
- return int(r), true
-
- }
-
- }
-
- return -1, false
-
-}
-
-// GetBool gets a string value from the extensions
-
-func (e Extensions) GetBool(key string) (bool, bool) {
-
- if v, ok := e[strings.ToLower(key)]; ok {
-
- str, ok := v.(bool)
-
- return str, ok
-
- }
-
- return false, false
-
-}
-
-// GetStringSlice gets a string value from the extensions
-
-func (e Extensions) GetStringSlice(key string) ([]string, bool) {
-
- if v, ok := e[strings.ToLower(key)]; ok {
-
- arr, isSlice := v.([]interface{})
-
- if !isSlice {
-
- return nil, false
-
- }
-
- var strs []string
-
- for _, iface := range arr {
-
- str, isString := iface.(string)
-
- if !isString {
-
- return nil, false
-
- }
-
- strs = append(strs, str)
-
- }
-
- return strs, ok
-
- }
-
- return nil, false
-
-}
-
-// VendorExtensible composition block.
-
-type VendorExtensible struct {
- Extensions Extensions
-}
-
-// AddExtension adds an extension to this extensible object
-
-func (v *VendorExtensible) AddExtension(key string, value interface{}) {
-
- if value == nil {
-
- return
-
- }
-
- if v.Extensions == nil {
-
- v.Extensions = make(map[string]interface{})
-
- }
-
- v.Extensions.Add(key, value)
-
-}
-
-// MarshalJSON marshals the extensions to json
-
-func (v VendorExtensible) MarshalJSON() ([]byte, error) {
-
- toser := make(map[string]interface{})
-
- for k, v := range v.Extensions {
-
- lk := strings.ToLower(k)
-
- if strings.HasPrefix(lk, "x-") {
-
- toser[k] = v
-
- }
-
- }
-
- return json.Marshal(toser)
-
-}
-
-// UnmarshalJSON for this extensible object
-
-func (v *VendorExtensible) UnmarshalJSON(data []byte) error {
-
- var d map[string]interface{}
-
- if err := json.Unmarshal(data, &d); err != nil {
-
- return err
-
- }
-
- for k, vv := range d {
-
- lk := strings.ToLower(k)
-
- if strings.HasPrefix(lk, "x-") {
-
- if v.Extensions == nil {
-
- v.Extensions = map[string]interface{}{}
-
- }
-
- v.Extensions[k] = vv
-
- }
-
- }
-
- return nil
-
-}
-
-// InfoProps the properties for an info definition
-
-type InfoProps struct {
- Description string `json:"description,omitempty"`
-
- Title string `json:"title,omitempty"`
-
- TermsOfService string `json:"termsOfService,omitempty"`
-
- Contact *ContactInfo `json:"contact,omitempty"`
-
- License *License `json:"license,omitempty"`
-
- Version string `json:"version,omitempty"`
-}
-
-// Info object provides metadata about the API.
-
-// The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience.
-
-//
-
-// For more information: http://goo.gl/8us55a#infoObject
-
-type Info struct {
- VendorExtensible
-
- InfoProps
-}
-
-// JSONLookup look up a value by the json property name
-
-func (i Info) JSONLookup(token string) (interface{}, error) {
-
- if ex, ok := i.Extensions[token]; ok {
-
- return &ex, nil
-
- }
-
- r, _, err := jsonpointer.GetForToken(i.InfoProps, token)
-
- return r, err
-
-}
-
-// MarshalJSON marshal this to JSON
-
-func (i Info) MarshalJSON() ([]byte, error) {
-
- b1, err := json.Marshal(i.InfoProps)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b2, err := json.Marshal(i.VendorExtensible)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return swag.ConcatJSON(b1, b2), nil
-
-}
-
-// UnmarshalJSON marshal this from JSON
-
-func (i *Info) UnmarshalJSON(data []byte) error {
-
- if err := json.Unmarshal(data, &i.InfoProps); err != nil {
-
- return err
-
- }
-
- return json.Unmarshal(data, &i.VendorExtensible)
-
-}
diff --git a/vendor/github.com/go-openapi/spec/items.go b/vendor/github.com/go-openapi/spec/items.go
deleted file mode 100644
index 51abee0..0000000
--- a/vendor/github.com/go-openapi/spec/items.go
+++ /dev/null
@@ -1,399 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
- "strings"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-const (
- jsonRef = "$ref"
-)
-
-// SimpleSchema describe swagger simple schemas for parameters and headers
-
-type SimpleSchema struct {
- Type string `json:"type,omitempty"`
-
- Nullable bool `json:"nullable,omitempty"`
-
- Format string `json:"format,omitempty"`
-
- Items *Items `json:"items,omitempty"`
-
- CollectionFormat string `json:"collectionFormat,omitempty"`
-
- Default interface{} `json:"default,omitempty"`
-
- Example interface{} `json:"example,omitempty"`
-}
-
-// TypeName return the type (or format) of a simple schema
-
-func (s *SimpleSchema) TypeName() string {
-
- if s.Format != "" {
-
- return s.Format
-
- }
-
- return s.Type
-
-}
-
-// ItemsTypeName yields the type of items in a simple schema array
-
-func (s *SimpleSchema) ItemsTypeName() string {
-
- if s.Items == nil {
-
- return ""
-
- }
-
- return s.Items.TypeName()
-
-}
-
-// Items a limited subset of JSON-Schema's items object.
-
-// It is used by parameter definitions that are not located in "body".
-
-//
-
-// For more information: http://goo.gl/8us55a#items-object
-
-type Items struct {
- Refable
-
- CommonValidations
-
- SimpleSchema
-
- VendorExtensible
-}
-
-// NewItems creates a new instance of items
-
-func NewItems() *Items {
-
- return &Items{}
-
-}
-
-// Typed a fluent builder method for the type of item
-
-func (i *Items) Typed(tpe, format string) *Items {
-
- i.Type = tpe
-
- i.Format = format
-
- return i
-
-}
-
-// AsNullable flags this schema as nullable.
-
-func (i *Items) AsNullable() *Items {
-
- i.Nullable = true
-
- return i
-
-}
-
-// CollectionOf a fluent builder method for an array item
-
-func (i *Items) CollectionOf(items *Items, format string) *Items {
-
- i.Type = jsonArray
-
- i.Items = items
-
- i.CollectionFormat = format
-
- return i
-
-}
-
-// WithDefault sets the default value on this item
-
-func (i *Items) WithDefault(defaultValue interface{}) *Items {
-
- i.Default = defaultValue
-
- return i
-
-}
-
-// WithMaxLength sets a max length value
-
-func (i *Items) WithMaxLength(max int64) *Items {
-
- i.MaxLength = &max
-
- return i
-
-}
-
-// WithMinLength sets a min length value
-
-func (i *Items) WithMinLength(min int64) *Items {
-
- i.MinLength = &min
-
- return i
-
-}
-
-// WithPattern sets a pattern value
-
-func (i *Items) WithPattern(pattern string) *Items {
-
- i.Pattern = pattern
-
- return i
-
-}
-
-// WithMultipleOf sets a multiple of value
-
-func (i *Items) WithMultipleOf(number float64) *Items {
-
- i.MultipleOf = &number
-
- return i
-
-}
-
-// WithMaximum sets a maximum number value
-
-func (i *Items) WithMaximum(max float64, exclusive bool) *Items {
-
- i.Maximum = &max
-
- i.ExclusiveMaximum = exclusive
-
- return i
-
-}
-
-// WithMinimum sets a minimum number value
-
-func (i *Items) WithMinimum(min float64, exclusive bool) *Items {
-
- i.Minimum = &min
-
- i.ExclusiveMinimum = exclusive
-
- return i
-
-}
-
-// WithEnum sets a the enum values (replace)
-
-func (i *Items) WithEnum(values ...interface{}) *Items {
-
- i.Enum = append([]interface{}{}, values...)
-
- return i
-
-}
-
-// WithMaxItems sets the max items
-
-func (i *Items) WithMaxItems(size int64) *Items {
-
- i.MaxItems = &size
-
- return i
-
-}
-
-// WithMinItems sets the min items
-
-func (i *Items) WithMinItems(size int64) *Items {
-
- i.MinItems = &size
-
- return i
-
-}
-
-// UniqueValues dictates that this array can only have unique items
-
-func (i *Items) UniqueValues() *Items {
-
- i.UniqueItems = true
-
- return i
-
-}
-
-// AllowDuplicates this array can have duplicates
-
-func (i *Items) AllowDuplicates() *Items {
-
- i.UniqueItems = false
-
- return i
-
-}
-
-// WithValidations is a fluent method to set Items validations
-
-func (i *Items) WithValidations(val CommonValidations) *Items {
-
- i.SetValidations(SchemaValidations{CommonValidations: val})
-
- return i
-
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-
-func (i *Items) UnmarshalJSON(data []byte) error {
-
- var validations CommonValidations
-
- if err := json.Unmarshal(data, &validations); err != nil {
-
- return err
-
- }
-
- var ref Refable
-
- if err := json.Unmarshal(data, &ref); err != nil {
-
- return err
-
- }
-
- var simpleSchema SimpleSchema
-
- if err := json.Unmarshal(data, &simpleSchema); err != nil {
-
- return err
-
- }
-
- var vendorExtensible VendorExtensible
-
- if err := json.Unmarshal(data, &vendorExtensible); err != nil {
-
- return err
-
- }
-
- i.Refable = ref
-
- i.CommonValidations = validations
-
- i.SimpleSchema = simpleSchema
-
- i.VendorExtensible = vendorExtensible
-
- return nil
-
-}
-
-// MarshalJSON converts this items object to JSON
-
-func (i Items) MarshalJSON() ([]byte, error) {
-
- b1, err := json.Marshal(i.CommonValidations)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b2, err := json.Marshal(i.SimpleSchema)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b3, err := json.Marshal(i.Refable)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b4, err := json.Marshal(i.VendorExtensible)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return swag.ConcatJSON(b4, b3, b1, b2), nil
-
-}
-
-// JSONLookup look up a value by the json property name
-
-func (i Items) JSONLookup(token string) (interface{}, error) {
-
- if token == jsonRef {
-
- return &i.Ref, nil
-
- }
-
- r, _, err := jsonpointer.GetForToken(i.CommonValidations, token)
-
- if err != nil && !strings.HasPrefix(err.Error(), "object has no field") {
-
- return nil, err
-
- }
-
- if r != nil {
-
- return r, nil
-
- }
-
- r, _, err = jsonpointer.GetForToken(i.SimpleSchema, token)
-
- return r, err
-
-}
diff --git a/vendor/github.com/go-openapi/spec/license.go b/vendor/github.com/go-openapi/spec/license.go
deleted file mode 100644
index bdfc6a9..0000000
--- a/vendor/github.com/go-openapi/spec/license.go
+++ /dev/null
@@ -1,91 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/swag"
-)
-
-// License information for the exposed API.
-
-//
-
-// For more information: http://goo.gl/8us55a#licenseObject
-
-type License struct {
- LicenseProps
-
- VendorExtensible
-}
-
-// LicenseProps holds the properties of a License object
-
-type LicenseProps struct {
- Name string `json:"name,omitempty"`
-
- URL string `json:"url,omitempty"`
-}
-
-// UnmarshalJSON hydrates License from json
-
-func (l *License) UnmarshalJSON(data []byte) error {
-
- if err := json.Unmarshal(data, &l.LicenseProps); err != nil {
-
- return err
-
- }
-
- return json.Unmarshal(data, &l.VendorExtensible)
-
-}
-
-// MarshalJSON produces License as json
-
-func (l License) MarshalJSON() ([]byte, error) {
-
- b1, err := json.Marshal(l.LicenseProps)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b2, err := json.Marshal(l.VendorExtensible)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return swag.ConcatJSON(b1, b2), nil
-
-}
diff --git a/vendor/github.com/go-openapi/spec/normalizer.go b/vendor/github.com/go-openapi/spec/normalizer.go
deleted file mode 100644
index 27da40c..0000000
--- a/vendor/github.com/go-openapi/spec/normalizer.go
+++ /dev/null
@@ -1,333 +0,0 @@
-// 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 spec
-
-import (
- "net/url"
- "path"
- "strings"
-)
-
-const fileScheme = "file"
-
-// normalizeURI ensures that all $ref paths used internally by the expander are canonicalized.
-
-//
-
-// NOTE(windows): there is a tolerance over the strict URI format on windows.
-
-//
-
-// The normalizer accepts relative file URLs like 'Path\File.JSON' as well as absolute file URLs like
-
-// 'C:\Path\file.Yaml'.
-
-//
-
-// Both are canonicalized with a "file://" scheme, slashes and a lower-cased path:
-
-// 'file:///c:/path/file.yaml'
-
-//
-
-// URLs can be specified with a file scheme, like in 'file:///folder/file.json' or
-
-// 'file:///c:\folder\File.json'.
-
-//
-
-// URLs like file://C:\folder are considered invalid (i.e. there is no host 'c:\folder') and a "repair"
-
-// is attempted.
-
-//
-
-// The base path argument is assumed to be canonicalized (e.g. using normalizeBase()).
-
-func normalizeURI(refPath, base string) string {
-
- refURL, err := parseURL(refPath)
-
- if err != nil {
-
- specLogger.Printf("warning: invalid URI in $ref %q: %v", refPath, err)
-
- refURL, refPath = repairURI(refPath)
-
- }
-
- fixWindowsURI(refURL, refPath) // noop on non-windows OS
-
- refURL.Path = path.Clean(refURL.Path)
-
- if refURL.Path == "." {
-
- refURL.Path = ""
-
- }
-
- r := MustCreateRef(refURL.String())
-
- if r.IsCanonical() {
-
- return refURL.String()
-
- }
-
- baseURL, _ := parseURL(base)
-
- if path.IsAbs(refURL.Path) {
-
- baseURL.Path = refURL.Path
-
- } else if refURL.Path != "" {
-
- baseURL.Path = path.Join(path.Dir(baseURL.Path), refURL.Path)
-
- }
-
- // copying fragment from ref to base
-
- baseURL.Fragment = refURL.Fragment
-
- return baseURL.String()
-
-}
-
-// denormalizeRef returns the simplest notation for a normalized $ref, given the path of the original root document.
-
-//
-
-// When calling this, we assume that:
-
-// * $ref is a canonical URI
-
-// * originalRelativeBase is a canonical URI
-
-//
-
-// denormalizeRef is currently used when we rewrite a $ref after a circular $ref has been detected.
-
-// In this case, expansion stops and normally renders the internal canonical $ref.
-
-//
-
-// This internal $ref is eventually rebased to the original RelativeBase used for the expansion.
-
-//
-
-// There is a special case for schemas that are anchored with an "id":
-
-// in that case, the rebasing is performed // against the id only if this is an anchor for the initial root document.
-
-// All other intermediate "id"'s found along the way are ignored for the purpose of rebasing.
-
-func denormalizeRef(ref *Ref, originalRelativeBase, id string) Ref {
-
- debugLog("denormalizeRef called:\n$ref: %q\noriginal: %s\nroot ID:%s", ref.String(), originalRelativeBase, id)
-
- if ref.String() == "" || ref.IsRoot() || ref.HasFragmentOnly {
-
- // short circuit: $ref to current doc
-
- return *ref
-
- }
-
- if id != "" {
-
- idBaseURL, err := parseURL(id)
-
- if err == nil { // if the schema id is not usable as a URI, ignore it
-
- if ref, ok := rebase(ref, idBaseURL, true); ok { // rebase, but keep references to root unchaged (do not want $ref: "")
-
- // $ref relative to the ID of the schema in the root document
-
- return ref
-
- }
-
- }
-
- }
-
- originalRelativeBaseURL, _ := parseURL(originalRelativeBase)
-
- r, _ := rebase(ref, originalRelativeBaseURL, false)
-
- return r
-
-}
-
-func rebase(ref *Ref, v *url.URL, notEqual bool) (Ref, bool) {
-
- var newBase url.URL
-
- u := ref.GetURL()
-
- if u.Scheme != v.Scheme || u.Host != v.Host {
-
- return *ref, false
-
- }
-
- docPath := v.Path
-
- v.Path = path.Dir(v.Path)
-
- if v.Path == "." {
-
- v.Path = ""
-
- } else if !strings.HasSuffix(v.Path, "/") {
-
- v.Path += "/"
-
- }
-
- newBase.Fragment = u.Fragment
-
- if strings.HasPrefix(u.Path, docPath) {
-
- newBase.Path = strings.TrimPrefix(u.Path, docPath)
-
- } else {
-
- newBase.Path = strings.TrimPrefix(u.Path, v.Path)
-
- }
-
- if notEqual && newBase.Path == "" && newBase.Fragment == "" {
-
- // do not want rebasing to end up in an empty $ref
-
- return *ref, false
-
- }
-
- if path.IsAbs(newBase.Path) {
-
- // whenever we end up with an absolute path, specify the scheme and host
-
- newBase.Scheme = v.Scheme
-
- newBase.Host = v.Host
-
- }
-
- return MustCreateRef(newBase.String()), true
-
-}
-
-// normalizeRef canonicalize a Ref, using a canonical relativeBase as its absolute anchor
-
-func normalizeRef(ref *Ref, relativeBase string) *Ref {
-
- r := MustCreateRef(normalizeURI(ref.String(), relativeBase))
-
- return &r
-
-}
-
-// normalizeBase performs a normalization of the input base path.
-
-//
-
-// This always yields a canonical URI (absolute), usable for the document cache.
-
-//
-
-// It ensures that all further internal work on basePath may safely assume
-
-// a non-empty, cross-platform, canonical URI (i.e. absolute).
-
-//
-
-// This normalization tolerates windows paths (e.g. C:\x\y\File.dat) and transform this
-
-// in a file:// URL with lower cased drive letter and path.
-
-//
-
-// See also: https://en.wikipedia.org/wiki/File_URI_scheme
-
-func normalizeBase(in string) string {
-
- u, err := parseURL(in)
-
- if err != nil {
-
- specLogger.Printf("warning: invalid URI in RelativeBase %q: %v", in, err)
-
- u, in = repairURI(in)
-
- }
-
- u.Fragment = "" // any fragment in the base is irrelevant
-
- fixWindowsURI(u, in) // noop on non-windows OS
-
- u.Path = path.Clean(u.Path)
-
- if u.Path == "." { // empty after Clean()
-
- u.Path = ""
-
- }
-
- if u.Scheme != "" {
-
- if path.IsAbs(u.Path) || u.Scheme != fileScheme {
-
- // this is absolute or explicitly not a local file: we're good
-
- return u.String()
-
- }
-
- }
-
- // no scheme or file scheme with relative path: assume file and make it absolute
-
- // enforce scheme file://... with absolute path.
-
- //
-
- // If the input path is relative, we anchor the path to the current working directory.
-
- // NOTE: we may end up with a host component. Leave it unchanged: e.g. file://host/folder/file.json
-
- u.Scheme = fileScheme
-
- u.Path = absPath(u.Path) // platform-dependent
-
- u.RawQuery = "" // any query component is irrelevant for a base
-
- return u.String()
-
-}
diff --git a/vendor/github.com/go-openapi/spec/normalizer_nonwindows.go b/vendor/github.com/go-openapi/spec/normalizer_nonwindows.go
deleted file mode 100644
index 4985cc5..0000000
--- a/vendor/github.com/go-openapi/spec/normalizer_nonwindows.go
+++ /dev/null
@@ -1,71 +0,0 @@
-//go:build !windows
-// +build !windows
-
-// 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 spec
-
-import (
- "net/url"
- "path/filepath"
-)
-
-// absPath makes a file path absolute and compatible with a URI path component.
-
-//
-
-// The parameter must be a path, not an URI.
-
-func absPath(in string) string {
-
- anchored, err := filepath.Abs(in)
-
- if err != nil {
-
- specLogger.Printf("warning: could not resolve current working directory: %v", err)
-
- return in
-
- }
-
- return anchored
-
-}
-
-func repairURI(in string) (*url.URL, string) {
-
- u, _ := parseURL("")
-
- debugLog("repaired URI: original: %q, repaired: %q", in, "")
-
- return u, ""
-
-}
-
-func fixWindowsURI(_ *url.URL, _ string) {
-
-}
diff --git a/vendor/github.com/go-openapi/spec/normalizer_windows.go b/vendor/github.com/go-openapi/spec/normalizer_windows.go
deleted file mode 100644
index fd88b39..0000000
--- a/vendor/github.com/go-openapi/spec/normalizer_windows.go
+++ /dev/null
@@ -1,259 +0,0 @@
-// -build windows
-
-// 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 spec
-
-import (
- "net/url"
- "os"
- "path"
- "path/filepath"
- "strings"
-)
-
-// absPath makes a file path absolute and compatible with a URI path component
-
-//
-
-// The parameter must be a path, not an URI.
-
-func absPath(in string) string {
-
- // NOTE(windows): filepath.Abs exhibits a special behavior on windows for empty paths.
-
- // See https://github.com/golang/go/issues/24441
-
- if in == "" {
-
- in = "."
-
- }
-
- anchored, err := filepath.Abs(in)
-
- if err != nil {
-
- specLogger.Printf("warning: could not resolve current working directory: %v", err)
-
- return in
-
- }
-
- pth := strings.ReplaceAll(strings.ToLower(anchored), `\`, `/`)
-
- if !strings.HasPrefix(pth, "/") {
-
- pth = "/" + pth
-
- }
-
- return path.Clean(pth)
-
-}
-
-// repairURI tolerates invalid file URIs with common typos
-
-// such as 'file://E:\folder\file', that break the regular URL parser.
-
-//
-
-// Adopting the same defaults as for unixes (e.g. return an empty path) would
-
-// result into a counter-intuitive result for that case (e.g. E:\folder\file is
-
-// eventually resolved as the current directory). The repair will detect the missing "/".
-
-//
-
-// Note that this only works for the file scheme.
-
-func repairURI(in string) (*url.URL, string) {
-
- const prefix = fileScheme + "://"
-
- if !strings.HasPrefix(in, prefix) {
-
- // giving up: resolve to empty path
-
- u, _ := parseURL("")
-
- return u, ""
-
- }
-
- // attempt the repair, stripping the scheme should be sufficient
-
- u, _ := parseURL(strings.TrimPrefix(in, prefix))
-
- debugLog("repaired URI: original: %q, repaired: %q", in, u.String())
-
- return u, u.String()
-
-}
-
-// fixWindowsURI tolerates an absolute file path on windows such as C:\Base\File.yaml or \\host\share\Base\File.yaml
-
-// and makes it a canonical URI: file:///c:/base/file.yaml
-
-//
-
-// Catch 22 notes for Windows:
-
-//
-
-// * There may be a drive letter on windows (it is lower-cased)
-
-// * There may be a share UNC, e.g. \\server\folder\data.xml
-
-// * Paths are case insensitive
-
-// * Paths may already contain slashes
-
-// * Paths must be slashed
-
-//
-
-// NOTE: there is no escaping. "/" may be valid separators just like "\".
-
-// We don't use ToSlash() (which escapes everything) because windows now also
-
-// tolerates the use of "/". Hence, both C:\File.yaml and C:/File.yaml will work.
-
-func fixWindowsURI(u *url.URL, in string) {
-
- drive := filepath.VolumeName(in)
-
- if len(drive) > 0 {
-
- if len(u.Scheme) == 1 && strings.EqualFold(u.Scheme, drive[:1]) { // a path with a drive letter
-
- u.Scheme = fileScheme
-
- u.Host = ""
-
- u.Path = strings.Join([]string{drive, u.Opaque, u.Path}, `/`) // reconstruct the full path component (no fragment, no query)
-
- } else if u.Host == "" && strings.HasPrefix(u.Path, drive) { // a path with a \\host volume
-
- // NOTE: the special host@port syntax for UNC is not supported (yet)
-
- u.Scheme = fileScheme
-
- // this is a modified version of filepath.Dir() to apply on the VolumeName itself
-
- i := len(drive) - 1
-
- for i >= 0 && !os.IsPathSeparator(drive[i]) {
-
- i--
-
- }
-
- host := drive[:i] // \\host\share => host
-
- u.Path = strings.TrimPrefix(u.Path, host)
-
- u.Host = strings.TrimPrefix(host, `\\`)
-
- }
-
- u.Opaque = ""
-
- u.Path = strings.ReplaceAll(strings.ToLower(u.Path), `\`, `/`)
-
- // ensure we form an absolute path
-
- if !strings.HasPrefix(u.Path, "/") {
-
- u.Path = "/" + u.Path
-
- }
-
- u.Path = path.Clean(u.Path)
-
- return
-
- }
-
- if u.Scheme == fileScheme {
-
- // Handle dodgy cases for file://{...} URIs on windows.
-
- // A canonical URI should always be followed by an absolute path.
-
- //
-
- // Examples:
-
- // * file:///folder/file => valid, unchanged
-
- // * file:///c:\folder\file => slashed
-
- // * file:///./folder/file => valid, cleaned to remove the dot
-
- // * file:///.\folder\file => remapped to cwd
-
- // * file:///. => dodgy, remapped to / (consistent with the behavior on unix)
-
- // * file:///.. => dodgy, remapped to / (consistent with the behavior on unix)
-
- if (!path.IsAbs(u.Path) && !filepath.IsAbs(u.Path)) || (strings.HasPrefix(u.Path, `/.`) && strings.Contains(u.Path, `\`)) {
-
- // ensure we form an absolute path
-
- u.Path, _ = filepath.Abs(strings.TrimLeft(u.Path, `/`))
-
- if !strings.HasPrefix(u.Path, "/") {
-
- u.Path = "/" + u.Path
-
- }
-
- }
-
- u.Path = strings.ToLower(u.Path)
-
- }
-
- // NOTE: lower case normalization does not propagate to inner resources,
-
- // generated when rebasing: when joining a relative URI with a file to an absolute base,
-
- // only the base is currently lower-cased.
-
- //
-
- // For now, we assume this is good enough for most use cases
-
- // and try not to generate too many differences
-
- // between the output produced on different platforms.
-
- u.Path = path.Clean(strings.ReplaceAll(u.Path, `\`, `/`))
-
-}
diff --git a/vendor/github.com/go-openapi/spec/operation.go b/vendor/github.com/go-openapi/spec/operation.go
deleted file mode 100644
index 0301369..0000000
--- a/vendor/github.com/go-openapi/spec/operation.go
+++ /dev/null
@@ -1,674 +0,0 @@
-// 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 spec
-
-import (
- "bytes"
- "encoding/gob"
- "encoding/json"
- "sort"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-func init() {
-
- gob.Register(map[string]interface{}{})
-
- gob.Register([]interface{}{})
-
-}
-
-// OperationProps describes an operation
-
-//
-
-// NOTES:
-
-// - schemes, when present must be from [http, https, ws, wss]: see validate
-
-// - Security is handled as a special case: see MarshalJSON function
-
-type OperationProps struct {
- Description string `json:"description,omitempty"`
-
- Consumes []string `json:"consumes,omitempty"`
-
- Produces []string `json:"produces,omitempty"`
-
- Schemes []string `json:"schemes,omitempty"`
-
- Tags []string `json:"tags,omitempty"`
-
- Summary string `json:"summary,omitempty"`
-
- ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
-
- ID string `json:"operationId,omitempty"`
-
- Deprecated bool `json:"deprecated,omitempty"`
-
- Security []map[string][]string `json:"security,omitempty"`
-
- Parameters []Parameter `json:"parameters,omitempty"`
-
- Responses *Responses `json:"responses,omitempty"`
-}
-
-// MarshalJSON takes care of serializing operation properties to JSON
-
-//
-
-// We use a custom marhaller here to handle a special cases related to
-
-// the Security field. We need to preserve zero length slice
-
-// while omitting the field when the value is nil/unset.
-
-func (op OperationProps) MarshalJSON() ([]byte, error) {
-
- type Alias OperationProps
-
- if op.Security == nil {
-
- return json.Marshal(&struct {
- Security []map[string][]string `json:"security,omitempty"`
-
- *Alias
- }{
-
- Security: op.Security,
-
- Alias: (*Alias)(&op),
- })
-
- }
-
- return json.Marshal(&struct {
- Security []map[string][]string `json:"security"`
-
- *Alias
- }{
-
- Security: op.Security,
-
- Alias: (*Alias)(&op),
- })
-
-}
-
-// Operation describes a single API operation on a path.
-
-//
-
-// For more information: http://goo.gl/8us55a#operationObject
-
-type Operation struct {
- VendorExtensible
-
- OperationProps
-}
-
-// SuccessResponse gets a success response model
-
-func (o *Operation) SuccessResponse() (*Response, int, bool) {
-
- if o.Responses == nil {
-
- return nil, 0, false
-
- }
-
- responseCodes := make([]int, 0, len(o.Responses.StatusCodeResponses))
-
- for k := range o.Responses.StatusCodeResponses {
-
- if k >= 200 && k < 300 {
-
- responseCodes = append(responseCodes, k)
-
- }
-
- }
-
- if len(responseCodes) > 0 {
-
- sort.Ints(responseCodes)
-
- v := o.Responses.StatusCodeResponses[responseCodes[0]]
-
- return &v, responseCodes[0], true
-
- }
-
- return o.Responses.Default, 0, false
-
-}
-
-// JSONLookup look up a value by the json property name
-
-func (o Operation) JSONLookup(token string) (interface{}, error) {
-
- if ex, ok := o.Extensions[token]; ok {
-
- return &ex, nil
-
- }
-
- r, _, err := jsonpointer.GetForToken(o.OperationProps, token)
-
- return r, err
-
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-
-func (o *Operation) UnmarshalJSON(data []byte) error {
-
- if err := json.Unmarshal(data, &o.OperationProps); err != nil {
-
- return err
-
- }
-
- return json.Unmarshal(data, &o.VendorExtensible)
-
-}
-
-// MarshalJSON converts this items object to JSON
-
-func (o Operation) MarshalJSON() ([]byte, error) {
-
- b1, err := json.Marshal(o.OperationProps)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b2, err := json.Marshal(o.VendorExtensible)
-
- if err != nil {
-
- return nil, err
-
- }
-
- concated := swag.ConcatJSON(b1, b2)
-
- return concated, nil
-
-}
-
-// NewOperation creates a new operation instance.
-
-// It expects an ID as parameter but not passing an ID is also valid.
-
-func NewOperation(id string) *Operation {
-
- op := new(Operation)
-
- op.ID = id
-
- return op
-
-}
-
-// WithID sets the ID property on this operation, allows for chaining.
-
-func (o *Operation) WithID(id string) *Operation {
-
- o.ID = id
-
- return o
-
-}
-
-// WithDescription sets the description on this operation, allows for chaining
-
-func (o *Operation) WithDescription(description string) *Operation {
-
- o.Description = description
-
- return o
-
-}
-
-// WithSummary sets the summary on this operation, allows for chaining
-
-func (o *Operation) WithSummary(summary string) *Operation {
-
- o.Summary = summary
-
- return o
-
-}
-
-// WithExternalDocs sets/removes the external docs for/from this operation.
-
-// When you pass empty strings as params the external documents will be removed.
-
-// When you pass non-empty string as one value then those values will be used on the external docs object.
-
-// So when you pass a non-empty description, you should also pass the url and vice versa.
-
-func (o *Operation) WithExternalDocs(description, url string) *Operation {
-
- if description == "" && url == "" {
-
- o.ExternalDocs = nil
-
- return o
-
- }
-
- if o.ExternalDocs == nil {
-
- o.ExternalDocs = &ExternalDocumentation{}
-
- }
-
- o.ExternalDocs.Description = description
-
- o.ExternalDocs.URL = url
-
- return o
-
-}
-
-// Deprecate marks the operation as deprecated
-
-func (o *Operation) Deprecate() *Operation {
-
- o.Deprecated = true
-
- return o
-
-}
-
-// Undeprecate marks the operation as not deprected
-
-func (o *Operation) Undeprecate() *Operation {
-
- o.Deprecated = false
-
- return o
-
-}
-
-// WithConsumes adds media types for incoming body values
-
-func (o *Operation) WithConsumes(mediaTypes ...string) *Operation {
-
- o.Consumes = append(o.Consumes, mediaTypes...)
-
- return o
-
-}
-
-// WithProduces adds media types for outgoing body values
-
-func (o *Operation) WithProduces(mediaTypes ...string) *Operation {
-
- o.Produces = append(o.Produces, mediaTypes...)
-
- return o
-
-}
-
-// WithTags adds tags for this operation
-
-func (o *Operation) WithTags(tags ...string) *Operation {
-
- o.Tags = append(o.Tags, tags...)
-
- return o
-
-}
-
-// AddParam adds a parameter to this operation, when a parameter for that location
-
-// and with that name already exists it will be replaced
-
-func (o *Operation) AddParam(param *Parameter) *Operation {
-
- if param == nil {
-
- return o
-
- }
-
- for i, p := range o.Parameters {
-
- if p.Name == param.Name && p.In == param.In {
-
- params := make([]Parameter, 0, len(o.Parameters)+1)
-
- params = append(params, o.Parameters[:i]...)
-
- params = append(params, *param)
-
- params = append(params, o.Parameters[i+1:]...)
-
- o.Parameters = params
-
- return o
-
- }
-
- }
-
- o.Parameters = append(o.Parameters, *param)
-
- return o
-
-}
-
-// RemoveParam removes a parameter from the operation
-
-func (o *Operation) RemoveParam(name, in string) *Operation {
-
- for i, p := range o.Parameters {
-
- if p.Name == name && p.In == in {
-
- o.Parameters = append(o.Parameters[:i], o.Parameters[i+1:]...)
-
- return o
-
- }
-
- }
-
- return o
-
-}
-
-// SecuredWith adds a security scope to this operation.
-
-func (o *Operation) SecuredWith(name string, scopes ...string) *Operation {
-
- o.Security = append(o.Security, map[string][]string{name: scopes})
-
- return o
-
-}
-
-// WithDefaultResponse adds a default response to the operation.
-
-// Passing a nil value will remove the response
-
-func (o *Operation) WithDefaultResponse(response *Response) *Operation {
-
- return o.RespondsWith(0, response)
-
-}
-
-// RespondsWith adds a status code response to the operation.
-
-// When the code is 0 the value of the response will be used as default response value.
-
-// When the value of the response is nil it will be removed from the operation
-
-func (o *Operation) RespondsWith(code int, response *Response) *Operation {
-
- if o.Responses == nil {
-
- o.Responses = new(Responses)
-
- }
-
- if code == 0 {
-
- o.Responses.Default = response
-
- return o
-
- }
-
- if response == nil {
-
- delete(o.Responses.StatusCodeResponses, code)
-
- return o
-
- }
-
- if o.Responses.StatusCodeResponses == nil {
-
- o.Responses.StatusCodeResponses = make(map[int]Response)
-
- }
-
- o.Responses.StatusCodeResponses[code] = *response
-
- return o
-
-}
-
-type opsAlias OperationProps
-
-type gobAlias struct {
- Security []map[string]struct {
- List []string
-
- Pad bool
- }
-
- Alias *opsAlias
-
- SecurityIsEmpty bool
-}
-
-// GobEncode provides a safe gob encoder for Operation, including empty security requirements
-
-func (o Operation) GobEncode() ([]byte, error) {
-
- raw := struct {
- Ext VendorExtensible
-
- Props OperationProps
- }{
-
- Ext: o.VendorExtensible,
-
- Props: o.OperationProps,
- }
-
- var b bytes.Buffer
-
- err := gob.NewEncoder(&b).Encode(raw)
-
- return b.Bytes(), err
-
-}
-
-// GobDecode provides a safe gob decoder for Operation, including empty security requirements
-
-func (o *Operation) GobDecode(b []byte) error {
-
- var raw struct {
- Ext VendorExtensible
-
- Props OperationProps
- }
-
- buf := bytes.NewBuffer(b)
-
- err := gob.NewDecoder(buf).Decode(&raw)
-
- if err != nil {
-
- return err
-
- }
-
- o.VendorExtensible = raw.Ext
-
- o.OperationProps = raw.Props
-
- return nil
-
-}
-
-// GobEncode provides a safe gob encoder for Operation, including empty security requirements
-
-func (op OperationProps) GobEncode() ([]byte, error) {
-
- raw := gobAlias{
-
- Alias: (*opsAlias)(&op),
- }
-
- var b bytes.Buffer
-
- if op.Security == nil {
-
- // nil security requirement
-
- err := gob.NewEncoder(&b).Encode(raw)
-
- return b.Bytes(), err
-
- }
-
- if len(op.Security) == 0 {
-
- // empty, but non-nil security requirement
-
- raw.SecurityIsEmpty = true
-
- raw.Alias.Security = nil
-
- err := gob.NewEncoder(&b).Encode(raw)
-
- return b.Bytes(), err
-
- }
-
- raw.Security = make([]map[string]struct {
- List []string
-
- Pad bool
- }, 0, len(op.Security))
-
- for _, req := range op.Security {
-
- v := make(map[string]struct {
- List []string
-
- Pad bool
- }, len(req))
-
- for k, val := range req {
-
- v[k] = struct {
- List []string
-
- Pad bool
- }{
-
- List: val,
- }
-
- }
-
- raw.Security = append(raw.Security, v)
-
- }
-
- err := gob.NewEncoder(&b).Encode(raw)
-
- return b.Bytes(), err
-
-}
-
-// GobDecode provides a safe gob decoder for Operation, including empty security requirements
-
-func (op *OperationProps) GobDecode(b []byte) error {
-
- var raw gobAlias
-
- buf := bytes.NewBuffer(b)
-
- err := gob.NewDecoder(buf).Decode(&raw)
-
- if err != nil {
-
- return err
-
- }
-
- if raw.Alias == nil {
-
- return nil
-
- }
-
- switch {
-
- case raw.SecurityIsEmpty:
-
- // empty, but non-nil security requirement
-
- raw.Alias.Security = []map[string][]string{}
-
- case len(raw.Alias.Security) == 0:
-
- // nil security requirement
-
- raw.Alias.Security = nil
-
- default:
-
- raw.Alias.Security = make([]map[string][]string, 0, len(raw.Security))
-
- for _, req := range raw.Security {
-
- v := make(map[string][]string, len(req))
-
- for k, val := range req {
-
- v[k] = make([]string, 0, len(val.List))
-
- v[k] = append(v[k], val.List...)
-
- }
-
- raw.Alias.Security = append(raw.Alias.Security, v)
-
- }
-
- }
-
- *op = *(*OperationProps)(raw.Alias)
-
- return nil
-
-}
diff --git a/vendor/github.com/go-openapi/spec/parameter.go b/vendor/github.com/go-openapi/spec/parameter.go
deleted file mode 100644
index add9919..0000000
--- a/vendor/github.com/go-openapi/spec/parameter.go
+++ /dev/null
@@ -1,565 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
- "strings"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-// QueryParam creates a query parameter
-
-func QueryParam(name string) *Parameter {
-
- return &Parameter{ParamProps: ParamProps{Name: name, In: "query"}}
-
-}
-
-// HeaderParam creates a header parameter, this is always required by default
-
-func HeaderParam(name string) *Parameter {
-
- return &Parameter{ParamProps: ParamProps{Name: name, In: "header", Required: true}}
-
-}
-
-// PathParam creates a path parameter, this is always required
-
-func PathParam(name string) *Parameter {
-
- return &Parameter{ParamProps: ParamProps{Name: name, In: "path", Required: true}}
-
-}
-
-// BodyParam creates a body parameter
-
-func BodyParam(name string, schema *Schema) *Parameter {
-
- return &Parameter{ParamProps: ParamProps{Name: name, In: "body", Schema: schema}}
-
-}
-
-// FormDataParam creates a body parameter
-
-func FormDataParam(name string) *Parameter {
-
- return &Parameter{ParamProps: ParamProps{Name: name, In: "formData"}}
-
-}
-
-// FileParam creates a body parameter
-
-func FileParam(name string) *Parameter {
-
- return &Parameter{ParamProps: ParamProps{Name: name, In: "formData"},
-
- SimpleSchema: SimpleSchema{Type: "file"}}
-
-}
-
-// SimpleArrayParam creates a param for a simple array (string, int, date etc)
-
-func SimpleArrayParam(name, tpe, fmt string) *Parameter {
-
- return &Parameter{ParamProps: ParamProps{Name: name},
-
- SimpleSchema: SimpleSchema{Type: jsonArray, CollectionFormat: "csv",
-
- Items: &Items{SimpleSchema: SimpleSchema{Type: tpe, Format: fmt}}}}
-
-}
-
-// ParamRef creates a parameter that's a json reference
-
-func ParamRef(uri string) *Parameter {
-
- p := new(Parameter)
-
- p.Ref = MustCreateRef(uri)
-
- return p
-
-}
-
-// ParamProps describes the specific attributes of an operation parameter
-
-//
-
-// NOTE:
-
-// - Schema is defined when "in" == "body": see validate
-
-// - AllowEmptyValue is allowed where "in" == "query" || "formData"
-
-type ParamProps struct {
- Description string `json:"description,omitempty"`
-
- Name string `json:"name,omitempty"`
-
- In string `json:"in,omitempty"`
-
- Required bool `json:"required,omitempty"`
-
- Schema *Schema `json:"schema,omitempty"`
-
- AllowEmptyValue bool `json:"allowEmptyValue,omitempty"`
-}
-
-// Parameter a unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn).
-
-//
-
-// There are five possible parameter types.
-
-// - Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part
-
-// of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`,
-
-// the path parameter is `itemId`.
-
-// - Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`.
-
-// - Header - Custom headers that are expected as part of the request.
-
-// - Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be
-
-// _one_ body parameter. The name of the body parameter has no effect on the parameter itself and is used for
-
-// documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist
-
-// together for the same operation.
-
-// - Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded` or
-
-// `multipart/form-data` are used as the content type of the request (in Swagger's definition,
-
-// the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used
-
-// to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be
-
-// declared together with a body parameter for the same operation. Form parameters have a different format based on
-
-// the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4).
-
-// - `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload.
-
-// For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple
-
-// parameters that are being transferred.
-
-// - `multipart/form-data` - each parameter takes a section in the payload with an internal header.
-
-// For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is
-
-// `submit-name`. This type of form parameters is more commonly used for file transfers.
-
-//
-
-// For more information: http://goo.gl/8us55a#parameterObject
-
-type Parameter struct {
- Refable
-
- CommonValidations
-
- SimpleSchema
-
- VendorExtensible
-
- ParamProps
-}
-
-// JSONLookup look up a value by the json property name
-
-func (p Parameter) JSONLookup(token string) (interface{}, error) {
-
- if ex, ok := p.Extensions[token]; ok {
-
- return &ex, nil
-
- }
-
- if token == jsonRef {
-
- return &p.Ref, nil
-
- }
-
- r, _, err := jsonpointer.GetForToken(p.CommonValidations, token)
-
- if err != nil && !strings.HasPrefix(err.Error(), "object has no field") {
-
- return nil, err
-
- }
-
- if r != nil {
-
- return r, nil
-
- }
-
- r, _, err = jsonpointer.GetForToken(p.SimpleSchema, token)
-
- if err != nil && !strings.HasPrefix(err.Error(), "object has no field") {
-
- return nil, err
-
- }
-
- if r != nil {
-
- return r, nil
-
- }
-
- r, _, err = jsonpointer.GetForToken(p.ParamProps, token)
-
- return r, err
-
-}
-
-// WithDescription a fluent builder method for the description of the parameter
-
-func (p *Parameter) WithDescription(description string) *Parameter {
-
- p.Description = description
-
- return p
-
-}
-
-// Named a fluent builder method to override the name of the parameter
-
-func (p *Parameter) Named(name string) *Parameter {
-
- p.Name = name
-
- return p
-
-}
-
-// WithLocation a fluent builder method to override the location of the parameter
-
-func (p *Parameter) WithLocation(in string) *Parameter {
-
- p.In = in
-
- return p
-
-}
-
-// Typed a fluent builder method for the type of the parameter value
-
-func (p *Parameter) Typed(tpe, format string) *Parameter {
-
- p.Type = tpe
-
- p.Format = format
-
- return p
-
-}
-
-// CollectionOf a fluent builder method for an array parameter
-
-func (p *Parameter) CollectionOf(items *Items, format string) *Parameter {
-
- p.Type = jsonArray
-
- p.Items = items
-
- p.CollectionFormat = format
-
- return p
-
-}
-
-// WithDefault sets the default value on this parameter
-
-func (p *Parameter) WithDefault(defaultValue interface{}) *Parameter {
-
- p.AsOptional() // with default implies optional
-
- p.Default = defaultValue
-
- return p
-
-}
-
-// AllowsEmptyValues flags this parameter as being ok with empty values
-
-func (p *Parameter) AllowsEmptyValues() *Parameter {
-
- p.AllowEmptyValue = true
-
- return p
-
-}
-
-// NoEmptyValues flags this parameter as not liking empty values
-
-func (p *Parameter) NoEmptyValues() *Parameter {
-
- p.AllowEmptyValue = false
-
- return p
-
-}
-
-// AsOptional flags this parameter as optional
-
-func (p *Parameter) AsOptional() *Parameter {
-
- p.Required = false
-
- return p
-
-}
-
-// AsRequired flags this parameter as required
-
-func (p *Parameter) AsRequired() *Parameter {
-
- if p.Default != nil { // with a default required makes no sense
-
- return p
-
- }
-
- p.Required = true
-
- return p
-
-}
-
-// WithMaxLength sets a max length value
-
-func (p *Parameter) WithMaxLength(max int64) *Parameter {
-
- p.MaxLength = &max
-
- return p
-
-}
-
-// WithMinLength sets a min length value
-
-func (p *Parameter) WithMinLength(min int64) *Parameter {
-
- p.MinLength = &min
-
- return p
-
-}
-
-// WithPattern sets a pattern value
-
-func (p *Parameter) WithPattern(pattern string) *Parameter {
-
- p.Pattern = pattern
-
- return p
-
-}
-
-// WithMultipleOf sets a multiple of value
-
-func (p *Parameter) WithMultipleOf(number float64) *Parameter {
-
- p.MultipleOf = &number
-
- return p
-
-}
-
-// WithMaximum sets a maximum number value
-
-func (p *Parameter) WithMaximum(max float64, exclusive bool) *Parameter {
-
- p.Maximum = &max
-
- p.ExclusiveMaximum = exclusive
-
- return p
-
-}
-
-// WithMinimum sets a minimum number value
-
-func (p *Parameter) WithMinimum(min float64, exclusive bool) *Parameter {
-
- p.Minimum = &min
-
- p.ExclusiveMinimum = exclusive
-
- return p
-
-}
-
-// WithEnum sets a the enum values (replace)
-
-func (p *Parameter) WithEnum(values ...interface{}) *Parameter {
-
- p.Enum = append([]interface{}{}, values...)
-
- return p
-
-}
-
-// WithMaxItems sets the max items
-
-func (p *Parameter) WithMaxItems(size int64) *Parameter {
-
- p.MaxItems = &size
-
- return p
-
-}
-
-// WithMinItems sets the min items
-
-func (p *Parameter) WithMinItems(size int64) *Parameter {
-
- p.MinItems = &size
-
- return p
-
-}
-
-// UniqueValues dictates that this array can only have unique items
-
-func (p *Parameter) UniqueValues() *Parameter {
-
- p.UniqueItems = true
-
- return p
-
-}
-
-// AllowDuplicates this array can have duplicates
-
-func (p *Parameter) AllowDuplicates() *Parameter {
-
- p.UniqueItems = false
-
- return p
-
-}
-
-// WithValidations is a fluent method to set parameter validations
-
-func (p *Parameter) WithValidations(val CommonValidations) *Parameter {
-
- p.SetValidations(SchemaValidations{CommonValidations: val})
-
- return p
-
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-
-func (p *Parameter) UnmarshalJSON(data []byte) error {
-
- if err := json.Unmarshal(data, &p.CommonValidations); err != nil {
-
- return err
-
- }
-
- if err := json.Unmarshal(data, &p.Refable); err != nil {
-
- return err
-
- }
-
- if err := json.Unmarshal(data, &p.SimpleSchema); err != nil {
-
- return err
-
- }
-
- if err := json.Unmarshal(data, &p.VendorExtensible); err != nil {
-
- return err
-
- }
-
- return json.Unmarshal(data, &p.ParamProps)
-
-}
-
-// MarshalJSON converts this items object to JSON
-
-func (p Parameter) MarshalJSON() ([]byte, error) {
-
- b1, err := json.Marshal(p.CommonValidations)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b2, err := json.Marshal(p.SimpleSchema)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b3, err := json.Marshal(p.Refable)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b4, err := json.Marshal(p.VendorExtensible)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b5, err := json.Marshal(p.ParamProps)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return swag.ConcatJSON(b3, b1, b2, b4, b5), nil
-
-}
diff --git a/vendor/github.com/go-openapi/spec/path_item.go b/vendor/github.com/go-openapi/spec/path_item.go
deleted file mode 100644
index 7b4de15..0000000
--- a/vendor/github.com/go-openapi/spec/path_item.go
+++ /dev/null
@@ -1,150 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-// PathItemProps the path item specific properties
-
-type PathItemProps struct {
- Get *Operation `json:"get,omitempty"`
-
- Put *Operation `json:"put,omitempty"`
-
- Post *Operation `json:"post,omitempty"`
-
- Delete *Operation `json:"delete,omitempty"`
-
- Options *Operation `json:"options,omitempty"`
-
- Head *Operation `json:"head,omitempty"`
-
- Patch *Operation `json:"patch,omitempty"`
-
- Parameters []Parameter `json:"parameters,omitempty"`
-}
-
-// PathItem describes the operations available on a single path.
-
-// A Path Item may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering).
-
-// The path itself is still exposed to the documentation viewer but they will
-
-// not know which operations and parameters are available.
-
-//
-
-// For more information: http://goo.gl/8us55a#pathItemObject
-
-type PathItem struct {
- Refable
-
- VendorExtensible
-
- PathItemProps
-}
-
-// JSONLookup look up a value by the json property name
-
-func (p PathItem) JSONLookup(token string) (interface{}, error) {
-
- if ex, ok := p.Extensions[token]; ok {
-
- return &ex, nil
-
- }
-
- if token == jsonRef {
-
- return &p.Ref, nil
-
- }
-
- r, _, err := jsonpointer.GetForToken(p.PathItemProps, token)
-
- return r, err
-
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-
-func (p *PathItem) UnmarshalJSON(data []byte) error {
-
- if err := json.Unmarshal(data, &p.Refable); err != nil {
-
- return err
-
- }
-
- if err := json.Unmarshal(data, &p.VendorExtensible); err != nil {
-
- return err
-
- }
-
- return json.Unmarshal(data, &p.PathItemProps)
-
-}
-
-// MarshalJSON converts this items object to JSON
-
-func (p PathItem) MarshalJSON() ([]byte, error) {
-
- b3, err := json.Marshal(p.Refable)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b4, err := json.Marshal(p.VendorExtensible)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b5, err := json.Marshal(p.PathItemProps)
-
- if err != nil {
-
- return nil, err
-
- }
-
- concated := swag.ConcatJSON(b3, b4, b5)
-
- return concated, nil
-
-}
diff --git a/vendor/github.com/go-openapi/spec/paths.go b/vendor/github.com/go-openapi/spec/paths.go
deleted file mode 100644
index c578502..0000000
--- a/vendor/github.com/go-openapi/spec/paths.go
+++ /dev/null
@@ -1,172 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
- "fmt"
- "strings"
-
- "github.com/go-openapi/swag"
-)
-
-// Paths holds the relative paths to the individual endpoints.
-
-// The path is appended to the [`basePath`](http://goo.gl/8us55a#swaggerBasePath) in order
-
-// to construct the full URL.
-
-// The Paths may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering).
-
-//
-
-// For more information: http://goo.gl/8us55a#pathsObject
-
-type Paths struct {
- VendorExtensible
-
- Paths map[string]PathItem `json:"-"` // custom serializer to flatten this, each entry must start with "/"
-
-}
-
-// JSONLookup look up a value by the json property name
-
-func (p Paths) JSONLookup(token string) (interface{}, error) {
-
- if pi, ok := p.Paths[token]; ok {
-
- return &pi, nil
-
- }
-
- if ex, ok := p.Extensions[token]; ok {
-
- return &ex, nil
-
- }
-
- return nil, fmt.Errorf("object has no field %q", token)
-
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-
-func (p *Paths) UnmarshalJSON(data []byte) error {
-
- var res map[string]json.RawMessage
-
- if err := json.Unmarshal(data, &res); err != nil {
-
- return err
-
- }
-
- for k, v := range res {
-
- if strings.HasPrefix(strings.ToLower(k), "x-") {
-
- if p.Extensions == nil {
-
- p.Extensions = make(map[string]interface{})
-
- }
-
- var d interface{}
-
- if err := json.Unmarshal(v, &d); err != nil {
-
- return err
-
- }
-
- p.Extensions[k] = d
-
- }
-
- if strings.HasPrefix(k, "/") {
-
- if p.Paths == nil {
-
- p.Paths = make(map[string]PathItem)
-
- }
-
- var pi PathItem
-
- if err := json.Unmarshal(v, &pi); err != nil {
-
- return err
-
- }
-
- p.Paths[k] = pi
-
- }
-
- }
-
- return nil
-
-}
-
-// MarshalJSON converts this items object to JSON
-
-func (p Paths) MarshalJSON() ([]byte, error) {
-
- b1, err := json.Marshal(p.VendorExtensible)
-
- if err != nil {
-
- return nil, err
-
- }
-
- pths := make(map[string]PathItem)
-
- for k, v := range p.Paths {
-
- if strings.HasPrefix(k, "/") {
-
- pths[k] = v
-
- }
-
- }
-
- b2, err := json.Marshal(pths)
-
- if err != nil {
-
- return nil, err
-
- }
-
- concated := swag.ConcatJSON(b1, b2)
-
- return concated, nil
-
-}
diff --git a/vendor/github.com/go-openapi/spec/properties.go b/vendor/github.com/go-openapi/spec/properties.go
deleted file mode 100644
index c7844e1..0000000
--- a/vendor/github.com/go-openapi/spec/properties.go
+++ /dev/null
@@ -1,157 +0,0 @@
-package spec
-
-import (
- "bytes"
- "encoding/json"
- "reflect"
- "sort"
-)
-
-// OrderSchemaItem holds a named schema (e.g. from a property of an object)
-
-type OrderSchemaItem struct {
- Name string
-
- Schema
-}
-
-// OrderSchemaItems is a sortable slice of named schemas.
-
-// The ordering is defined by the x-order schema extension.
-
-type OrderSchemaItems []OrderSchemaItem
-
-// MarshalJSON produces a json object with keys defined by the name schemas
-
-// of the OrderSchemaItems slice, keeping the original order of the slice.
-
-func (items OrderSchemaItems) MarshalJSON() ([]byte, error) {
-
- buf := bytes.NewBuffer(nil)
-
- buf.WriteString("{")
-
- for i := range items {
-
- if i > 0 {
-
- buf.WriteString(",")
-
- }
-
- buf.WriteString("\"")
-
- buf.WriteString(items[i].Name)
-
- buf.WriteString("\":")
-
- bs, err := json.Marshal(&items[i].Schema)
-
- if err != nil {
-
- return nil, err
-
- }
-
- buf.Write(bs)
-
- }
-
- buf.WriteString("}")
-
- return buf.Bytes(), nil
-
-}
-
-func (items OrderSchemaItems) Len() int { return len(items) }
-
-func (items OrderSchemaItems) Swap(i, j int) { items[i], items[j] = items[j], items[i] }
-
-func (items OrderSchemaItems) Less(i, j int) (ret bool) {
-
- ii, oki := items[i].Extensions.GetInt("x-order")
-
- ij, okj := items[j].Extensions.GetInt("x-order")
-
- if oki {
-
- if okj {
-
- defer func() {
-
- if err := recover(); err != nil {
-
- defer func() {
-
- if err = recover(); err != nil {
-
- ret = items[i].Name < items[j].Name
-
- }
-
- }()
-
- ret = reflect.ValueOf(ii).String() < reflect.ValueOf(ij).String()
-
- }
-
- }()
-
- return ii < ij
-
- }
-
- return true
-
- } else if okj {
-
- return false
-
- }
-
- return items[i].Name < items[j].Name
-
-}
-
-// SchemaProperties is a map representing the properties of a Schema object.
-
-// It knows how to transform its keys into an ordered slice.
-
-type SchemaProperties map[string]Schema
-
-// ToOrderedSchemaItems transforms the map of properties into a sortable slice
-
-func (properties SchemaProperties) ToOrderedSchemaItems() OrderSchemaItems {
-
- items := make(OrderSchemaItems, 0, len(properties))
-
- for k, v := range properties {
-
- items = append(items, OrderSchemaItem{
-
- Name: k,
-
- Schema: v,
- })
-
- }
-
- sort.Sort(items)
-
- return items
-
-}
-
-// MarshalJSON produces properties as json, keeping their order.
-
-func (properties SchemaProperties) MarshalJSON() ([]byte, error) {
-
- if properties == nil {
-
- return []byte("null"), nil
-
- }
-
- return json.Marshal(properties.ToOrderedSchemaItems())
-
-}
diff --git a/vendor/github.com/go-openapi/spec/ref.go b/vendor/github.com/go-openapi/spec/ref.go
deleted file mode 100644
index 552f909..0000000
--- a/vendor/github.com/go-openapi/spec/ref.go
+++ /dev/null
@@ -1,320 +0,0 @@
-// 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 spec
-
-import (
- "bytes"
- "encoding/gob"
- "encoding/json"
- "net/http"
- "os"
- "path/filepath"
-
- "github.com/go-openapi/jsonreference"
-)
-
-// Refable is a struct for things that accept a $ref property
-
-type Refable struct {
- Ref Ref
-}
-
-// MarshalJSON marshals the ref to json
-
-func (r Refable) MarshalJSON() ([]byte, error) {
-
- return r.Ref.MarshalJSON()
-
-}
-
-// UnmarshalJSON unmarshalss the ref from json
-
-func (r *Refable) UnmarshalJSON(d []byte) error {
-
- return json.Unmarshal(d, &r.Ref)
-
-}
-
-// Ref represents a json reference that is potentially resolved
-
-type Ref struct {
- jsonreference.Ref
-}
-
-// RemoteURI gets the remote uri part of the ref
-
-func (r *Ref) RemoteURI() string {
-
- if r.String() == "" {
-
- return ""
-
- }
-
- u := *r.GetURL()
-
- u.Fragment = ""
-
- return u.String()
-
-}
-
-// IsValidURI returns true when the url the ref points to can be found
-
-func (r *Ref) IsValidURI(basepaths ...string) bool {
-
- if r.String() == "" {
-
- return true
-
- }
-
- v := r.RemoteURI()
-
- if v == "" {
-
- return true
-
- }
-
- if r.HasFullURL {
-
- //nolint:noctx,gosec
-
- rr, err := http.Get(v)
-
- if err != nil {
-
- return false
-
- }
-
- defer rr.Body.Close()
-
- return rr.StatusCode/100 == 2
-
- }
-
- if !(r.HasFileScheme || r.HasFullFilePath || r.HasURLPathOnly) {
-
- return false
-
- }
-
- // check for local file
-
- pth := v
-
- if r.HasURLPathOnly {
-
- base := "."
-
- if len(basepaths) > 0 {
-
- base = filepath.Dir(filepath.Join(basepaths...))
-
- }
-
- p, e := filepath.Abs(filepath.ToSlash(filepath.Join(base, pth)))
-
- if e != nil {
-
- return false
-
- }
-
- pth = p
-
- }
-
- fi, err := os.Stat(filepath.ToSlash(pth))
-
- if err != nil {
-
- return false
-
- }
-
- return !fi.IsDir()
-
-}
-
-// Inherits creates a new reference from a parent and a child
-
-// If the child cannot inherit from the parent, an error is returned
-
-func (r *Ref) Inherits(child Ref) (*Ref, error) {
-
- ref, err := r.Ref.Inherits(child.Ref)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return &Ref{Ref: *ref}, nil
-
-}
-
-// NewRef creates a new instance of a ref object
-
-// returns an error when the reference uri is an invalid uri
-
-func NewRef(refURI string) (Ref, error) {
-
- ref, err := jsonreference.New(refURI)
-
- if err != nil {
-
- return Ref{}, err
-
- }
-
- return Ref{Ref: ref}, nil
-
-}
-
-// MustCreateRef creates a ref object but panics when refURI is invalid.
-
-// Use the NewRef method for a version that returns an error.
-
-func MustCreateRef(refURI string) Ref {
-
- return Ref{Ref: jsonreference.MustCreateRef(refURI)}
-
-}
-
-// MarshalJSON marshals this ref into a JSON object
-
-func (r Ref) MarshalJSON() ([]byte, error) {
-
- str := r.String()
-
- if str == "" {
-
- if r.IsRoot() {
-
- return []byte(`{"$ref":""}`), nil
-
- }
-
- return []byte("{}"), nil
-
- }
-
- v := map[string]interface{}{"$ref": str}
-
- return json.Marshal(v)
-
-}
-
-// UnmarshalJSON unmarshals this ref from a JSON object
-
-func (r *Ref) UnmarshalJSON(d []byte) error {
-
- var v map[string]interface{}
-
- if err := json.Unmarshal(d, &v); err != nil {
-
- return err
-
- }
-
- return r.fromMap(v)
-
-}
-
-// GobEncode provides a safe gob encoder for Ref
-
-func (r Ref) GobEncode() ([]byte, error) {
-
- var b bytes.Buffer
-
- raw, err := r.MarshalJSON()
-
- if err != nil {
-
- return nil, err
-
- }
-
- err = gob.NewEncoder(&b).Encode(raw)
-
- return b.Bytes(), err
-
-}
-
-// GobDecode provides a safe gob decoder for Ref
-
-func (r *Ref) GobDecode(b []byte) error {
-
- var raw []byte
-
- buf := bytes.NewBuffer(b)
-
- err := gob.NewDecoder(buf).Decode(&raw)
-
- if err != nil {
-
- return err
-
- }
-
- return json.Unmarshal(raw, r)
-
-}
-
-func (r *Ref) fromMap(v map[string]interface{}) error {
-
- if v == nil {
-
- return nil
-
- }
-
- if vv, ok := v["$ref"]; ok {
-
- if str, ok := vv.(string); ok {
-
- ref, err := jsonreference.New(str)
-
- if err != nil {
-
- return err
-
- }
-
- *r = Ref{Ref: ref}
-
- }
-
- }
-
- return nil
-
-}
diff --git a/vendor/github.com/go-openapi/spec/resolver.go b/vendor/github.com/go-openapi/spec/resolver.go
deleted file mode 100644
index 1c0c95e..0000000
--- a/vendor/github.com/go-openapi/spec/resolver.go
+++ /dev/null
@@ -1,199 +0,0 @@
-package spec
-
-import (
- "fmt"
-
- "github.com/go-openapi/swag"
-)
-
-func resolveAnyWithBase(root interface{}, ref *Ref, result interface{}, options *ExpandOptions) error {
-
- options = optionsOrDefault(options)
-
- resolver := defaultSchemaLoader(root, options, nil, nil)
-
- if err := resolver.Resolve(ref, result, options.RelativeBase); err != nil {
-
- return err
-
- }
-
- return nil
-
-}
-
-// ResolveRefWithBase resolves a reference against a context root with preservation of base path
-
-func ResolveRefWithBase(root interface{}, ref *Ref, options *ExpandOptions) (*Schema, error) {
-
- result := new(Schema)
-
- if err := resolveAnyWithBase(root, ref, result, options); err != nil {
-
- return nil, err
-
- }
-
- return result, nil
-
-}
-
-// ResolveRef resolves a reference for a schema against a context root
-
-// ref is guaranteed to be in root (no need to go to external files)
-
-//
-
-// ResolveRef is ONLY called from the code generation module
-
-func ResolveRef(root interface{}, ref *Ref) (*Schema, error) {
-
- res, _, err := ref.GetPointer().Get(root)
-
- if err != nil {
-
- return nil, err
-
- }
-
- switch sch := res.(type) {
-
- case Schema:
-
- return &sch, nil
-
- case *Schema:
-
- return sch, nil
-
- case map[string]interface{}:
-
- newSch := new(Schema)
-
- if err = swag.DynamicJSONToStruct(sch, newSch); err != nil {
-
- return nil, err
-
- }
-
- return newSch, nil
-
- default:
-
- return nil, fmt.Errorf("type: %T: %w", sch, ErrUnknownTypeForReference)
-
- }
-
-}
-
-// ResolveParameterWithBase resolves a parameter reference against a context root and base path
-
-func ResolveParameterWithBase(root interface{}, ref Ref, options *ExpandOptions) (*Parameter, error) {
-
- result := new(Parameter)
-
- if err := resolveAnyWithBase(root, &ref, result, options); err != nil {
-
- return nil, err
-
- }
-
- return result, nil
-
-}
-
-// ResolveParameter resolves a parameter reference against a context root
-
-func ResolveParameter(root interface{}, ref Ref) (*Parameter, error) {
-
- return ResolveParameterWithBase(root, ref, nil)
-
-}
-
-// ResolveResponseWithBase resolves response a reference against a context root and base path
-
-func ResolveResponseWithBase(root interface{}, ref Ref, options *ExpandOptions) (*Response, error) {
-
- result := new(Response)
-
- err := resolveAnyWithBase(root, &ref, result, options)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return result, nil
-
-}
-
-// ResolveResponse resolves response a reference against a context root
-
-func ResolveResponse(root interface{}, ref Ref) (*Response, error) {
-
- return ResolveResponseWithBase(root, ref, nil)
-
-}
-
-// ResolvePathItemWithBase resolves response a path item against a context root and base path
-
-func ResolvePathItemWithBase(root interface{}, ref Ref, options *ExpandOptions) (*PathItem, error) {
-
- result := new(PathItem)
-
- if err := resolveAnyWithBase(root, &ref, result, options); err != nil {
-
- return nil, err
-
- }
-
- return result, nil
-
-}
-
-// ResolvePathItem resolves response a path item against a context root and base path
-
-//
-
-// Deprecated: use ResolvePathItemWithBase instead
-
-func ResolvePathItem(root interface{}, ref Ref, options *ExpandOptions) (*PathItem, error) {
-
- return ResolvePathItemWithBase(root, ref, options)
-
-}
-
-// ResolveItemsWithBase resolves parameter items reference against a context root and base path.
-
-//
-
-// NOTE: stricly speaking, this construct is not supported by Swagger 2.0.
-
-// Similarly, $ref are forbidden in response headers.
-
-func ResolveItemsWithBase(root interface{}, ref Ref, options *ExpandOptions) (*Items, error) {
-
- result := new(Items)
-
- if err := resolveAnyWithBase(root, &ref, result, options); err != nil {
-
- return nil, err
-
- }
-
- return result, nil
-
-}
-
-// ResolveItems resolves parameter items reference against a context root and base path.
-
-//
-
-// Deprecated: use ResolveItemsWithBase instead
-
-func ResolveItems(root interface{}, ref Ref, options *ExpandOptions) (*Items, error) {
-
- return ResolveItemsWithBase(root, ref, options)
-
-}
diff --git a/vendor/github.com/go-openapi/spec/response.go b/vendor/github.com/go-openapi/spec/response.go
deleted file mode 100644
index 06ee52d..0000000
--- a/vendor/github.com/go-openapi/spec/response.go
+++ /dev/null
@@ -1,257 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-// ResponseProps properties specific to a response
-
-type ResponseProps struct {
- Description string `json:"description"`
-
- Schema *Schema `json:"schema,omitempty"`
-
- Headers map[string]Header `json:"headers,omitempty"`
-
- Examples map[string]interface{} `json:"examples,omitempty"`
-}
-
-// Response describes a single response from an API Operation.
-
-//
-
-// For more information: http://goo.gl/8us55a#responseObject
-
-type Response struct {
- Refable
-
- ResponseProps
-
- VendorExtensible
-}
-
-// JSONLookup look up a value by the json property name
-
-func (r Response) JSONLookup(token string) (interface{}, error) {
-
- if ex, ok := r.Extensions[token]; ok {
-
- return &ex, nil
-
- }
-
- if token == "$ref" {
-
- return &r.Ref, nil
-
- }
-
- ptr, _, err := jsonpointer.GetForToken(r.ResponseProps, token)
-
- return ptr, err
-
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-
-func (r *Response) UnmarshalJSON(data []byte) error {
-
- if err := json.Unmarshal(data, &r.ResponseProps); err != nil {
-
- return err
-
- }
-
- if err := json.Unmarshal(data, &r.Refable); err != nil {
-
- return err
-
- }
-
- return json.Unmarshal(data, &r.VendorExtensible)
-
-}
-
-// MarshalJSON converts this items object to JSON
-
-func (r Response) MarshalJSON() ([]byte, error) {
-
- var (
- b1 []byte
-
- err error
- )
-
- if r.Ref.String() == "" {
-
- // when there is no $ref, empty description is rendered as an empty string
-
- b1, err = json.Marshal(r.ResponseProps)
-
- } else {
-
- // when there is $ref inside the schema, description should be omitempty-ied
-
- b1, err = json.Marshal(struct {
- Description string `json:"description,omitempty"`
-
- Schema *Schema `json:"schema,omitempty"`
-
- Headers map[string]Header `json:"headers,omitempty"`
-
- Examples map[string]interface{} `json:"examples,omitempty"`
- }{
-
- Description: r.ResponseProps.Description,
-
- Schema: r.ResponseProps.Schema,
-
- Examples: r.ResponseProps.Examples,
- })
-
- }
-
- if err != nil {
-
- return nil, err
-
- }
-
- b2, err := json.Marshal(r.Refable)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b3, err := json.Marshal(r.VendorExtensible)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return swag.ConcatJSON(b1, b2, b3), nil
-
-}
-
-// NewResponse creates a new response instance
-
-func NewResponse() *Response {
-
- return new(Response)
-
-}
-
-// ResponseRef creates a response as a json reference
-
-func ResponseRef(url string) *Response {
-
- resp := NewResponse()
-
- resp.Ref = MustCreateRef(url)
-
- return resp
-
-}
-
-// WithDescription sets the description on this response, allows for chaining
-
-func (r *Response) WithDescription(description string) *Response {
-
- r.Description = description
-
- return r
-
-}
-
-// WithSchema sets the schema on this response, allows for chaining.
-
-// Passing a nil argument removes the schema from this response
-
-func (r *Response) WithSchema(schema *Schema) *Response {
-
- r.Schema = schema
-
- return r
-
-}
-
-// AddHeader adds a header to this response
-
-func (r *Response) AddHeader(name string, header *Header) *Response {
-
- if header == nil {
-
- return r.RemoveHeader(name)
-
- }
-
- if r.Headers == nil {
-
- r.Headers = make(map[string]Header)
-
- }
-
- r.Headers[name] = *header
-
- return r
-
-}
-
-// RemoveHeader removes a header from this response
-
-func (r *Response) RemoveHeader(name string) *Response {
-
- delete(r.Headers, name)
-
- return r
-
-}
-
-// AddExample adds an example to this response
-
-func (r *Response) AddExample(mediaType string, example interface{}) *Response {
-
- if r.Examples == nil {
-
- r.Examples = make(map[string]interface{})
-
- }
-
- r.Examples[mediaType] = example
-
- return r
-
-}
diff --git a/vendor/github.com/go-openapi/spec/responses.go b/vendor/github.com/go-openapi/spec/responses.go
deleted file mode 100644
index fd71940..0000000
--- a/vendor/github.com/go-openapi/spec/responses.go
+++ /dev/null
@@ -1,245 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
- "fmt"
- "reflect"
- "strconv"
- "strings"
-
- "github.com/go-openapi/swag"
-)
-
-// Responses is a container for the expected responses of an operation.
-
-// The container maps a HTTP response code to the expected response.
-
-// It is not expected from the documentation to necessarily cover all possible HTTP response codes,
-
-// since they may not be known in advance. However, it is expected from the documentation to cover
-
-// a successful operation response and any known errors.
-
-//
-
-// The `default` can be used a default response object for all HTTP codes that are not covered
-
-// individually by the specification.
-
-//
-
-// The `Responses Object` MUST contain at least one response code, and it SHOULD be the response
-
-// for a successful operation call.
-
-//
-
-// For more information: http://goo.gl/8us55a#responsesObject
-
-type Responses struct {
- VendorExtensible
-
- ResponsesProps
-}
-
-// JSONLookup implements an interface to customize json pointer lookup
-
-func (r Responses) JSONLookup(token string) (interface{}, error) {
-
- if token == "default" {
-
- return r.Default, nil
-
- }
-
- if ex, ok := r.Extensions[token]; ok {
-
- return &ex, nil
-
- }
-
- if i, err := strconv.Atoi(token); err == nil {
-
- if scr, ok := r.StatusCodeResponses[i]; ok {
-
- return scr, nil
-
- }
-
- }
-
- return nil, fmt.Errorf("object has no field %q", token)
-
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-
-func (r *Responses) UnmarshalJSON(data []byte) error {
-
- if err := json.Unmarshal(data, &r.ResponsesProps); err != nil {
-
- return err
-
- }
-
- if err := json.Unmarshal(data, &r.VendorExtensible); err != nil {
-
- return err
-
- }
-
- if reflect.DeepEqual(ResponsesProps{}, r.ResponsesProps) {
-
- r.ResponsesProps = ResponsesProps{}
-
- }
-
- return nil
-
-}
-
-// MarshalJSON converts this items object to JSON
-
-func (r Responses) MarshalJSON() ([]byte, error) {
-
- b1, err := json.Marshal(r.ResponsesProps)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b2, err := json.Marshal(r.VendorExtensible)
-
- if err != nil {
-
- return nil, err
-
- }
-
- concated := swag.ConcatJSON(b1, b2)
-
- return concated, nil
-
-}
-
-// ResponsesProps describes all responses for an operation.
-
-// It tells what is the default response and maps all responses with a
-
-// HTTP status code.
-
-type ResponsesProps struct {
- Default *Response
-
- StatusCodeResponses map[int]Response
-}
-
-// MarshalJSON marshals responses as JSON
-
-func (r ResponsesProps) MarshalJSON() ([]byte, error) {
-
- toser := map[string]Response{}
-
- if r.Default != nil {
-
- toser["default"] = *r.Default
-
- }
-
- for k, v := range r.StatusCodeResponses {
-
- toser[strconv.Itoa(k)] = v
-
- }
-
- return json.Marshal(toser)
-
-}
-
-// UnmarshalJSON unmarshals responses from JSON
-
-func (r *ResponsesProps) UnmarshalJSON(data []byte) error {
-
- var res map[string]json.RawMessage
-
- if err := json.Unmarshal(data, &res); err != nil {
-
- return err
-
- }
-
- if v, ok := res["default"]; ok {
-
- var defaultRes Response
-
- if err := json.Unmarshal(v, &defaultRes); err != nil {
-
- return err
-
- }
-
- r.Default = &defaultRes
-
- delete(res, "default")
-
- }
-
- for k, v := range res {
-
- if !strings.HasPrefix(k, "x-") {
-
- var statusCodeResp Response
-
- if err := json.Unmarshal(v, &statusCodeResp); err != nil {
-
- return err
-
- }
-
- if nk, err := strconv.Atoi(k); err == nil {
-
- if r.StatusCodeResponses == nil {
-
- r.StatusCodeResponses = map[int]Response{}
-
- }
-
- r.StatusCodeResponses[nk] = statusCodeResp
-
- }
-
- }
-
- }
-
- return nil
-
-}
diff --git a/vendor/github.com/go-openapi/spec/schema.go b/vendor/github.com/go-openapi/spec/schema.go
deleted file mode 100644
index 4bcf7a2..0000000
--- a/vendor/github.com/go-openapi/spec/schema.go
+++ /dev/null
@@ -1,1105 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
- "fmt"
- "strings"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-// BooleanProperty creates a boolean property
-
-func BooleanProperty() *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Type: []string{"boolean"}}}
-
-}
-
-// BoolProperty creates a boolean property
-
-func BoolProperty() *Schema { return BooleanProperty() }
-
-// StringProperty creates a string property
-
-func StringProperty() *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}}}
-
-}
-
-// CharProperty creates a string property
-
-func CharProperty() *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}}}
-
-}
-
-// Float64Property creates a float64/double property
-
-func Float64Property() *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Type: []string{"number"}, Format: "double"}}
-
-}
-
-// Float32Property creates a float32/float property
-
-func Float32Property() *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Type: []string{"number"}, Format: "float"}}
-
-}
-
-// Int8Property creates an int8 property
-
-func Int8Property() *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int8"}}
-
-}
-
-// Int16Property creates an int16 property
-
-func Int16Property() *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int16"}}
-
-}
-
-// Int32Property creates an int32 property
-
-func Int32Property() *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int32"}}
-
-}
-
-// Int64Property creates an int64 property
-
-func Int64Property() *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int64"}}
-
-}
-
-// StrFmtProperty creates a property for the named string format
-
-func StrFmtProperty(format string) *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: format}}
-
-}
-
-// DateProperty creates a date property
-
-func DateProperty() *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: "date"}}
-
-}
-
-// DateTimeProperty creates a date time property
-
-func DateTimeProperty() *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: "date-time"}}
-
-}
-
-// MapProperty creates a map property
-
-func MapProperty(property *Schema) *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Type: []string{"object"},
-
- AdditionalProperties: &SchemaOrBool{Allows: true, Schema: property}}}
-
-}
-
-// RefProperty creates a ref property
-
-func RefProperty(name string) *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Ref: MustCreateRef(name)}}
-
-}
-
-// RefSchema creates a ref property
-
-func RefSchema(name string) *Schema {
-
- return &Schema{SchemaProps: SchemaProps{Ref: MustCreateRef(name)}}
-
-}
-
-// ArrayProperty creates an array property
-
-func ArrayProperty(items *Schema) *Schema {
-
- if items == nil {
-
- return &Schema{SchemaProps: SchemaProps{Type: []string{"array"}}}
-
- }
-
- return &Schema{SchemaProps: SchemaProps{Items: &SchemaOrArray{Schema: items}, Type: []string{"array"}}}
-
-}
-
-// ComposedSchema creates a schema with allOf
-
-func ComposedSchema(schemas ...Schema) *Schema {
-
- s := new(Schema)
-
- s.AllOf = schemas
-
- return s
-
-}
-
-// SchemaURL represents a schema url
-
-type SchemaURL string
-
-// MarshalJSON marshal this to JSON
-
-func (r SchemaURL) MarshalJSON() ([]byte, error) {
-
- if r == "" {
-
- return []byte("{}"), nil
-
- }
-
- v := map[string]interface{}{"$schema": string(r)}
-
- return json.Marshal(v)
-
-}
-
-// UnmarshalJSON unmarshal this from JSON
-
-func (r *SchemaURL) UnmarshalJSON(data []byte) error {
-
- var v map[string]interface{}
-
- if err := json.Unmarshal(data, &v); err != nil {
-
- return err
-
- }
-
- return r.fromMap(v)
-
-}
-
-func (r *SchemaURL) fromMap(v map[string]interface{}) error {
-
- if v == nil {
-
- return nil
-
- }
-
- if vv, ok := v["$schema"]; ok {
-
- if str, ok := vv.(string); ok {
-
- u, err := parseURL(str)
-
- if err != nil {
-
- return err
-
- }
-
- *r = SchemaURL(u.String())
-
- }
-
- }
-
- return nil
-
-}
-
-// SchemaProps describes a JSON schema (draft 4)
-
-type SchemaProps struct {
- ID string `json:"id,omitempty"`
-
- Ref Ref `json:"-"`
-
- Schema SchemaURL `json:"-"`
-
- Description string `json:"description,omitempty"`
-
- Type StringOrArray `json:"type,omitempty"`
-
- Nullable bool `json:"nullable,omitempty"`
-
- Format string `json:"format,omitempty"`
-
- Title string `json:"title,omitempty"`
-
- Default interface{} `json:"default,omitempty"`
-
- Maximum *float64 `json:"maximum,omitempty"`
-
- ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"`
-
- Minimum *float64 `json:"minimum,omitempty"`
-
- ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"`
-
- MaxLength *int64 `json:"maxLength,omitempty"`
-
- MinLength *int64 `json:"minLength,omitempty"`
-
- Pattern string `json:"pattern,omitempty"`
-
- MaxItems *int64 `json:"maxItems,omitempty"`
-
- MinItems *int64 `json:"minItems,omitempty"`
-
- UniqueItems bool `json:"uniqueItems,omitempty"`
-
- MultipleOf *float64 `json:"multipleOf,omitempty"`
-
- Enum []interface{} `json:"enum,omitempty"`
-
- MaxProperties *int64 `json:"maxProperties,omitempty"`
-
- MinProperties *int64 `json:"minProperties,omitempty"`
-
- Required []string `json:"required,omitempty"`
-
- Items *SchemaOrArray `json:"items,omitempty"`
-
- AllOf []Schema `json:"allOf,omitempty"`
-
- OneOf []Schema `json:"oneOf,omitempty"`
-
- AnyOf []Schema `json:"anyOf,omitempty"`
-
- Not *Schema `json:"not,omitempty"`
-
- Properties SchemaProperties `json:"properties,omitempty"`
-
- AdditionalProperties *SchemaOrBool `json:"additionalProperties,omitempty"`
-
- PatternProperties SchemaProperties `json:"patternProperties,omitempty"`
-
- Dependencies Dependencies `json:"dependencies,omitempty"`
-
- AdditionalItems *SchemaOrBool `json:"additionalItems,omitempty"`
-
- Definitions Definitions `json:"definitions,omitempty"`
-}
-
-// SwaggerSchemaProps are additional properties supported by swagger schemas, but not JSON-schema (draft 4)
-
-type SwaggerSchemaProps struct {
- Discriminator string `json:"discriminator,omitempty"`
-
- ReadOnly bool `json:"readOnly,omitempty"`
-
- XML *XMLObject `json:"xml,omitempty"`
-
- ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
-
- Example interface{} `json:"example,omitempty"`
-}
-
-// Schema the schema object allows the definition of input and output data types.
-
-// These types can be objects, but also primitives and arrays.
-
-// This object is based on the [JSON Schema Specification Draft 4](http://json-schema.org/)
-
-// and uses a predefined subset of it.
-
-// On top of this subset, there are extensions provided by this specification to allow for more complete documentation.
-
-//
-
-// For more information: http://goo.gl/8us55a#schemaObject
-
-type Schema struct {
- VendorExtensible
-
- SchemaProps
-
- SwaggerSchemaProps
-
- ExtraProps map[string]interface{} `json:"-"`
-}
-
-// JSONLookup implements an interface to customize json pointer lookup
-
-func (s Schema) JSONLookup(token string) (interface{}, error) {
-
- if ex, ok := s.Extensions[token]; ok {
-
- return &ex, nil
-
- }
-
- if ex, ok := s.ExtraProps[token]; ok {
-
- return &ex, nil
-
- }
-
- r, _, err := jsonpointer.GetForToken(s.SchemaProps, token)
-
- if r != nil || (err != nil && !strings.HasPrefix(err.Error(), "object has no field")) {
-
- return r, err
-
- }
-
- r, _, err = jsonpointer.GetForToken(s.SwaggerSchemaProps, token)
-
- return r, err
-
-}
-
-// WithID sets the id for this schema, allows for chaining
-
-func (s *Schema) WithID(id string) *Schema {
-
- s.ID = id
-
- return s
-
-}
-
-// WithTitle sets the title for this schema, allows for chaining
-
-func (s *Schema) WithTitle(title string) *Schema {
-
- s.Title = title
-
- return s
-
-}
-
-// WithDescription sets the description for this schema, allows for chaining
-
-func (s *Schema) WithDescription(description string) *Schema {
-
- s.Description = description
-
- return s
-
-}
-
-// WithProperties sets the properties for this schema
-
-func (s *Schema) WithProperties(schemas map[string]Schema) *Schema {
-
- s.Properties = schemas
-
- return s
-
-}
-
-// SetProperty sets a property on this schema
-
-func (s *Schema) SetProperty(name string, schema Schema) *Schema {
-
- if s.Properties == nil {
-
- s.Properties = make(map[string]Schema)
-
- }
-
- s.Properties[name] = schema
-
- return s
-
-}
-
-// WithAllOf sets the all of property
-
-func (s *Schema) WithAllOf(schemas ...Schema) *Schema {
-
- s.AllOf = schemas
-
- return s
-
-}
-
-// WithMaxProperties sets the max number of properties an object can have
-
-func (s *Schema) WithMaxProperties(max int64) *Schema {
-
- s.MaxProperties = &max
-
- return s
-
-}
-
-// WithMinProperties sets the min number of properties an object must have
-
-func (s *Schema) WithMinProperties(min int64) *Schema {
-
- s.MinProperties = &min
-
- return s
-
-}
-
-// Typed sets the type of this schema for a single value item
-
-func (s *Schema) Typed(tpe, format string) *Schema {
-
- s.Type = []string{tpe}
-
- s.Format = format
-
- return s
-
-}
-
-// AddType adds a type with potential format to the types for this schema
-
-func (s *Schema) AddType(tpe, format string) *Schema {
-
- s.Type = append(s.Type, tpe)
-
- if format != "" {
-
- s.Format = format
-
- }
-
- return s
-
-}
-
-// AsNullable flags this schema as nullable.
-
-func (s *Schema) AsNullable() *Schema {
-
- s.Nullable = true
-
- return s
-
-}
-
-// CollectionOf a fluent builder method for an array parameter
-
-func (s *Schema) CollectionOf(items Schema) *Schema {
-
- s.Type = []string{jsonArray}
-
- s.Items = &SchemaOrArray{Schema: &items}
-
- return s
-
-}
-
-// WithDefault sets the default value on this parameter
-
-func (s *Schema) WithDefault(defaultValue interface{}) *Schema {
-
- s.Default = defaultValue
-
- return s
-
-}
-
-// WithRequired flags this parameter as required
-
-func (s *Schema) WithRequired(items ...string) *Schema {
-
- s.Required = items
-
- return s
-
-}
-
-// AddRequired adds field names to the required properties array
-
-func (s *Schema) AddRequired(items ...string) *Schema {
-
- s.Required = append(s.Required, items...)
-
- return s
-
-}
-
-// WithMaxLength sets a max length value
-
-func (s *Schema) WithMaxLength(max int64) *Schema {
-
- s.MaxLength = &max
-
- return s
-
-}
-
-// WithMinLength sets a min length value
-
-func (s *Schema) WithMinLength(min int64) *Schema {
-
- s.MinLength = &min
-
- return s
-
-}
-
-// WithPattern sets a pattern value
-
-func (s *Schema) WithPattern(pattern string) *Schema {
-
- s.Pattern = pattern
-
- return s
-
-}
-
-// WithMultipleOf sets a multiple of value
-
-func (s *Schema) WithMultipleOf(number float64) *Schema {
-
- s.MultipleOf = &number
-
- return s
-
-}
-
-// WithMaximum sets a maximum number value
-
-func (s *Schema) WithMaximum(max float64, exclusive bool) *Schema {
-
- s.Maximum = &max
-
- s.ExclusiveMaximum = exclusive
-
- return s
-
-}
-
-// WithMinimum sets a minimum number value
-
-func (s *Schema) WithMinimum(min float64, exclusive bool) *Schema {
-
- s.Minimum = &min
-
- s.ExclusiveMinimum = exclusive
-
- return s
-
-}
-
-// WithEnum sets a the enum values (replace)
-
-func (s *Schema) WithEnum(values ...interface{}) *Schema {
-
- s.Enum = append([]interface{}{}, values...)
-
- return s
-
-}
-
-// WithMaxItems sets the max items
-
-func (s *Schema) WithMaxItems(size int64) *Schema {
-
- s.MaxItems = &size
-
- return s
-
-}
-
-// WithMinItems sets the min items
-
-func (s *Schema) WithMinItems(size int64) *Schema {
-
- s.MinItems = &size
-
- return s
-
-}
-
-// UniqueValues dictates that this array can only have unique items
-
-func (s *Schema) UniqueValues() *Schema {
-
- s.UniqueItems = true
-
- return s
-
-}
-
-// AllowDuplicates this array can have duplicates
-
-func (s *Schema) AllowDuplicates() *Schema {
-
- s.UniqueItems = false
-
- return s
-
-}
-
-// AddToAllOf adds a schema to the allOf property
-
-func (s *Schema) AddToAllOf(schemas ...Schema) *Schema {
-
- s.AllOf = append(s.AllOf, schemas...)
-
- return s
-
-}
-
-// WithDiscriminator sets the name of the discriminator field
-
-func (s *Schema) WithDiscriminator(discriminator string) *Schema {
-
- s.Discriminator = discriminator
-
- return s
-
-}
-
-// AsReadOnly flags this schema as readonly
-
-func (s *Schema) AsReadOnly() *Schema {
-
- s.ReadOnly = true
-
- return s
-
-}
-
-// AsWritable flags this schema as writeable (not read-only)
-
-func (s *Schema) AsWritable() *Schema {
-
- s.ReadOnly = false
-
- return s
-
-}
-
-// WithExample sets the example for this schema
-
-func (s *Schema) WithExample(example interface{}) *Schema {
-
- s.Example = example
-
- return s
-
-}
-
-// WithExternalDocs sets/removes the external docs for/from this schema.
-
-// When you pass empty strings as params the external documents will be removed.
-
-// When you pass non-empty string as one value then those values will be used on the external docs object.
-
-// So when you pass a non-empty description, you should also pass the url and vice versa.
-
-func (s *Schema) WithExternalDocs(description, url string) *Schema {
-
- if description == "" && url == "" {
-
- s.ExternalDocs = nil
-
- return s
-
- }
-
- if s.ExternalDocs == nil {
-
- s.ExternalDocs = &ExternalDocumentation{}
-
- }
-
- s.ExternalDocs.Description = description
-
- s.ExternalDocs.URL = url
-
- return s
-
-}
-
-// WithXMLName sets the xml name for the object
-
-func (s *Schema) WithXMLName(name string) *Schema {
-
- if s.XML == nil {
-
- s.XML = new(XMLObject)
-
- }
-
- s.XML.Name = name
-
- return s
-
-}
-
-// WithXMLNamespace sets the xml namespace for the object
-
-func (s *Schema) WithXMLNamespace(namespace string) *Schema {
-
- if s.XML == nil {
-
- s.XML = new(XMLObject)
-
- }
-
- s.XML.Namespace = namespace
-
- return s
-
-}
-
-// WithXMLPrefix sets the xml prefix for the object
-
-func (s *Schema) WithXMLPrefix(prefix string) *Schema {
-
- if s.XML == nil {
-
- s.XML = new(XMLObject)
-
- }
-
- s.XML.Prefix = prefix
-
- return s
-
-}
-
-// AsXMLAttribute flags this object as xml attribute
-
-func (s *Schema) AsXMLAttribute() *Schema {
-
- if s.XML == nil {
-
- s.XML = new(XMLObject)
-
- }
-
- s.XML.Attribute = true
-
- return s
-
-}
-
-// AsXMLElement flags this object as an xml node
-
-func (s *Schema) AsXMLElement() *Schema {
-
- if s.XML == nil {
-
- s.XML = new(XMLObject)
-
- }
-
- s.XML.Attribute = false
-
- return s
-
-}
-
-// AsWrappedXML flags this object as wrapped, this is mostly useful for array types
-
-func (s *Schema) AsWrappedXML() *Schema {
-
- if s.XML == nil {
-
- s.XML = new(XMLObject)
-
- }
-
- s.XML.Wrapped = true
-
- return s
-
-}
-
-// AsUnwrappedXML flags this object as an xml node
-
-func (s *Schema) AsUnwrappedXML() *Schema {
-
- if s.XML == nil {
-
- s.XML = new(XMLObject)
-
- }
-
- s.XML.Wrapped = false
-
- return s
-
-}
-
-// SetValidations defines all schema validations.
-
-//
-
-// NOTE: Required, ReadOnly, AllOf, AnyOf, OneOf and Not are not considered.
-
-func (s *Schema) SetValidations(val SchemaValidations) {
-
- s.Maximum = val.Maximum
-
- s.ExclusiveMaximum = val.ExclusiveMaximum
-
- s.Minimum = val.Minimum
-
- s.ExclusiveMinimum = val.ExclusiveMinimum
-
- s.MaxLength = val.MaxLength
-
- s.MinLength = val.MinLength
-
- s.Pattern = val.Pattern
-
- s.MaxItems = val.MaxItems
-
- s.MinItems = val.MinItems
-
- s.UniqueItems = val.UniqueItems
-
- s.MultipleOf = val.MultipleOf
-
- s.Enum = val.Enum
-
- s.MinProperties = val.MinProperties
-
- s.MaxProperties = val.MaxProperties
-
- s.PatternProperties = val.PatternProperties
-
-}
-
-// WithValidations is a fluent method to set schema validations
-
-func (s *Schema) WithValidations(val SchemaValidations) *Schema {
-
- s.SetValidations(val)
-
- return s
-
-}
-
-// Validations returns a clone of the validations for this schema
-
-func (s Schema) Validations() SchemaValidations {
-
- return SchemaValidations{
-
- CommonValidations: CommonValidations{
-
- Maximum: s.Maximum,
-
- ExclusiveMaximum: s.ExclusiveMaximum,
-
- Minimum: s.Minimum,
-
- ExclusiveMinimum: s.ExclusiveMinimum,
-
- MaxLength: s.MaxLength,
-
- MinLength: s.MinLength,
-
- Pattern: s.Pattern,
-
- MaxItems: s.MaxItems,
-
- MinItems: s.MinItems,
-
- UniqueItems: s.UniqueItems,
-
- MultipleOf: s.MultipleOf,
-
- Enum: s.Enum,
- },
-
- MinProperties: s.MinProperties,
-
- MaxProperties: s.MaxProperties,
-
- PatternProperties: s.PatternProperties,
- }
-
-}
-
-// MarshalJSON marshal this to JSON
-
-func (s Schema) MarshalJSON() ([]byte, error) {
-
- b1, err := json.Marshal(s.SchemaProps)
-
- if err != nil {
-
- return nil, fmt.Errorf("schema props %v", err)
-
- }
-
- b2, err := json.Marshal(s.VendorExtensible)
-
- if err != nil {
-
- return nil, fmt.Errorf("vendor props %v", err)
-
- }
-
- b3, err := s.Ref.MarshalJSON()
-
- if err != nil {
-
- return nil, fmt.Errorf("ref prop %v", err)
-
- }
-
- b4, err := s.Schema.MarshalJSON()
-
- if err != nil {
-
- return nil, fmt.Errorf("schema prop %v", err)
-
- }
-
- b5, err := json.Marshal(s.SwaggerSchemaProps)
-
- if err != nil {
-
- return nil, fmt.Errorf("common validations %v", err)
-
- }
-
- var b6 []byte
-
- if s.ExtraProps != nil {
-
- jj, err := json.Marshal(s.ExtraProps)
-
- if err != nil {
-
- return nil, fmt.Errorf("extra props %v", err)
-
- }
-
- b6 = jj
-
- }
-
- return swag.ConcatJSON(b1, b2, b3, b4, b5, b6), nil
-
-}
-
-// UnmarshalJSON marshal this from JSON
-
-func (s *Schema) UnmarshalJSON(data []byte) error {
-
- props := struct {
- SchemaProps
-
- SwaggerSchemaProps
- }{}
-
- if err := json.Unmarshal(data, &props); err != nil {
-
- return err
-
- }
-
- sch := Schema{
-
- SchemaProps: props.SchemaProps,
-
- SwaggerSchemaProps: props.SwaggerSchemaProps,
- }
-
- var d map[string]interface{}
-
- if err := json.Unmarshal(data, &d); err != nil {
-
- return err
-
- }
-
- _ = sch.Ref.fromMap(d)
-
- _ = sch.Schema.fromMap(d)
-
- delete(d, "$ref")
-
- delete(d, "$schema")
-
- for _, pn := range swag.DefaultJSONNameProvider.GetJSONNames(s) {
-
- delete(d, pn)
-
- }
-
- for k, vv := range d {
-
- lk := strings.ToLower(k)
-
- if strings.HasPrefix(lk, "x-") {
-
- if sch.Extensions == nil {
-
- sch.Extensions = map[string]interface{}{}
-
- }
-
- sch.Extensions[k] = vv
-
- continue
-
- }
-
- if sch.ExtraProps == nil {
-
- sch.ExtraProps = map[string]interface{}{}
-
- }
-
- sch.ExtraProps[k] = vv
-
- }
-
- *s = sch
-
- return nil
-
-}
diff --git a/vendor/github.com/go-openapi/spec/schema_loader.go b/vendor/github.com/go-openapi/spec/schema_loader.go
deleted file mode 100644
index e655e24..0000000
--- a/vendor/github.com/go-openapi/spec/schema_loader.go
+++ /dev/null
@@ -1,543 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
- "fmt"
- "log"
- "net/url"
- "reflect"
- "strings"
-
- "github.com/go-openapi/swag"
-)
-
-// PathLoader is a function to use when loading remote refs.
-
-//
-
-// This is a package level default. It may be overridden or bypassed by
-
-// specifying the loader in ExpandOptions.
-
-//
-
-// NOTE: if you are using the go-openapi/loads package, it will override
-
-// this value with its own default (a loader to retrieve YAML documents as
-
-// well as JSON ones).
-
-var PathLoader = func(pth string) (json.RawMessage, error) {
-
- data, err := swag.LoadFromFileOrHTTP(pth)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return json.RawMessage(data), nil
-
-}
-
-// resolverContext allows to share a context during spec processing.
-
-// At the moment, it just holds the index of circular references found.
-
-type resolverContext struct {
-
- // circulars holds all visited circular references, to shortcircuit $ref resolution.
-
- //
-
- // This structure is privately instantiated and needs not be locked against
-
- // concurrent access, unless we chose to implement a parallel spec walking.
-
- circulars map[string]bool
-
- basePath string
-
- loadDoc func(string) (json.RawMessage, error)
-
- rootID string
-}
-
-func newResolverContext(options *ExpandOptions) *resolverContext {
-
- expandOptions := optionsOrDefault(options)
-
- // path loader may be overridden by options
-
- var loader func(string) (json.RawMessage, error)
-
- if expandOptions.PathLoader == nil {
-
- loader = PathLoader
-
- } else {
-
- loader = expandOptions.PathLoader
-
- }
-
- return &resolverContext{
-
- circulars: make(map[string]bool),
-
- basePath: expandOptions.RelativeBase, // keep the root base path in context
-
- loadDoc: loader,
- }
-
-}
-
-type schemaLoader struct {
- root interface{}
-
- options *ExpandOptions
-
- cache ResolutionCache
-
- context *resolverContext
-}
-
-func (r *schemaLoader) transitiveResolver(basePath string, ref Ref) *schemaLoader {
-
- if ref.IsRoot() || ref.HasFragmentOnly {
-
- return r
-
- }
-
- baseRef := MustCreateRef(basePath)
-
- currentRef := normalizeRef(&ref, basePath)
-
- if strings.HasPrefix(currentRef.String(), baseRef.String()) {
-
- return r
-
- }
-
- // set a new root against which to resolve
-
- rootURL := currentRef.GetURL()
-
- rootURL.Fragment = ""
-
- root, _ := r.cache.Get(rootURL.String())
-
- // shallow copy of resolver options to set a new RelativeBase when
-
- // traversing multiple documents
-
- newOptions := r.options
-
- newOptions.RelativeBase = rootURL.String()
-
- return defaultSchemaLoader(root, newOptions, r.cache, r.context)
-
-}
-
-func (r *schemaLoader) updateBasePath(transitive *schemaLoader, basePath string) string {
-
- if transitive != r {
-
- if transitive.options != nil && transitive.options.RelativeBase != "" {
-
- return normalizeBase(transitive.options.RelativeBase)
-
- }
-
- }
-
- return basePath
-
-}
-
-func (r *schemaLoader) resolveRef(ref *Ref, target interface{}, basePath string) error {
-
- tgt := reflect.ValueOf(target)
-
- if tgt.Kind() != reflect.Ptr {
-
- return ErrResolveRefNeedsAPointer
-
- }
-
- if ref.GetURL() == nil {
-
- return nil
-
- }
-
- var (
- res interface{}
-
- data interface{}
-
- err error
- )
-
- // Resolve against the root if it isn't nil, and if ref is pointing at the root, or has a fragment only which means
-
- // it is pointing somewhere in the root.
-
- root := r.root
-
- if (ref.IsRoot() || ref.HasFragmentOnly) && root == nil && basePath != "" {
-
- if baseRef, erb := NewRef(basePath); erb == nil {
-
- root, _, _, _ = r.load(baseRef.GetURL())
-
- }
-
- }
-
- if (ref.IsRoot() || ref.HasFragmentOnly) && root != nil {
-
- data = root
-
- } else {
-
- baseRef := normalizeRef(ref, basePath)
-
- data, _, _, err = r.load(baseRef.GetURL())
-
- if err != nil {
-
- return err
-
- }
-
- }
-
- res = data
-
- if ref.String() != "" {
-
- res, _, err = ref.GetPointer().Get(data)
-
- if err != nil {
-
- return err
-
- }
-
- }
-
- return swag.DynamicJSONToStruct(res, target)
-
-}
-
-func (r *schemaLoader) load(refURL *url.URL) (interface{}, url.URL, bool, error) {
-
- debugLog("loading schema from url: %s", refURL)
-
- toFetch := *refURL
-
- toFetch.Fragment = ""
-
- var err error
-
- pth := toFetch.String()
-
- normalized := normalizeBase(pth)
-
- debugLog("loading doc from: %s", normalized)
-
- data, fromCache := r.cache.Get(normalized)
-
- if fromCache {
-
- return data, toFetch, fromCache, nil
-
- }
-
- b, err := r.context.loadDoc(normalized)
-
- if err != nil {
-
- return nil, url.URL{}, false, err
-
- }
-
- var doc interface{}
-
- if err := json.Unmarshal(b, &doc); err != nil {
-
- return nil, url.URL{}, false, err
-
- }
-
- r.cache.Set(normalized, doc)
-
- return doc, toFetch, fromCache, nil
-
-}
-
-// isCircular detects cycles in sequences of $ref.
-
-//
-
-// It relies on a private context (which needs not be locked).
-
-func (r *schemaLoader) isCircular(ref *Ref, basePath string, parentRefs ...string) (foundCycle bool) {
-
- normalizedRef := normalizeURI(ref.String(), basePath)
-
- if _, ok := r.context.circulars[normalizedRef]; ok {
-
- // circular $ref has been already detected in another explored cycle
-
- foundCycle = true
-
- return
-
- }
-
- foundCycle = swag.ContainsStrings(parentRefs, normalizedRef) // normalized windows url's are lower cased
-
- if foundCycle {
-
- r.context.circulars[normalizedRef] = true
-
- }
-
- return
-
-}
-
-// Resolve resolves a reference against basePath and stores the result in target.
-
-//
-
-// Resolve is not in charge of following references: it only resolves ref by following its URL.
-
-//
-
-// If the schema the ref is referring to holds nested refs, Resolve doesn't resolve them.
-
-//
-
-// If basePath is an empty string, ref is resolved against the root schema stored in the schemaLoader struct
-
-func (r *schemaLoader) Resolve(ref *Ref, target interface{}, basePath string) error {
-
- return r.resolveRef(ref, target, basePath)
-
-}
-
-func (r *schemaLoader) deref(input interface{}, parentRefs []string, basePath string) error {
-
- var ref *Ref
-
- switch refable := input.(type) {
-
- case *Schema:
-
- ref = &refable.Ref
-
- case *Parameter:
-
- ref = &refable.Ref
-
- case *Response:
-
- ref = &refable.Ref
-
- case *PathItem:
-
- ref = &refable.Ref
-
- default:
-
- return fmt.Errorf("unsupported type: %T: %w", input, ErrDerefUnsupportedType)
-
- }
-
- curRef := ref.String()
-
- if curRef == "" {
-
- return nil
-
- }
-
- normalizedRef := normalizeRef(ref, basePath)
-
- normalizedBasePath := normalizedRef.RemoteURI()
-
- if r.isCircular(normalizedRef, basePath, parentRefs...) {
-
- return nil
-
- }
-
- if err := r.resolveRef(ref, input, basePath); r.shouldStopOnError(err) {
-
- return err
-
- }
-
- if ref.String() == "" || ref.String() == curRef {
-
- // done with rereferencing
-
- return nil
-
- }
-
- parentRefs = append(parentRefs, normalizedRef.String())
-
- return r.deref(input, parentRefs, normalizedBasePath)
-
-}
-
-func (r *schemaLoader) shouldStopOnError(err error) bool {
-
- if err != nil && !r.options.ContinueOnError {
-
- return true
-
- }
-
- if err != nil {
-
- log.Println(err)
-
- }
-
- return false
-
-}
-
-func (r *schemaLoader) setSchemaID(target interface{}, id, basePath string) (string, string) {
-
- debugLog("schema has ID: %s", id)
-
- // handling the case when id is a folder
-
- // remember that basePath has to point to a file
-
- var refPath string
-
- if strings.HasSuffix(id, "/") {
-
- // ensure this is detected as a file, not a folder
-
- refPath = fmt.Sprintf("%s%s", id, "placeholder.json")
-
- } else {
-
- refPath = id
-
- }
-
- // updates the current base path
-
- // * important: ID can be a relative path
-
- // * registers target to be fetchable from the new base proposed by this id
-
- newBasePath := normalizeURI(refPath, basePath)
-
- // store found IDs for possible future reuse in $ref
-
- r.cache.Set(newBasePath, target)
-
- // the root document has an ID: all $ref relative to that ID may
-
- // be rebased relative to the root document
-
- if basePath == r.context.basePath {
-
- debugLog("root document is a schema with ID: %s (normalized as:%s)", id, newBasePath)
-
- r.context.rootID = newBasePath
-
- }
-
- return newBasePath, refPath
-
-}
-
-func defaultSchemaLoader(
-
- root interface{},
-
- expandOptions *ExpandOptions,
-
- cache ResolutionCache,
-
- context *resolverContext) *schemaLoader {
-
- if expandOptions == nil {
-
- expandOptions = &ExpandOptions{}
-
- }
-
- cache = cacheOrDefault(cache)
-
- if expandOptions.RelativeBase == "" {
-
- // if no relative base is provided, assume the root document
-
- // contains all $ref, or at least, that the relative documents
-
- // may be resolved from the current working directory.
-
- expandOptions.RelativeBase = baseForRoot(root, cache)
-
- }
-
- debugLog("effective expander options: %#v", expandOptions)
-
- if context == nil {
-
- context = newResolverContext(expandOptions)
-
- }
-
- return &schemaLoader{
-
- root: root,
-
- options: expandOptions,
-
- cache: cache,
-
- context: context,
- }
-
-}
diff --git a/vendor/github.com/go-openapi/spec/schemas/jsonschema-draft-04.json b/vendor/github.com/go-openapi/spec/schemas/jsonschema-draft-04.json
deleted file mode 100644
index bcbb847..0000000
--- a/vendor/github.com/go-openapi/spec/schemas/jsonschema-draft-04.json
+++ /dev/null
@@ -1,149 +0,0 @@
-{
- "id": "http://json-schema.org/draft-04/schema#",
- "$schema": "http://json-schema.org/draft-04/schema#",
- "description": "Core schema meta-schema",
- "definitions": {
- "schemaArray": {
- "type": "array",
- "minItems": 1,
- "items": { "$ref": "#" }
- },
- "positiveInteger": {
- "type": "integer",
- "minimum": 0
- },
- "positiveIntegerDefault0": {
- "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
- },
- "simpleTypes": {
- "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
- },
- "stringArray": {
- "type": "array",
- "items": { "type": "string" },
- "minItems": 1,
- "uniqueItems": true
- }
- },
- "type": "object",
- "properties": {
- "id": {
- "type": "string"
- },
- "$schema": {
- "type": "string"
- },
- "title": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "default": {},
- "multipleOf": {
- "type": "number",
- "minimum": 0,
- "exclusiveMinimum": true
- },
- "maximum": {
- "type": "number"
- },
- "exclusiveMaximum": {
- "type": "boolean",
- "default": false
- },
- "minimum": {
- "type": "number"
- },
- "exclusiveMinimum": {
- "type": "boolean",
- "default": false
- },
- "maxLength": { "$ref": "#/definitions/positiveInteger" },
- "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
- "pattern": {
- "type": "string",
- "format": "regex"
- },
- "additionalItems": {
- "anyOf": [
- { "type": "boolean" },
- { "$ref": "#" }
- ],
- "default": {}
- },
- "items": {
- "anyOf": [
- { "$ref": "#" },
- { "$ref": "#/definitions/schemaArray" }
- ],
- "default": {}
- },
- "maxItems": { "$ref": "#/definitions/positiveInteger" },
- "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
- "uniqueItems": {
- "type": "boolean",
- "default": false
- },
- "maxProperties": { "$ref": "#/definitions/positiveInteger" },
- "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
- "required": { "$ref": "#/definitions/stringArray" },
- "additionalProperties": {
- "anyOf": [
- { "type": "boolean" },
- { "$ref": "#" }
- ],
- "default": {}
- },
- "definitions": {
- "type": "object",
- "additionalProperties": { "$ref": "#" },
- "default": {}
- },
- "properties": {
- "type": "object",
- "additionalProperties": { "$ref": "#" },
- "default": {}
- },
- "patternProperties": {
- "type": "object",
- "additionalProperties": { "$ref": "#" },
- "default": {}
- },
- "dependencies": {
- "type": "object",
- "additionalProperties": {
- "anyOf": [
- { "$ref": "#" },
- { "$ref": "#/definitions/stringArray" }
- ]
- }
- },
- "enum": {
- "type": "array",
- "minItems": 1,
- "uniqueItems": true
- },
- "type": {
- "anyOf": [
- { "$ref": "#/definitions/simpleTypes" },
- {
- "type": "array",
- "items": { "$ref": "#/definitions/simpleTypes" },
- "minItems": 1,
- "uniqueItems": true
- }
- ]
- },
- "format": { "type": "string" },
- "allOf": { "$ref": "#/definitions/schemaArray" },
- "anyOf": { "$ref": "#/definitions/schemaArray" },
- "oneOf": { "$ref": "#/definitions/schemaArray" },
- "not": { "$ref": "#" }
- },
- "dependencies": {
- "exclusiveMaximum": [ "maximum" ],
- "exclusiveMinimum": [ "minimum" ]
- },
- "default": {}
-}
diff --git a/vendor/github.com/go-openapi/spec/schemas/v2/schema.json b/vendor/github.com/go-openapi/spec/schemas/v2/schema.json
deleted file mode 100644
index ebe10ed..0000000
--- a/vendor/github.com/go-openapi/spec/schemas/v2/schema.json
+++ /dev/null
@@ -1,1607 +0,0 @@
-{
- "title": "A JSON Schema for Swagger 2.0 API.",
- "id": "http://swagger.io/v2/schema.json#",
- "$schema": "http://json-schema.org/draft-04/schema#",
- "type": "object",
- "required": [
- "swagger",
- "info",
- "paths"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "swagger": {
- "type": "string",
- "enum": [
- "2.0"
- ],
- "description": "The Swagger version of this document."
- },
- "info": {
- "$ref": "#/definitions/info"
- },
- "host": {
- "type": "string",
- "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$",
- "description": "The host (name or ip) of the API. Example: 'swagger.io'"
- },
- "basePath": {
- "type": "string",
- "pattern": "^/",
- "description": "The base path to the API. Example: '/api'."
- },
- "schemes": {
- "$ref": "#/definitions/schemesList"
- },
- "consumes": {
- "description": "A list of MIME types accepted by the API.",
- "allOf": [
- {
- "$ref": "#/definitions/mediaTypeList"
- }
- ]
- },
- "produces": {
- "description": "A list of MIME types the API can produce.",
- "allOf": [
- {
- "$ref": "#/definitions/mediaTypeList"
- }
- ]
- },
- "paths": {
- "$ref": "#/definitions/paths"
- },
- "definitions": {
- "$ref": "#/definitions/definitions"
- },
- "parameters": {
- "$ref": "#/definitions/parameterDefinitions"
- },
- "responses": {
- "$ref": "#/definitions/responseDefinitions"
- },
- "security": {
- "$ref": "#/definitions/security"
- },
- "securityDefinitions": {
- "$ref": "#/definitions/securityDefinitions"
- },
- "tags": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/tag"
- },
- "uniqueItems": true
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- }
- },
- "definitions": {
- "info": {
- "type": "object",
- "description": "General information about the API.",
- "required": [
- "version",
- "title"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "title": {
- "type": "string",
- "description": "A unique and precise title of the API."
- },
- "version": {
- "type": "string",
- "description": "A semantic version number of the API."
- },
- "description": {
- "type": "string",
- "description": "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed."
- },
- "termsOfService": {
- "type": "string",
- "description": "The terms of service for the API."
- },
- "contact": {
- "$ref": "#/definitions/contact"
- },
- "license": {
- "$ref": "#/definitions/license"
- }
- }
- },
- "contact": {
- "type": "object",
- "description": "Contact information for the owners of the API.",
- "additionalProperties": false,
- "properties": {
- "name": {
- "type": "string",
- "description": "The identifying name of the contact person/organization."
- },
- "url": {
- "type": "string",
- "description": "The URL pointing to the contact information.",
- "format": "uri"
- },
- "email": {
- "type": "string",
- "description": "The email address of the contact person/organization.",
- "format": "email"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "license": {
- "type": "object",
- "required": [
- "name"
- ],
- "additionalProperties": false,
- "properties": {
- "name": {
- "type": "string",
- "description": "The name of the license type. It's encouraged to use an OSI compatible license."
- },
- "url": {
- "type": "string",
- "description": "The URL pointing to the license.",
- "format": "uri"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "paths": {
- "type": "object",
- "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.",
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- },
- "^/": {
- "$ref": "#/definitions/pathItem"
- }
- },
- "additionalProperties": false
- },
- "definitions": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/schema"
- },
- "description": "One or more JSON objects describing the schemas being consumed and produced by the API."
- },
- "parameterDefinitions": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/parameter"
- },
- "description": "One or more JSON representations for parameters"
- },
- "responseDefinitions": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/response"
- },
- "description": "One or more JSON representations for responses"
- },
- "externalDocs": {
- "type": "object",
- "additionalProperties": false,
- "description": "information about external documentation",
- "required": [
- "url"
- ],
- "properties": {
- "description": {
- "type": "string"
- },
- "url": {
- "type": "string",
- "format": "uri"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "examples": {
- "type": "object",
- "additionalProperties": true
- },
- "mimeType": {
- "type": "string",
- "description": "The MIME type of the HTTP message."
- },
- "operation": {
- "type": "object",
- "required": [
- "responses"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "tags": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "uniqueItems": true
- },
- "summary": {
- "type": "string",
- "description": "A brief summary of the operation."
- },
- "description": {
- "type": "string",
- "description": "A longer description of the operation, GitHub Flavored Markdown is allowed."
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- },
- "operationId": {
- "type": "string",
- "description": "A unique identifier of the operation."
- },
- "produces": {
- "description": "A list of MIME types the API can produce.",
- "allOf": [
- {
- "$ref": "#/definitions/mediaTypeList"
- }
- ]
- },
- "consumes": {
- "description": "A list of MIME types the API can consume.",
- "allOf": [
- {
- "$ref": "#/definitions/mediaTypeList"
- }
- ]
- },
- "parameters": {
- "$ref": "#/definitions/parametersList"
- },
- "responses": {
- "$ref": "#/definitions/responses"
- },
- "schemes": {
- "$ref": "#/definitions/schemesList"
- },
- "deprecated": {
- "type": "boolean",
- "default": false
- },
- "security": {
- "$ref": "#/definitions/security"
- }
- }
- },
- "pathItem": {
- "type": "object",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "$ref": {
- "type": "string"
- },
- "get": {
- "$ref": "#/definitions/operation"
- },
- "put": {
- "$ref": "#/definitions/operation"
- },
- "post": {
- "$ref": "#/definitions/operation"
- },
- "delete": {
- "$ref": "#/definitions/operation"
- },
- "options": {
- "$ref": "#/definitions/operation"
- },
- "head": {
- "$ref": "#/definitions/operation"
- },
- "patch": {
- "$ref": "#/definitions/operation"
- },
- "parameters": {
- "$ref": "#/definitions/parametersList"
- }
- }
- },
- "responses": {
- "type": "object",
- "description": "Response objects names can either be any valid HTTP status code or 'default'.",
- "minProperties": 1,
- "additionalProperties": false,
- "patternProperties": {
- "^([0-9]{3})$|^(default)$": {
- "$ref": "#/definitions/responseValue"
- },
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "not": {
- "type": "object",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- }
- },
- "responseValue": {
- "oneOf": [
- {
- "$ref": "#/definitions/response"
- },
- {
- "$ref": "#/definitions/jsonReference"
- }
- ]
- },
- "response": {
- "type": "object",
- "required": [
- "description"
- ],
- "properties": {
- "description": {
- "type": "string"
- },
- "schema": {
- "oneOf": [
- {
- "$ref": "#/definitions/schema"
- },
- {
- "$ref": "#/definitions/fileSchema"
- }
- ]
- },
- "headers": {
- "$ref": "#/definitions/headers"
- },
- "examples": {
- "$ref": "#/definitions/examples"
- }
- },
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "headers": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/header"
- }
- },
- "header": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "type"
- ],
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "string",
- "number",
- "integer",
- "boolean",
- "array"
- ]
- },
- "format": {
- "type": "string"
- },
- "items": {
- "$ref": "#/definitions/primitivesItems"
- },
- "collectionFormat": {
- "$ref": "#/definitions/collectionFormat"
- },
- "default": {
- "$ref": "#/definitions/default"
- },
- "maximum": {
- "$ref": "#/definitions/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "#/definitions/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "#/definitions/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "#/definitions/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "#/definitions/maxLength"
- },
- "minLength": {
- "$ref": "#/definitions/minLength"
- },
- "pattern": {
- "$ref": "#/definitions/pattern"
- },
- "maxItems": {
- "$ref": "#/definitions/maxItems"
- },
- "minItems": {
- "$ref": "#/definitions/minItems"
- },
- "uniqueItems": {
- "$ref": "#/definitions/uniqueItems"
- },
- "enum": {
- "$ref": "#/definitions/enum"
- },
- "multipleOf": {
- "$ref": "#/definitions/multipleOf"
- },
- "description": {
- "type": "string"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "vendorExtension": {
- "description": "Any property starting with x- is valid.",
- "additionalProperties": true,
- "additionalItems": true
- },
- "bodyParameter": {
- "type": "object",
- "required": [
- "name",
- "in",
- "schema"
- ],
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "description": {
- "type": "string",
- "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
- },
- "name": {
- "type": "string",
- "description": "The name of the parameter."
- },
- "in": {
- "type": "string",
- "description": "Determines the location of the parameter.",
- "enum": [
- "body"
- ]
- },
- "required": {
- "type": "boolean",
- "description": "Determines whether or not this parameter is required or optional.",
- "default": false
- },
- "schema": {
- "$ref": "#/definitions/schema"
- }
- },
- "additionalProperties": false
- },
- "headerParameterSubSchema": {
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "required": {
- "type": "boolean",
- "description": "Determines whether or not this parameter is required or optional.",
- "default": false
- },
- "in": {
- "type": "string",
- "description": "Determines the location of the parameter.",
- "enum": [
- "header"
- ]
- },
- "description": {
- "type": "string",
- "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
- },
- "name": {
- "type": "string",
- "description": "The name of the parameter."
- },
- "type": {
- "type": "string",
- "enum": [
- "string",
- "number",
- "boolean",
- "integer",
- "array"
- ]
- },
- "format": {
- "type": "string"
- },
- "items": {
- "$ref": "#/definitions/primitivesItems"
- },
- "collectionFormat": {
- "$ref": "#/definitions/collectionFormat"
- },
- "default": {
- "$ref": "#/definitions/default"
- },
- "maximum": {
- "$ref": "#/definitions/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "#/definitions/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "#/definitions/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "#/definitions/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "#/definitions/maxLength"
- },
- "minLength": {
- "$ref": "#/definitions/minLength"
- },
- "pattern": {
- "$ref": "#/definitions/pattern"
- },
- "maxItems": {
- "$ref": "#/definitions/maxItems"
- },
- "minItems": {
- "$ref": "#/definitions/minItems"
- },
- "uniqueItems": {
- "$ref": "#/definitions/uniqueItems"
- },
- "enum": {
- "$ref": "#/definitions/enum"
- },
- "multipleOf": {
- "$ref": "#/definitions/multipleOf"
- }
- }
- },
- "queryParameterSubSchema": {
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "required": {
- "type": "boolean",
- "description": "Determines whether or not this parameter is required or optional.",
- "default": false
- },
- "in": {
- "type": "string",
- "description": "Determines the location of the parameter.",
- "enum": [
- "query"
- ]
- },
- "description": {
- "type": "string",
- "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
- },
- "name": {
- "type": "string",
- "description": "The name of the parameter."
- },
- "allowEmptyValue": {
- "type": "boolean",
- "default": false,
- "description": "allows sending a parameter by name only or with an empty value."
- },
- "type": {
- "type": "string",
- "enum": [
- "string",
- "number",
- "boolean",
- "integer",
- "array"
- ]
- },
- "format": {
- "type": "string"
- },
- "items": {
- "$ref": "#/definitions/primitivesItems"
- },
- "collectionFormat": {
- "$ref": "#/definitions/collectionFormatWithMulti"
- },
- "default": {
- "$ref": "#/definitions/default"
- },
- "maximum": {
- "$ref": "#/definitions/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "#/definitions/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "#/definitions/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "#/definitions/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "#/definitions/maxLength"
- },
- "minLength": {
- "$ref": "#/definitions/minLength"
- },
- "pattern": {
- "$ref": "#/definitions/pattern"
- },
- "maxItems": {
- "$ref": "#/definitions/maxItems"
- },
- "minItems": {
- "$ref": "#/definitions/minItems"
- },
- "uniqueItems": {
- "$ref": "#/definitions/uniqueItems"
- },
- "enum": {
- "$ref": "#/definitions/enum"
- },
- "multipleOf": {
- "$ref": "#/definitions/multipleOf"
- }
- }
- },
- "formDataParameterSubSchema": {
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "required": {
- "type": "boolean",
- "description": "Determines whether or not this parameter is required or optional.",
- "default": false
- },
- "in": {
- "type": "string",
- "description": "Determines the location of the parameter.",
- "enum": [
- "formData"
- ]
- },
- "description": {
- "type": "string",
- "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
- },
- "name": {
- "type": "string",
- "description": "The name of the parameter."
- },
- "allowEmptyValue": {
- "type": "boolean",
- "default": false,
- "description": "allows sending a parameter by name only or with an empty value."
- },
- "type": {
- "type": "string",
- "enum": [
- "string",
- "number",
- "boolean",
- "integer",
- "array",
- "file"
- ]
- },
- "format": {
- "type": "string"
- },
- "items": {
- "$ref": "#/definitions/primitivesItems"
- },
- "collectionFormat": {
- "$ref": "#/definitions/collectionFormatWithMulti"
- },
- "default": {
- "$ref": "#/definitions/default"
- },
- "maximum": {
- "$ref": "#/definitions/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "#/definitions/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "#/definitions/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "#/definitions/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "#/definitions/maxLength"
- },
- "minLength": {
- "$ref": "#/definitions/minLength"
- },
- "pattern": {
- "$ref": "#/definitions/pattern"
- },
- "maxItems": {
- "$ref": "#/definitions/maxItems"
- },
- "minItems": {
- "$ref": "#/definitions/minItems"
- },
- "uniqueItems": {
- "$ref": "#/definitions/uniqueItems"
- },
- "enum": {
- "$ref": "#/definitions/enum"
- },
- "multipleOf": {
- "$ref": "#/definitions/multipleOf"
- }
- }
- },
- "pathParameterSubSchema": {
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "required": [
- "required"
- ],
- "properties": {
- "required": {
- "type": "boolean",
- "enum": [
- true
- ],
- "description": "Determines whether or not this parameter is required or optional."
- },
- "in": {
- "type": "string",
- "description": "Determines the location of the parameter.",
- "enum": [
- "path"
- ]
- },
- "description": {
- "type": "string",
- "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
- },
- "name": {
- "type": "string",
- "description": "The name of the parameter."
- },
- "type": {
- "type": "string",
- "enum": [
- "string",
- "number",
- "boolean",
- "integer",
- "array"
- ]
- },
- "format": {
- "type": "string"
- },
- "items": {
- "$ref": "#/definitions/primitivesItems"
- },
- "collectionFormat": {
- "$ref": "#/definitions/collectionFormat"
- },
- "default": {
- "$ref": "#/definitions/default"
- },
- "maximum": {
- "$ref": "#/definitions/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "#/definitions/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "#/definitions/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "#/definitions/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "#/definitions/maxLength"
- },
- "minLength": {
- "$ref": "#/definitions/minLength"
- },
- "pattern": {
- "$ref": "#/definitions/pattern"
- },
- "maxItems": {
- "$ref": "#/definitions/maxItems"
- },
- "minItems": {
- "$ref": "#/definitions/minItems"
- },
- "uniqueItems": {
- "$ref": "#/definitions/uniqueItems"
- },
- "enum": {
- "$ref": "#/definitions/enum"
- },
- "multipleOf": {
- "$ref": "#/definitions/multipleOf"
- }
- }
- },
- "nonBodyParameter": {
- "type": "object",
- "required": [
- "name",
- "in",
- "type"
- ],
- "oneOf": [
- {
- "$ref": "#/definitions/headerParameterSubSchema"
- },
- {
- "$ref": "#/definitions/formDataParameterSubSchema"
- },
- {
- "$ref": "#/definitions/queryParameterSubSchema"
- },
- {
- "$ref": "#/definitions/pathParameterSubSchema"
- }
- ]
- },
- "parameter": {
- "oneOf": [
- {
- "$ref": "#/definitions/bodyParameter"
- },
- {
- "$ref": "#/definitions/nonBodyParameter"
- }
- ]
- },
- "schema": {
- "type": "object",
- "description": "A deterministic version of a JSON Schema object.",
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "$ref": {
- "type": "string"
- },
- "format": {
- "type": "string"
- },
- "title": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
- },
- "description": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
- },
- "default": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
- },
- "multipleOf": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
- },
- "maximum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
- },
- "minLength": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
- },
- "pattern": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
- },
- "maxItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
- },
- "minItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
- },
- "uniqueItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
- },
- "maxProperties": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
- },
- "minProperties": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
- },
- "required": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
- },
- "enum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
- },
- "additionalProperties": {
- "anyOf": [
- {
- "$ref": "#/definitions/schema"
- },
- {
- "type": "boolean"
- }
- ],
- "default": {}
- },
- "type": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/type"
- },
- "items": {
- "anyOf": [
- {
- "$ref": "#/definitions/schema"
- },
- {
- "type": "array",
- "minItems": 1,
- "items": {
- "$ref": "#/definitions/schema"
- }
- }
- ],
- "default": {}
- },
- "allOf": {
- "type": "array",
- "minItems": 1,
- "items": {
- "$ref": "#/definitions/schema"
- }
- },
- "properties": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/schema"
- },
- "default": {}
- },
- "discriminator": {
- "type": "string"
- },
- "readOnly": {
- "type": "boolean",
- "default": false
- },
- "xml": {
- "$ref": "#/definitions/xml"
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- },
- "example": {}
- },
- "additionalProperties": false
- },
- "fileSchema": {
- "type": "object",
- "description": "A deterministic version of a JSON Schema object.",
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "required": [
- "type"
- ],
- "properties": {
- "format": {
- "type": "string"
- },
- "title": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
- },
- "description": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
- },
- "default": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
- },
- "required": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
- },
- "type": {
- "type": "string",
- "enum": [
- "file"
- ]
- },
- "readOnly": {
- "type": "boolean",
- "default": false
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- },
- "example": {}
- },
- "additionalProperties": false
- },
- "primitivesItems": {
- "type": "object",
- "additionalProperties": false,
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "string",
- "number",
- "integer",
- "boolean",
- "array"
- ]
- },
- "format": {
- "type": "string"
- },
- "items": {
- "$ref": "#/definitions/primitivesItems"
- },
- "collectionFormat": {
- "$ref": "#/definitions/collectionFormat"
- },
- "default": {
- "$ref": "#/definitions/default"
- },
- "maximum": {
- "$ref": "#/definitions/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "#/definitions/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "#/definitions/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "#/definitions/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "#/definitions/maxLength"
- },
- "minLength": {
- "$ref": "#/definitions/minLength"
- },
- "pattern": {
- "$ref": "#/definitions/pattern"
- },
- "maxItems": {
- "$ref": "#/definitions/maxItems"
- },
- "minItems": {
- "$ref": "#/definitions/minItems"
- },
- "uniqueItems": {
- "$ref": "#/definitions/uniqueItems"
- },
- "enum": {
- "$ref": "#/definitions/enum"
- },
- "multipleOf": {
- "$ref": "#/definitions/multipleOf"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "security": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/securityRequirement"
- },
- "uniqueItems": true
- },
- "securityRequirement": {
- "type": "object",
- "additionalProperties": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "uniqueItems": true
- }
- },
- "xml": {
- "type": "object",
- "additionalProperties": false,
- "properties": {
- "name": {
- "type": "string"
- },
- "namespace": {
- "type": "string"
- },
- "prefix": {
- "type": "string"
- },
- "attribute": {
- "type": "boolean",
- "default": false
- },
- "wrapped": {
- "type": "boolean",
- "default": false
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "tag": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "name"
- ],
- "properties": {
- "name": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "securityDefinitions": {
- "type": "object",
- "additionalProperties": {
- "oneOf": [
- {
- "$ref": "#/definitions/basicAuthenticationSecurity"
- },
- {
- "$ref": "#/definitions/apiKeySecurity"
- },
- {
- "$ref": "#/definitions/oauth2ImplicitSecurity"
- },
- {
- "$ref": "#/definitions/oauth2PasswordSecurity"
- },
- {
- "$ref": "#/definitions/oauth2ApplicationSecurity"
- },
- {
- "$ref": "#/definitions/oauth2AccessCodeSecurity"
- }
- ]
- }
- },
- "basicAuthenticationSecurity": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "type"
- ],
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "basic"
- ]
- },
- "description": {
- "type": "string"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "apiKeySecurity": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "type",
- "name",
- "in"
- ],
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "apiKey"
- ]
- },
- "name": {
- "type": "string"
- },
- "in": {
- "type": "string",
- "enum": [
- "header",
- "query"
- ]
- },
- "description": {
- "type": "string"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "oauth2ImplicitSecurity": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "type",
- "flow",
- "authorizationUrl"
- ],
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "oauth2"
- ]
- },
- "flow": {
- "type": "string",
- "enum": [
- "implicit"
- ]
- },
- "scopes": {
- "$ref": "#/definitions/oauth2Scopes"
- },
- "authorizationUrl": {
- "type": "string",
- "format": "uri"
- },
- "description": {
- "type": "string"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "oauth2PasswordSecurity": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "type",
- "flow",
- "tokenUrl"
- ],
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "oauth2"
- ]
- },
- "flow": {
- "type": "string",
- "enum": [
- "password"
- ]
- },
- "scopes": {
- "$ref": "#/definitions/oauth2Scopes"
- },
- "tokenUrl": {
- "type": "string",
- "format": "uri"
- },
- "description": {
- "type": "string"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "oauth2ApplicationSecurity": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "type",
- "flow",
- "tokenUrl"
- ],
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "oauth2"
- ]
- },
- "flow": {
- "type": "string",
- "enum": [
- "application"
- ]
- },
- "scopes": {
- "$ref": "#/definitions/oauth2Scopes"
- },
- "tokenUrl": {
- "type": "string",
- "format": "uri"
- },
- "description": {
- "type": "string"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "oauth2AccessCodeSecurity": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "type",
- "flow",
- "authorizationUrl",
- "tokenUrl"
- ],
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "oauth2"
- ]
- },
- "flow": {
- "type": "string",
- "enum": [
- "accessCode"
- ]
- },
- "scopes": {
- "$ref": "#/definitions/oauth2Scopes"
- },
- "authorizationUrl": {
- "type": "string",
- "format": "uri"
- },
- "tokenUrl": {
- "type": "string",
- "format": "uri"
- },
- "description": {
- "type": "string"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "oauth2Scopes": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "mediaTypeList": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/mimeType"
- },
- "uniqueItems": true
- },
- "parametersList": {
- "type": "array",
- "description": "The parameters needed to send a valid API call.",
- "additionalItems": false,
- "items": {
- "oneOf": [
- {
- "$ref": "#/definitions/parameter"
- },
- {
- "$ref": "#/definitions/jsonReference"
- }
- ]
- },
- "uniqueItems": true
- },
- "schemesList": {
- "type": "array",
- "description": "The transfer protocol of the API.",
- "items": {
- "type": "string",
- "enum": [
- "http",
- "https",
- "ws",
- "wss"
- ]
- },
- "uniqueItems": true
- },
- "collectionFormat": {
- "type": "string",
- "enum": [
- "csv",
- "ssv",
- "tsv",
- "pipes"
- ],
- "default": "csv"
- },
- "collectionFormatWithMulti": {
- "type": "string",
- "enum": [
- "csv",
- "ssv",
- "tsv",
- "pipes",
- "multi"
- ],
- "default": "csv"
- },
- "title": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
- },
- "description": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
- },
- "default": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
- },
- "multipleOf": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
- },
- "maximum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
- },
- "minLength": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
- },
- "pattern": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
- },
- "maxItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
- },
- "minItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
- },
- "uniqueItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
- },
- "enum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
- },
- "jsonReference": {
- "type": "object",
- "required": [
- "$ref"
- ],
- "additionalProperties": false,
- "properties": {
- "$ref": {
- "type": "string"
- }
- }
- }
- }
-}
diff --git a/vendor/github.com/go-openapi/spec/security_scheme.go b/vendor/github.com/go-openapi/spec/security_scheme.go
deleted file mode 100644
index 32b6f1c..0000000
--- a/vendor/github.com/go-openapi/spec/security_scheme.go
+++ /dev/null
@@ -1,285 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-const (
- basic = "basic"
-
- apiKey = "apiKey"
-
- oauth2 = "oauth2"
-
- implicit = "implicit"
-
- password = "password"
-
- application = "application"
-
- accessCode = "accessCode"
-)
-
-// BasicAuth creates a basic auth security scheme
-
-func BasicAuth() *SecurityScheme {
-
- return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{Type: basic}}
-
-}
-
-// APIKeyAuth creates an api key auth security scheme
-
-func APIKeyAuth(fieldName, valueSource string) *SecurityScheme {
-
- return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{Type: apiKey, Name: fieldName, In: valueSource}}
-
-}
-
-// OAuth2Implicit creates an implicit flow oauth2 security scheme
-
-func OAuth2Implicit(authorizationURL string) *SecurityScheme {
-
- return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{
-
- Type: oauth2,
-
- Flow: implicit,
-
- AuthorizationURL: authorizationURL,
- }}
-
-}
-
-// OAuth2Password creates a password flow oauth2 security scheme
-
-func OAuth2Password(tokenURL string) *SecurityScheme {
-
- return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{
-
- Type: oauth2,
-
- Flow: password,
-
- TokenURL: tokenURL,
- }}
-
-}
-
-// OAuth2Application creates an application flow oauth2 security scheme
-
-func OAuth2Application(tokenURL string) *SecurityScheme {
-
- return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{
-
- Type: oauth2,
-
- Flow: application,
-
- TokenURL: tokenURL,
- }}
-
-}
-
-// OAuth2AccessToken creates an access token flow oauth2 security scheme
-
-func OAuth2AccessToken(authorizationURL, tokenURL string) *SecurityScheme {
-
- return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{
-
- Type: oauth2,
-
- Flow: accessCode,
-
- AuthorizationURL: authorizationURL,
-
- TokenURL: tokenURL,
- }}
-
-}
-
-// SecuritySchemeProps describes a swagger security scheme in the securityDefinitions section
-
-type SecuritySchemeProps struct {
- Description string `json:"description,omitempty"`
-
- Type string `json:"type"`
-
- Name string `json:"name,omitempty"` // api key
-
- In string `json:"in,omitempty"` // api key
-
- Flow string `json:"flow,omitempty"` // oauth2
-
- AuthorizationURL string `json:"authorizationUrl"` // oauth2
-
- TokenURL string `json:"tokenUrl,omitempty"` // oauth2
-
- Scopes map[string]string `json:"scopes,omitempty"` // oauth2
-
-}
-
-// AddScope adds a scope to this security scheme
-
-func (s *SecuritySchemeProps) AddScope(scope, description string) {
-
- if s.Scopes == nil {
-
- s.Scopes = make(map[string]string)
-
- }
-
- s.Scopes[scope] = description
-
-}
-
-// SecurityScheme allows the definition of a security scheme that can be used by the operations.
-
-// Supported schemes are basic authentication, an API key (either as a header or as a query parameter)
-
-// and OAuth2's common flows (implicit, password, application and access code).
-
-//
-
-// For more information: http://goo.gl/8us55a#securitySchemeObject
-
-type SecurityScheme struct {
- VendorExtensible
-
- SecuritySchemeProps
-}
-
-// JSONLookup implements an interface to customize json pointer lookup
-
-func (s SecurityScheme) JSONLookup(token string) (interface{}, error) {
-
- if ex, ok := s.Extensions[token]; ok {
-
- return &ex, nil
-
- }
-
- r, _, err := jsonpointer.GetForToken(s.SecuritySchemeProps, token)
-
- return r, err
-
-}
-
-// MarshalJSON marshal this to JSON
-
-func (s SecurityScheme) MarshalJSON() ([]byte, error) {
-
- var (
- b1 []byte
-
- err error
- )
-
- if s.Type == oauth2 && (s.Flow == "implicit" || s.Flow == "accessCode") {
-
- // when oauth2 for implicit or accessCode flows, empty AuthorizationURL is added as empty string
-
- b1, err = json.Marshal(s.SecuritySchemeProps)
-
- } else {
-
- // when not oauth2, empty AuthorizationURL should be omitted
-
- b1, err = json.Marshal(struct {
- Description string `json:"description,omitempty"`
-
- Type string `json:"type"`
-
- Name string `json:"name,omitempty"` // api key
-
- In string `json:"in,omitempty"` // api key
-
- Flow string `json:"flow,omitempty"` // oauth2
-
- AuthorizationURL string `json:"authorizationUrl,omitempty"` // oauth2
-
- TokenURL string `json:"tokenUrl,omitempty"` // oauth2
-
- Scopes map[string]string `json:"scopes,omitempty"` // oauth2
-
- }{
-
- Description: s.Description,
-
- Type: s.Type,
-
- Name: s.Name,
-
- In: s.In,
-
- Flow: s.Flow,
-
- AuthorizationURL: s.AuthorizationURL,
-
- TokenURL: s.TokenURL,
-
- Scopes: s.Scopes,
- })
-
- }
-
- if err != nil {
-
- return nil, err
-
- }
-
- b2, err := json.Marshal(s.VendorExtensible)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return swag.ConcatJSON(b1, b2), nil
-
-}
-
-// UnmarshalJSON marshal this from JSON
-
-func (s *SecurityScheme) UnmarshalJSON(data []byte) error {
-
- if err := json.Unmarshal(data, &s.SecuritySchemeProps); err != nil {
-
- return err
-
- }
-
- return json.Unmarshal(data, &s.VendorExtensible)
-
-}
diff --git a/vendor/github.com/go-openapi/spec/spec.go b/vendor/github.com/go-openapi/spec/spec.go
deleted file mode 100644
index 876aa12..0000000
--- a/vendor/github.com/go-openapi/spec/spec.go
+++ /dev/null
@@ -1,78 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
-)
-
-//go:generate curl -L --progress -o ./schemas/v2/schema.json http://swagger.io/v2/schema.json
-//go:generate curl -L --progress -o ./schemas/jsonschema-draft-04.json http://json-schema.org/draft-04/schema
-//go:generate go-bindata -pkg=spec -prefix=./schemas -ignore=.*\.md ./schemas/...
-//go:generate perl -pi -e s,Json,JSON,g bindata.go
-
-const (
- // SwaggerSchemaURL the url for the swagger 2.0 schema to validate specs
- SwaggerSchemaURL = "http://swagger.io/v2/schema.json#"
- // JSONSchemaURL the url for the json schema
- JSONSchemaURL = "http://json-schema.org/draft-04/schema#"
-)
-
-// MustLoadJSONSchemaDraft04 panics when Swagger20Schema returns an error
-func MustLoadJSONSchemaDraft04() *Schema {
- d, e := JSONSchemaDraft04()
- if e != nil {
- panic(e)
- }
- return d
-}
-
-// JSONSchemaDraft04 loads the json schema document for json shema draft04
-func JSONSchemaDraft04() (*Schema, error) {
- b, err := jsonschemaDraft04JSONBytes()
- if err != nil {
- return nil, err
- }
-
- schema := new(Schema)
- if err := json.Unmarshal(b, schema); err != nil {
- return nil, err
- }
- return schema, nil
-}
-
-// MustLoadSwagger20Schema panics when Swagger20Schema returns an error
-func MustLoadSwagger20Schema() *Schema {
- d, e := Swagger20Schema()
- if e != nil {
- panic(e)
- }
- return d
-}
-
-// Swagger20Schema loads the swagger 2.0 schema from the embedded assets
-func Swagger20Schema() (*Schema, error) {
-
- b, err := v2SchemaJSONBytes()
- if err != nil {
- return nil, err
- }
-
- schema := new(Schema)
- if err := json.Unmarshal(b, schema); err != nil {
- return nil, err
- }
- return schema, nil
-}
diff --git a/vendor/github.com/go-openapi/spec/swagger.go b/vendor/github.com/go-openapi/spec/swagger.go
deleted file mode 100644
index 3ec2cb4..0000000
--- a/vendor/github.com/go-openapi/spec/swagger.go
+++ /dev/null
@@ -1,767 +0,0 @@
-// 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 spec
-
-import (
- "bytes"
- "encoding/gob"
- "encoding/json"
- "fmt"
- "strconv"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-// Swagger this is the root document object for the API specification.
-
-// It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier)
-
-// together into one document.
-
-//
-
-// For more information: http://goo.gl/8us55a#swagger-object-
-
-type Swagger struct {
- VendorExtensible
-
- SwaggerProps
-}
-
-// JSONLookup look up a value by the json property name
-
-func (s Swagger) JSONLookup(token string) (interface{}, error) {
-
- if ex, ok := s.Extensions[token]; ok {
-
- return &ex, nil
-
- }
-
- r, _, err := jsonpointer.GetForToken(s.SwaggerProps, token)
-
- return r, err
-
-}
-
-// MarshalJSON marshals this swagger structure to json
-
-func (s Swagger) MarshalJSON() ([]byte, error) {
-
- b1, err := json.Marshal(s.SwaggerProps)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b2, err := json.Marshal(s.VendorExtensible)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return swag.ConcatJSON(b1, b2), nil
-
-}
-
-// UnmarshalJSON unmarshals a swagger spec from json
-
-func (s *Swagger) UnmarshalJSON(data []byte) error {
-
- var sw Swagger
-
- if err := json.Unmarshal(data, &sw.SwaggerProps); err != nil {
-
- return err
-
- }
-
- if err := json.Unmarshal(data, &sw.VendorExtensible); err != nil {
-
- return err
-
- }
-
- *s = sw
-
- return nil
-
-}
-
-// GobEncode provides a safe gob encoder for Swagger, including extensions
-
-func (s Swagger) GobEncode() ([]byte, error) {
-
- var b bytes.Buffer
-
- raw := struct {
- Props SwaggerProps
-
- Ext VendorExtensible
- }{
-
- Props: s.SwaggerProps,
-
- Ext: s.VendorExtensible,
- }
-
- err := gob.NewEncoder(&b).Encode(raw)
-
- return b.Bytes(), err
-
-}
-
-// GobDecode provides a safe gob decoder for Swagger, including extensions
-
-func (s *Swagger) GobDecode(b []byte) error {
-
- var raw struct {
- Props SwaggerProps
-
- Ext VendorExtensible
- }
-
- buf := bytes.NewBuffer(b)
-
- err := gob.NewDecoder(buf).Decode(&raw)
-
- if err != nil {
-
- return err
-
- }
-
- s.SwaggerProps = raw.Props
-
- s.VendorExtensible = raw.Ext
-
- return nil
-
-}
-
-// SwaggerProps captures the top-level properties of an Api specification
-
-//
-
-// NOTE: validation rules
-
-// - the scheme, when present must be from [http, https, ws, wss]
-
-// - BasePath must start with a leading "/"
-
-// - Paths is required
-
-type SwaggerProps struct {
- ID string `json:"id,omitempty"`
-
- Consumes []string `json:"consumes,omitempty"`
-
- Produces []string `json:"produces,omitempty"`
-
- Schemes []string `json:"schemes,omitempty"`
-
- Swagger string `json:"swagger,omitempty"`
-
- Info *Info `json:"info,omitempty"`
-
- Host string `json:"host,omitempty"`
-
- BasePath string `json:"basePath,omitempty"`
-
- Paths *Paths `json:"paths"`
-
- Definitions Definitions `json:"definitions,omitempty"`
-
- Parameters map[string]Parameter `json:"parameters,omitempty"`
-
- Responses map[string]Response `json:"responses,omitempty"`
-
- SecurityDefinitions SecurityDefinitions `json:"securityDefinitions,omitempty"`
-
- Security []map[string][]string `json:"security,omitempty"`
-
- Tags []Tag `json:"tags,omitempty"`
-
- ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
-}
-
-type swaggerPropsAlias SwaggerProps
-
-type gobSwaggerPropsAlias struct {
- Security []map[string]struct {
- List []string
-
- Pad bool
- }
-
- Alias *swaggerPropsAlias
-
- SecurityIsEmpty bool
-}
-
-// GobEncode provides a safe gob encoder for SwaggerProps, including empty security requirements
-
-func (o SwaggerProps) GobEncode() ([]byte, error) {
-
- raw := gobSwaggerPropsAlias{
-
- Alias: (*swaggerPropsAlias)(&o),
- }
-
- var b bytes.Buffer
-
- if o.Security == nil {
-
- // nil security requirement
-
- err := gob.NewEncoder(&b).Encode(raw)
-
- return b.Bytes(), err
-
- }
-
- if len(o.Security) == 0 {
-
- // empty, but non-nil security requirement
-
- raw.SecurityIsEmpty = true
-
- raw.Alias.Security = nil
-
- err := gob.NewEncoder(&b).Encode(raw)
-
- return b.Bytes(), err
-
- }
-
- raw.Security = make([]map[string]struct {
- List []string
-
- Pad bool
- }, 0, len(o.Security))
-
- for _, req := range o.Security {
-
- v := make(map[string]struct {
- List []string
-
- Pad bool
- }, len(req))
-
- for k, val := range req {
-
- v[k] = struct {
- List []string
-
- Pad bool
- }{
-
- List: val,
- }
-
- }
-
- raw.Security = append(raw.Security, v)
-
- }
-
- err := gob.NewEncoder(&b).Encode(raw)
-
- return b.Bytes(), err
-
-}
-
-// GobDecode provides a safe gob decoder for SwaggerProps, including empty security requirements
-
-func (o *SwaggerProps) GobDecode(b []byte) error {
-
- var raw gobSwaggerPropsAlias
-
- buf := bytes.NewBuffer(b)
-
- err := gob.NewDecoder(buf).Decode(&raw)
-
- if err != nil {
-
- return err
-
- }
-
- if raw.Alias == nil {
-
- return nil
-
- }
-
- switch {
-
- case raw.SecurityIsEmpty:
-
- // empty, but non-nil security requirement
-
- raw.Alias.Security = []map[string][]string{}
-
- case len(raw.Alias.Security) == 0:
-
- // nil security requirement
-
- raw.Alias.Security = nil
-
- default:
-
- raw.Alias.Security = make([]map[string][]string, 0, len(raw.Security))
-
- for _, req := range raw.Security {
-
- v := make(map[string][]string, len(req))
-
- for k, val := range req {
-
- v[k] = make([]string, 0, len(val.List))
-
- v[k] = append(v[k], val.List...)
-
- }
-
- raw.Alias.Security = append(raw.Alias.Security, v)
-
- }
-
- }
-
- *o = *(*SwaggerProps)(raw.Alias)
-
- return nil
-
-}
-
-// Dependencies represent a dependencies property
-
-type Dependencies map[string]SchemaOrStringArray
-
-// SchemaOrBool represents a schema or boolean value, is biased towards true for the boolean property
-
-type SchemaOrBool struct {
- Allows bool
-
- Schema *Schema
-}
-
-// JSONLookup implements an interface to customize json pointer lookup
-
-func (s SchemaOrBool) JSONLookup(token string) (interface{}, error) {
-
- if token == "allows" {
-
- return s.Allows, nil
-
- }
-
- r, _, err := jsonpointer.GetForToken(s.Schema, token)
-
- return r, err
-
-}
-
-var jsTrue = []byte("true")
-
-var jsFalse = []byte("false")
-
-// MarshalJSON convert this object to JSON
-
-func (s SchemaOrBool) MarshalJSON() ([]byte, error) {
-
- if s.Schema != nil {
-
- return json.Marshal(s.Schema)
-
- }
-
- if s.Schema == nil && !s.Allows {
-
- return jsFalse, nil
-
- }
-
- return jsTrue, nil
-
-}
-
-// UnmarshalJSON converts this bool or schema object from a JSON structure
-
-func (s *SchemaOrBool) UnmarshalJSON(data []byte) error {
-
- var nw SchemaOrBool
-
- if len(data) > 0 {
-
- if data[0] == '{' {
-
- var sch Schema
-
- if err := json.Unmarshal(data, &sch); err != nil {
-
- return err
-
- }
-
- nw.Schema = &sch
-
- }
-
- nw.Allows = !bytes.Equal(data, []byte("false"))
-
- }
-
- *s = nw
-
- return nil
-
-}
-
-// SchemaOrStringArray represents a schema or a string array
-
-type SchemaOrStringArray struct {
- Schema *Schema
-
- Property []string
-}
-
-// JSONLookup implements an interface to customize json pointer lookup
-
-func (s SchemaOrStringArray) JSONLookup(token string) (interface{}, error) {
-
- r, _, err := jsonpointer.GetForToken(s.Schema, token)
-
- return r, err
-
-}
-
-// MarshalJSON converts this schema object or array into JSON structure
-
-func (s SchemaOrStringArray) MarshalJSON() ([]byte, error) {
-
- if len(s.Property) > 0 {
-
- return json.Marshal(s.Property)
-
- }
-
- if s.Schema != nil {
-
- return json.Marshal(s.Schema)
-
- }
-
- return []byte("null"), nil
-
-}
-
-// UnmarshalJSON converts this schema object or array from a JSON structure
-
-func (s *SchemaOrStringArray) UnmarshalJSON(data []byte) error {
-
- var first byte
-
- if len(data) > 1 {
-
- first = data[0]
-
- }
-
- var nw SchemaOrStringArray
-
- if first == '{' {
-
- var sch Schema
-
- if err := json.Unmarshal(data, &sch); err != nil {
-
- return err
-
- }
-
- nw.Schema = &sch
-
- }
-
- if first == '[' {
-
- if err := json.Unmarshal(data, &nw.Property); err != nil {
-
- return err
-
- }
-
- }
-
- *s = nw
-
- return nil
-
-}
-
-// Definitions contains the models explicitly defined in this spec
-
-// An object to hold data types that can be consumed and produced by operations.
-
-// These data types can be primitives, arrays or models.
-
-//
-
-// For more information: http://goo.gl/8us55a#definitionsObject
-
-type Definitions map[string]Schema
-
-// SecurityDefinitions a declaration of the security schemes available to be used in the specification.
-
-// This does not enforce the security schemes on the operations and only serves to provide
-
-// the relevant details for each scheme.
-
-//
-
-// For more information: http://goo.gl/8us55a#securityDefinitionsObject
-
-type SecurityDefinitions map[string]*SecurityScheme
-
-// StringOrArray represents a value that can either be a string
-
-// or an array of strings. Mainly here for serialization purposes
-
-type StringOrArray []string
-
-// Contains returns true when the value is contained in the slice
-
-func (s StringOrArray) Contains(value string) bool {
-
- for _, str := range s {
-
- if str == value {
-
- return true
-
- }
-
- }
-
- return false
-
-}
-
-// JSONLookup implements an interface to customize json pointer lookup
-
-func (s SchemaOrArray) JSONLookup(token string) (interface{}, error) {
-
- if _, err := strconv.Atoi(token); err == nil {
-
- r, _, err := jsonpointer.GetForToken(s.Schemas, token)
-
- return r, err
-
- }
-
- r, _, err := jsonpointer.GetForToken(s.Schema, token)
-
- return r, err
-
-}
-
-// UnmarshalJSON unmarshals this string or array object from a JSON array or JSON string
-
-func (s *StringOrArray) UnmarshalJSON(data []byte) error {
-
- var first byte
-
- if len(data) > 1 {
-
- first = data[0]
-
- }
-
- if first == '[' {
-
- var parsed []string
-
- if err := json.Unmarshal(data, &parsed); err != nil {
-
- return err
-
- }
-
- *s = StringOrArray(parsed)
-
- return nil
-
- }
-
- var single interface{}
-
- if err := json.Unmarshal(data, &single); err != nil {
-
- return err
-
- }
-
- if single == nil {
-
- return nil
-
- }
-
- switch v := single.(type) {
-
- case string:
-
- *s = StringOrArray([]string{v})
-
- return nil
-
- default:
-
- return fmt.Errorf("only string or array is allowed, not %T", single)
-
- }
-
-}
-
-// MarshalJSON converts this string or array to a JSON array or JSON string
-
-func (s StringOrArray) MarshalJSON() ([]byte, error) {
-
- if len(s) == 1 {
-
- return json.Marshal([]string(s)[0])
-
- }
-
- return json.Marshal([]string(s))
-
-}
-
-// SchemaOrArray represents a value that can either be a Schema
-
-// or an array of Schema. Mainly here for serialization purposes
-
-type SchemaOrArray struct {
- Schema *Schema
-
- Schemas []Schema
-}
-
-// Len returns the number of schemas in this property
-
-func (s SchemaOrArray) Len() int {
-
- if s.Schema != nil {
-
- return 1
-
- }
-
- return len(s.Schemas)
-
-}
-
-// ContainsType returns true when one of the schemas is of the specified type
-
-func (s *SchemaOrArray) ContainsType(name string) bool {
-
- if s.Schema != nil {
-
- return s.Schema.Type != nil && s.Schema.Type.Contains(name)
-
- }
-
- return false
-
-}
-
-// MarshalJSON converts this schema object or array into JSON structure
-
-func (s SchemaOrArray) MarshalJSON() ([]byte, error) {
-
- if len(s.Schemas) > 0 {
-
- return json.Marshal(s.Schemas)
-
- }
-
- return json.Marshal(s.Schema)
-
-}
-
-// UnmarshalJSON converts this schema object or array from a JSON structure
-
-func (s *SchemaOrArray) UnmarshalJSON(data []byte) error {
-
- var nw SchemaOrArray
-
- var first byte
-
- if len(data) > 1 {
-
- first = data[0]
-
- }
-
- if first == '{' {
-
- var sch Schema
-
- if err := json.Unmarshal(data, &sch); err != nil {
-
- return err
-
- }
-
- nw.Schema = &sch
-
- }
-
- if first == '[' {
-
- if err := json.Unmarshal(data, &nw.Schemas); err != nil {
-
- return err
-
- }
-
- }
-
- *s = nw
-
- return nil
-
-}
-
-// vim:set ft=go noet sts=2 sw=2 ts=2:
diff --git a/vendor/github.com/go-openapi/spec/tag.go b/vendor/github.com/go-openapi/spec/tag.go
deleted file mode 100644
index 1414808..0000000
--- a/vendor/github.com/go-openapi/spec/tag.go
+++ /dev/null
@@ -1,122 +0,0 @@
-// 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 spec
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-// TagProps describe a tag entry in the top level tags section of a swagger spec
-
-type TagProps struct {
- Description string `json:"description,omitempty"`
-
- Name string `json:"name,omitempty"`
-
- ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
-}
-
-// NewTag creates a new tag
-
-func NewTag(name, description string, externalDocs *ExternalDocumentation) Tag {
-
- return Tag{TagProps: TagProps{Description: description, Name: name, ExternalDocs: externalDocs}}
-
-}
-
-// Tag allows adding meta data to a single tag that is used by the
-
-// [Operation Object](http://goo.gl/8us55a#operationObject).
-
-// It is not mandatory to have a Tag Object per tag used there.
-
-//
-
-// For more information: http://goo.gl/8us55a#tagObject
-
-type Tag struct {
- VendorExtensible
-
- TagProps
-}
-
-// JSONLookup implements an interface to customize json pointer lookup
-
-func (t Tag) JSONLookup(token string) (interface{}, error) {
-
- if ex, ok := t.Extensions[token]; ok {
-
- return &ex, nil
-
- }
-
- r, _, err := jsonpointer.GetForToken(t.TagProps, token)
-
- return r, err
-
-}
-
-// MarshalJSON marshal this to JSON
-
-func (t Tag) MarshalJSON() ([]byte, error) {
-
- b1, err := json.Marshal(t.TagProps)
-
- if err != nil {
-
- return nil, err
-
- }
-
- b2, err := json.Marshal(t.VendorExtensible)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return swag.ConcatJSON(b1, b2), nil
-
-}
-
-// UnmarshalJSON marshal this from JSON
-
-func (t *Tag) UnmarshalJSON(data []byte) error {
-
- if err := json.Unmarshal(data, &t.TagProps); err != nil {
-
- return err
-
- }
-
- return json.Unmarshal(data, &t.VendorExtensible)
-
-}
diff --git a/vendor/github.com/go-openapi/spec/url_go19.go b/vendor/github.com/go-openapi/spec/url_go19.go
deleted file mode 100644
index 5bdfe40..0000000
--- a/vendor/github.com/go-openapi/spec/url_go19.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package spec
-
-import "net/url"
-
-func parseURL(s string) (*url.URL, error) {
- u, err := url.Parse(s)
- if err == nil {
- u.OmitHost = false
- }
- return u, err
-}
diff --git a/vendor/github.com/go-openapi/spec/validations.go b/vendor/github.com/go-openapi/spec/validations.go
deleted file mode 100644
index 6360a8e..0000000
--- a/vendor/github.com/go-openapi/spec/validations.go
+++ /dev/null
@@ -1,215 +0,0 @@
-package spec
-
-// CommonValidations describe common JSON-schema validations
-type CommonValidations struct {
- Maximum *float64 `json:"maximum,omitempty"`
- ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"`
- Minimum *float64 `json:"minimum,omitempty"`
- ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"`
- MaxLength *int64 `json:"maxLength,omitempty"`
- MinLength *int64 `json:"minLength,omitempty"`
- Pattern string `json:"pattern,omitempty"`
- MaxItems *int64 `json:"maxItems,omitempty"`
- MinItems *int64 `json:"minItems,omitempty"`
- UniqueItems bool `json:"uniqueItems,omitempty"`
- MultipleOf *float64 `json:"multipleOf,omitempty"`
- Enum []interface{} `json:"enum,omitempty"`
-}
-
-// SetValidations defines all validations for a simple schema.
-//
-// NOTE: the input is the larger set of validations available for schemas.
-// For simple schemas, MinProperties and MaxProperties are ignored.
-func (v *CommonValidations) SetValidations(val SchemaValidations) {
- v.Maximum = val.Maximum
- v.ExclusiveMaximum = val.ExclusiveMaximum
- v.Minimum = val.Minimum
- v.ExclusiveMinimum = val.ExclusiveMinimum
- v.MaxLength = val.MaxLength
- v.MinLength = val.MinLength
- v.Pattern = val.Pattern
- v.MaxItems = val.MaxItems
- v.MinItems = val.MinItems
- v.UniqueItems = val.UniqueItems
- v.MultipleOf = val.MultipleOf
- v.Enum = val.Enum
-}
-
-type clearedValidation struct {
- Validation string
- Value interface{}
-}
-
-type clearedValidations []clearedValidation
-
-func (c clearedValidations) apply(cbs []func(string, interface{})) {
- for _, cb := range cbs {
- for _, cleared := range c {
- cb(cleared.Validation, cleared.Value)
- }
- }
-}
-
-// ClearNumberValidations clears all number validations.
-//
-// Some callbacks may be set by the caller to capture changed values.
-func (v *CommonValidations) ClearNumberValidations(cbs ...func(string, interface{})) {
- done := make(clearedValidations, 0, 5)
- defer func() {
- done.apply(cbs)
- }()
-
- if v.Minimum != nil {
- done = append(done, clearedValidation{Validation: "minimum", Value: v.Minimum})
- v.Minimum = nil
- }
- if v.Maximum != nil {
- done = append(done, clearedValidation{Validation: "maximum", Value: v.Maximum})
- v.Maximum = nil
- }
- if v.ExclusiveMaximum {
- done = append(done, clearedValidation{Validation: "exclusiveMaximum", Value: v.ExclusiveMaximum})
- v.ExclusiveMaximum = false
- }
- if v.ExclusiveMinimum {
- done = append(done, clearedValidation{Validation: "exclusiveMinimum", Value: v.ExclusiveMinimum})
- v.ExclusiveMinimum = false
- }
- if v.MultipleOf != nil {
- done = append(done, clearedValidation{Validation: "multipleOf", Value: v.MultipleOf})
- v.MultipleOf = nil
- }
-}
-
-// ClearStringValidations clears all string validations.
-//
-// Some callbacks may be set by the caller to capture changed values.
-func (v *CommonValidations) ClearStringValidations(cbs ...func(string, interface{})) {
- done := make(clearedValidations, 0, 3)
- defer func() {
- done.apply(cbs)
- }()
-
- if v.Pattern != "" {
- done = append(done, clearedValidation{Validation: "pattern", Value: v.Pattern})
- v.Pattern = ""
- }
- if v.MinLength != nil {
- done = append(done, clearedValidation{Validation: "minLength", Value: v.MinLength})
- v.MinLength = nil
- }
- if v.MaxLength != nil {
- done = append(done, clearedValidation{Validation: "maxLength", Value: v.MaxLength})
- v.MaxLength = nil
- }
-}
-
-// ClearArrayValidations clears all array validations.
-//
-// Some callbacks may be set by the caller to capture changed values.
-func (v *CommonValidations) ClearArrayValidations(cbs ...func(string, interface{})) {
- done := make(clearedValidations, 0, 3)
- defer func() {
- done.apply(cbs)
- }()
-
- if v.MaxItems != nil {
- done = append(done, clearedValidation{Validation: "maxItems", Value: v.MaxItems})
- v.MaxItems = nil
- }
- if v.MinItems != nil {
- done = append(done, clearedValidation{Validation: "minItems", Value: v.MinItems})
- v.MinItems = nil
- }
- if v.UniqueItems {
- done = append(done, clearedValidation{Validation: "uniqueItems", Value: v.UniqueItems})
- v.UniqueItems = false
- }
-}
-
-// Validations returns a clone of the validations for a simple schema.
-//
-// NOTE: in the context of simple schema objects, MinProperties, MaxProperties
-// and PatternProperties remain unset.
-func (v CommonValidations) Validations() SchemaValidations {
- return SchemaValidations{
- CommonValidations: v,
- }
-}
-
-// HasNumberValidations indicates if the validations are for numbers or integers
-func (v CommonValidations) HasNumberValidations() bool {
- return v.Maximum != nil || v.Minimum != nil || v.MultipleOf != nil
-}
-
-// HasStringValidations indicates if the validations are for strings
-func (v CommonValidations) HasStringValidations() bool {
- return v.MaxLength != nil || v.MinLength != nil || v.Pattern != ""
-}
-
-// HasArrayValidations indicates if the validations are for arrays
-func (v CommonValidations) HasArrayValidations() bool {
- return v.MaxItems != nil || v.MinItems != nil || v.UniqueItems
-}
-
-// HasEnum indicates if the validation includes some enum constraint
-func (v CommonValidations) HasEnum() bool {
- return len(v.Enum) > 0
-}
-
-// SchemaValidations describes the validation properties of a schema
-//
-// NOTE: at this moment, this is not embedded in SchemaProps because this would induce a breaking change
-// in the exported members: all initializers using litterals would fail.
-type SchemaValidations struct {
- CommonValidations
-
- PatternProperties SchemaProperties `json:"patternProperties,omitempty"`
- MaxProperties *int64 `json:"maxProperties,omitempty"`
- MinProperties *int64 `json:"minProperties,omitempty"`
-}
-
-// HasObjectValidations indicates if the validations are for objects
-func (v SchemaValidations) HasObjectValidations() bool {
- return v.MaxProperties != nil || v.MinProperties != nil || v.PatternProperties != nil
-}
-
-// SetValidations for schema validations
-func (v *SchemaValidations) SetValidations(val SchemaValidations) {
- v.CommonValidations.SetValidations(val)
- v.PatternProperties = val.PatternProperties
- v.MaxProperties = val.MaxProperties
- v.MinProperties = val.MinProperties
-}
-
-// Validations for a schema
-func (v SchemaValidations) Validations() SchemaValidations {
- val := v.CommonValidations.Validations()
- val.PatternProperties = v.PatternProperties
- val.MinProperties = v.MinProperties
- val.MaxProperties = v.MaxProperties
- return val
-}
-
-// ClearObjectValidations returns a clone of the validations with all object validations cleared.
-//
-// Some callbacks may be set by the caller to capture changed values.
-func (v *SchemaValidations) ClearObjectValidations(cbs ...func(string, interface{})) {
- done := make(clearedValidations, 0, 3)
- defer func() {
- done.apply(cbs)
- }()
-
- if v.MaxProperties != nil {
- done = append(done, clearedValidation{Validation: "maxProperties", Value: v.MaxProperties})
- v.MaxProperties = nil
- }
- if v.MinProperties != nil {
- done = append(done, clearedValidation{Validation: "minProperties", Value: v.MinProperties})
- v.MinProperties = nil
- }
- if v.PatternProperties != nil {
- done = append(done, clearedValidation{Validation: "patternProperties", Value: v.PatternProperties})
- v.PatternProperties = nil
- }
-}
diff --git a/vendor/github.com/go-openapi/spec/xml_object.go b/vendor/github.com/go-openapi/spec/xml_object.go
deleted file mode 100644
index 945a467..0000000
--- a/vendor/github.com/go-openapi/spec/xml_object.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// 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 spec
-
-// XMLObject a metadata object that allows for more fine-tuned XML model definitions.
-//
-// For more information: http://goo.gl/8us55a#xmlObject
-type XMLObject struct {
- Name string `json:"name,omitempty"`
- Namespace string `json:"namespace,omitempty"`
- Prefix string `json:"prefix,omitempty"`
- Attribute bool `json:"attribute,omitempty"`
- Wrapped bool `json:"wrapped,omitempty"`
-}
-
-// WithName sets the xml name for the object
-func (x *XMLObject) WithName(name string) *XMLObject {
- x.Name = name
- return x
-}
-
-// WithNamespace sets the xml namespace for the object
-func (x *XMLObject) WithNamespace(namespace string) *XMLObject {
- x.Namespace = namespace
- return x
-}
-
-// WithPrefix sets the xml prefix for the object
-func (x *XMLObject) WithPrefix(prefix string) *XMLObject {
- x.Prefix = prefix
- return x
-}
-
-// AsAttribute flags this object as xml attribute
-func (x *XMLObject) AsAttribute() *XMLObject {
- x.Attribute = true
- return x
-}
-
-// AsElement flags this object as an xml node
-func (x *XMLObject) AsElement() *XMLObject {
- x.Attribute = false
- return x
-}
-
-// AsWrapped flags this object as wrapped, this is mostly useful for array types
-func (x *XMLObject) AsWrapped() *XMLObject {
- x.Wrapped = true
- return x
-}
-
-// AsUnwrapped flags this object as an xml node
-func (x *XMLObject) AsUnwrapped() *XMLObject {
- x.Wrapped = false
- return x
-}
diff --git a/vendor/github.com/go-openapi/swag/.editorconfig b/vendor/github.com/go-openapi/swag/.editorconfig
deleted file mode 100644
index 3152da6..0000000
--- a/vendor/github.com/go-openapi/swag/.editorconfig
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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/vendor/github.com/go-openapi/swag/.gitattributes b/vendor/github.com/go-openapi/swag/.gitattributes
deleted file mode 100644
index 49ad527..0000000
--- a/vendor/github.com/go-openapi/swag/.gitattributes
+++ /dev/null
@@ -1,2 +0,0 @@
-# gofmt always uses LF, whereas Git uses CRLF on Windows.
-*.go text eol=lf
diff --git a/vendor/github.com/go-openapi/swag/.gitignore b/vendor/github.com/go-openapi/swag/.gitignore
deleted file mode 100644
index c4b1b64..0000000
--- a/vendor/github.com/go-openapi/swag/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-secrets.yml
-vendor
-Godeps
-.idea
-*.out
diff --git a/vendor/github.com/go-openapi/swag/.golangci.yml b/vendor/github.com/go-openapi/swag/.golangci.yml
deleted file mode 100644
index 80e2be0..0000000
--- a/vendor/github.com/go-openapi/swag/.golangci.yml
+++ /dev/null
@@ -1,60 +0,0 @@
-linters-settings:
- govet:
- check-shadowing: true
- golint:
- min-confidence: 0
- gocyclo:
- min-complexity: 45
- maligned:
- suggest-new: true
- dupl:
- threshold: 200
- goconst:
- min-len: 3
- min-occurrences: 3
-
-linters:
- enable-all: true
- disable:
- - maligned
- - lll
- - gochecknoinits
- - gochecknoglobals
- - funlen
- - godox
- - gocognit
- - whitespace
- - wsl
- - wrapcheck
- - testpackage
- - nlreturn
- - gomnd
- - exhaustivestruct
- - goerr113
- - errorlint
- - nestif
- - godot
- - gofumpt
- - paralleltest
- - tparallel
- - thelper
- - ifshort
- - exhaustruct
- - varnamelen
- - gci
- - depguard
- - errchkjson
- - inamedparam
- - nonamedreturns
- - musttag
- - ireturn
- - forcetypeassert
- - cyclop
- # deprecated linters
- - deadcode
- - interfacer
- - scopelint
- - varcheck
- - structcheck
- - golint
- - nosnakecase
diff --git a/vendor/github.com/go-openapi/swag/BENCHMARK.md b/vendor/github.com/go-openapi/swag/BENCHMARK.md
deleted file mode 100644
index e7f28ed..0000000
--- a/vendor/github.com/go-openapi/swag/BENCHMARK.md
+++ /dev/null
@@ -1,52 +0,0 @@
-# Benchmarks
-
-## Name mangling utilities
-
-```bash
-go test -bench XXX -run XXX -benchtime 30s
-```
-
-### Benchmarks at b3e7a5386f996177e4808f11acb2aa93a0f660df
-
-```
-goos: linux
-goarch: amd64
-pkg: github.com/go-openapi/swag
-cpu: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
-BenchmarkToXXXName/ToGoName-4 862623 44101 ns/op 10450 B/op 732 allocs/op
-BenchmarkToXXXName/ToVarName-4 853656 40728 ns/op 10468 B/op 734 allocs/op
-BenchmarkToXXXName/ToFileName-4 1268312 27813 ns/op 9785 B/op 617 allocs/op
-BenchmarkToXXXName/ToCommandName-4 1276322 27903 ns/op 9785 B/op 617 allocs/op
-BenchmarkToXXXName/ToHumanNameLower-4 895334 40354 ns/op 10472 B/op 731 allocs/op
-BenchmarkToXXXName/ToHumanNameTitle-4 882441 40678 ns/op 10566 B/op 749 allocs/op
-```
-
-### Benchmarks after PR #79
-
-~ x10 performance improvement and ~ /100 memory allocations.
-
-```
-goos: linux
-goarch: amd64
-pkg: github.com/go-openapi/swag
-cpu: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
-BenchmarkToXXXName/ToGoName-4 9595830 3991 ns/op 42 B/op 5 allocs/op
-BenchmarkToXXXName/ToVarName-4 9194276 3984 ns/op 62 B/op 7 allocs/op
-BenchmarkToXXXName/ToFileName-4 17002711 2123 ns/op 147 B/op 7 allocs/op
-BenchmarkToXXXName/ToCommandName-4 16772926 2111 ns/op 147 B/op 7 allocs/op
-BenchmarkToXXXName/ToHumanNameLower-4 9788331 3749 ns/op 92 B/op 6 allocs/op
-BenchmarkToXXXName/ToHumanNameTitle-4 9188260 3941 ns/op 104 B/op 6 allocs/op
-```
-
-```
-goos: linux
-goarch: amd64
-pkg: github.com/go-openapi/swag
-cpu: AMD Ryzen 7 5800X 8-Core Processor
-BenchmarkToXXXName/ToGoName-16 18527378 1972 ns/op 42 B/op 5 allocs/op
-BenchmarkToXXXName/ToVarName-16 15552692 2093 ns/op 62 B/op 7 allocs/op
-BenchmarkToXXXName/ToFileName-16 32161176 1117 ns/op 147 B/op 7 allocs/op
-BenchmarkToXXXName/ToCommandName-16 32256634 1137 ns/op 147 B/op 7 allocs/op
-BenchmarkToXXXName/ToHumanNameLower-16 18599661 1946 ns/op 92 B/op 6 allocs/op
-BenchmarkToXXXName/ToHumanNameTitle-16 17581353 2054 ns/op 105 B/op 6 allocs/op
-```
diff --git a/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md
deleted file mode 100644
index 9322b06..0000000
--- a/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# 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/vendor/github.com/go-openapi/swag/LICENSE b/vendor/github.com/go-openapi/swag/LICENSE
deleted file mode 100644
index d645695..0000000
--- a/vendor/github.com/go-openapi/swag/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- 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/vendor/github.com/go-openapi/swag/README.md b/vendor/github.com/go-openapi/swag/README.md
deleted file mode 100644
index a729222..0000000
--- a/vendor/github.com/go-openapi/swag/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# Swag [![Build Status](https://github.com/go-openapi/swag/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/swag/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/swag/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/swag)
-
-[![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/swag/master/LICENSE)
-[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/swag.svg)](https://pkg.go.dev/github.com/go-openapi/swag)
-[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/swag)](https://goreportcard.com/report/github.com/go-openapi/swag)
-
-Contains a bunch of helper functions for go-openapi and go-swagger projects.
-
-You may also use it standalone for your projects.
-
-* convert between value and pointers for builtin types
-* convert from string to builtin types (wraps strconv)
-* fast json concatenation
-* search in path
-* load from file or http
-* name mangling
-
-
-This repo has only few dependencies outside of the standard library:
-
-* YAML utilities depend on `gopkg.in/yaml.v3`
-* `github.com/mailru/easyjson v0.7.7`
diff --git a/vendor/github.com/go-openapi/swag/convert.go b/vendor/github.com/go-openapi/swag/convert.go
deleted file mode 100644
index fc085ae..0000000
--- a/vendor/github.com/go-openapi/swag/convert.go
+++ /dev/null
@@ -1,208 +0,0 @@
-// 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 swag
-
-import (
- "math"
- "strconv"
- "strings"
-)
-
-// same as ECMA Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER
-const (
- maxJSONFloat = float64(1<<53 - 1) // 9007199254740991.0 2^53 - 1
- minJSONFloat = -float64(1<<53 - 1) //-9007199254740991.0 -2^53 - 1
- epsilon float64 = 1e-9
-)
-
-// IsFloat64AJSONInteger allow for integers [-2^53, 2^53-1] inclusive
-func IsFloat64AJSONInteger(f float64) bool {
- if math.IsNaN(f) || math.IsInf(f, 0) || f < minJSONFloat || f > maxJSONFloat {
- return false
- }
- fa := math.Abs(f)
- g := float64(uint64(f))
- ga := math.Abs(g)
-
- diff := math.Abs(f - g)
-
- // more info: https://floating-point-gui.de/errors/comparison/#look-out-for-edge-cases
- switch {
- case f == g: // best case
- return true
- case f == float64(int64(f)) || f == float64(uint64(f)): // optimistic case
- return true
- case f == 0 || g == 0 || diff < math.SmallestNonzeroFloat64: // very close to 0 values
- return diff < (epsilon * math.SmallestNonzeroFloat64)
- }
- // check the relative error
- return diff/math.Min(fa+ga, math.MaxFloat64) < epsilon
-}
-
-var evaluatesAsTrue map[string]struct{}
-
-func init() {
- evaluatesAsTrue = map[string]struct{}{
- "true": {},
- "1": {},
- "yes": {},
- "ok": {},
- "y": {},
- "on": {},
- "selected": {},
- "checked": {},
- "t": {},
- "enabled": {},
- }
-}
-
-// ConvertBool turn a string into a boolean
-func ConvertBool(str string) (bool, error) {
- _, ok := evaluatesAsTrue[strings.ToLower(str)]
- return ok, nil
-}
-
-// ConvertFloat32 turn a string into a float32
-func ConvertFloat32(str string) (float32, error) {
- f, err := strconv.ParseFloat(str, 32)
- if err != nil {
- return 0, err
- }
- return float32(f), nil
-}
-
-// ConvertFloat64 turn a string into a float64
-func ConvertFloat64(str string) (float64, error) {
- return strconv.ParseFloat(str, 64)
-}
-
-// ConvertInt8 turn a string into an int8
-func ConvertInt8(str string) (int8, error) {
- i, err := strconv.ParseInt(str, 10, 8)
- if err != nil {
- return 0, err
- }
- return int8(i), nil
-}
-
-// ConvertInt16 turn a string into an int16
-func ConvertInt16(str string) (int16, error) {
- i, err := strconv.ParseInt(str, 10, 16)
- if err != nil {
- return 0, err
- }
- return int16(i), nil
-}
-
-// ConvertInt32 turn a string into an int32
-func ConvertInt32(str string) (int32, error) {
- i, err := strconv.ParseInt(str, 10, 32)
- if err != nil {
- return 0, err
- }
- return int32(i), nil
-}
-
-// ConvertInt64 turn a string into an int64
-func ConvertInt64(str string) (int64, error) {
- return strconv.ParseInt(str, 10, 64)
-}
-
-// ConvertUint8 turn a string into an uint8
-func ConvertUint8(str string) (uint8, error) {
- i, err := strconv.ParseUint(str, 10, 8)
- if err != nil {
- return 0, err
- }
- return uint8(i), nil
-}
-
-// ConvertUint16 turn a string into an uint16
-func ConvertUint16(str string) (uint16, error) {
- i, err := strconv.ParseUint(str, 10, 16)
- if err != nil {
- return 0, err
- }
- return uint16(i), nil
-}
-
-// ConvertUint32 turn a string into an uint32
-func ConvertUint32(str string) (uint32, error) {
- i, err := strconv.ParseUint(str, 10, 32)
- if err != nil {
- return 0, err
- }
- return uint32(i), nil
-}
-
-// ConvertUint64 turn a string into an uint64
-func ConvertUint64(str string) (uint64, error) {
- return strconv.ParseUint(str, 10, 64)
-}
-
-// FormatBool turns a boolean into a string
-func FormatBool(value bool) string {
- return strconv.FormatBool(value)
-}
-
-// FormatFloat32 turns a float32 into a string
-func FormatFloat32(value float32) string {
- return strconv.FormatFloat(float64(value), 'f', -1, 32)
-}
-
-// FormatFloat64 turns a float64 into a string
-func FormatFloat64(value float64) string {
- return strconv.FormatFloat(value, 'f', -1, 64)
-}
-
-// FormatInt8 turns an int8 into a string
-func FormatInt8(value int8) string {
- return strconv.FormatInt(int64(value), 10)
-}
-
-// FormatInt16 turns an int16 into a string
-func FormatInt16(value int16) string {
- return strconv.FormatInt(int64(value), 10)
-}
-
-// FormatInt32 turns an int32 into a string
-func FormatInt32(value int32) string {
- return strconv.Itoa(int(value))
-}
-
-// FormatInt64 turns an int64 into a string
-func FormatInt64(value int64) string {
- return strconv.FormatInt(value, 10)
-}
-
-// FormatUint8 turns an uint8 into a string
-func FormatUint8(value uint8) string {
- return strconv.FormatUint(uint64(value), 10)
-}
-
-// FormatUint16 turns an uint16 into a string
-func FormatUint16(value uint16) string {
- return strconv.FormatUint(uint64(value), 10)
-}
-
-// FormatUint32 turns an uint32 into a string
-func FormatUint32(value uint32) string {
- return strconv.FormatUint(uint64(value), 10)
-}
-
-// FormatUint64 turns an uint64 into a string
-func FormatUint64(value uint64) string {
- return strconv.FormatUint(value, 10)
-}
diff --git a/vendor/github.com/go-openapi/swag/convert_types.go b/vendor/github.com/go-openapi/swag/convert_types.go
deleted file mode 100644
index c49cc47..0000000
--- a/vendor/github.com/go-openapi/swag/convert_types.go
+++ /dev/null
@@ -1,730 +0,0 @@
-package swag
-
-import "time"
-
-// This file was taken from the aws go sdk
-
-// String returns a pointer to of the string value passed in.
-func String(v string) *string {
- return &v
-}
-
-// StringValue returns the value of the string pointer passed in or
-// "" if the pointer is nil.
-func StringValue(v *string) string {
- if v != nil {
- return *v
- }
- return ""
-}
-
-// StringSlice converts a slice of string values into a slice of
-// string pointers
-func StringSlice(src []string) []*string {
- dst := make([]*string, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// StringValueSlice converts a slice of string pointers into a slice of
-// string values
-func StringValueSlice(src []*string) []string {
- dst := make([]string, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// StringMap converts a string map of string values into a string
-// map of string pointers
-func StringMap(src map[string]string) map[string]*string {
- dst := make(map[string]*string)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// StringValueMap converts a string map of string pointers into a string
-// map of string values
-func StringValueMap(src map[string]*string) map[string]string {
- dst := make(map[string]string)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Bool returns a pointer to of the bool value passed in.
-func Bool(v bool) *bool {
- return &v
-}
-
-// BoolValue returns the value of the bool pointer passed in or
-// false if the pointer is nil.
-func BoolValue(v *bool) bool {
- if v != nil {
- return *v
- }
- return false
-}
-
-// BoolSlice converts a slice of bool values into a slice of
-// bool pointers
-func BoolSlice(src []bool) []*bool {
- dst := make([]*bool, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// BoolValueSlice converts a slice of bool pointers into a slice of
-// bool values
-func BoolValueSlice(src []*bool) []bool {
- dst := make([]bool, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// BoolMap converts a string map of bool values into a string
-// map of bool pointers
-func BoolMap(src map[string]bool) map[string]*bool {
- dst := make(map[string]*bool)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// BoolValueMap converts a string map of bool pointers into a string
-// map of bool values
-func BoolValueMap(src map[string]*bool) map[string]bool {
- dst := make(map[string]bool)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Int returns a pointer to of the int value passed in.
-func Int(v int) *int {
- return &v
-}
-
-// IntValue returns the value of the int pointer passed in or
-// 0 if the pointer is nil.
-func IntValue(v *int) int {
- if v != nil {
- return *v
- }
- return 0
-}
-
-// IntSlice converts a slice of int values into a slice of
-// int pointers
-func IntSlice(src []int) []*int {
- dst := make([]*int, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// IntValueSlice converts a slice of int pointers into a slice of
-// int values
-func IntValueSlice(src []*int) []int {
- dst := make([]int, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// IntMap converts a string map of int values into a string
-// map of int pointers
-func IntMap(src map[string]int) map[string]*int {
- dst := make(map[string]*int)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// IntValueMap converts a string map of int pointers into a string
-// map of int values
-func IntValueMap(src map[string]*int) map[string]int {
- dst := make(map[string]int)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Int32 returns a pointer to of the int32 value passed in.
-func Int32(v int32) *int32 {
- return &v
-}
-
-// Int32Value returns the value of the int32 pointer passed in or
-// 0 if the pointer is nil.
-func Int32Value(v *int32) int32 {
- if v != nil {
- return *v
- }
- return 0
-}
-
-// Int32Slice converts a slice of int32 values into a slice of
-// int32 pointers
-func Int32Slice(src []int32) []*int32 {
- dst := make([]*int32, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// Int32ValueSlice converts a slice of int32 pointers into a slice of
-// int32 values
-func Int32ValueSlice(src []*int32) []int32 {
- dst := make([]int32, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// Int32Map converts a string map of int32 values into a string
-// map of int32 pointers
-func Int32Map(src map[string]int32) map[string]*int32 {
- dst := make(map[string]*int32)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// Int32ValueMap converts a string map of int32 pointers into a string
-// map of int32 values
-func Int32ValueMap(src map[string]*int32) map[string]int32 {
- dst := make(map[string]int32)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Int64 returns a pointer to of the int64 value passed in.
-func Int64(v int64) *int64 {
- return &v
-}
-
-// Int64Value returns the value of the int64 pointer passed in or
-// 0 if the pointer is nil.
-func Int64Value(v *int64) int64 {
- if v != nil {
- return *v
- }
- return 0
-}
-
-// Int64Slice converts a slice of int64 values into a slice of
-// int64 pointers
-func Int64Slice(src []int64) []*int64 {
- dst := make([]*int64, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// Int64ValueSlice converts a slice of int64 pointers into a slice of
-// int64 values
-func Int64ValueSlice(src []*int64) []int64 {
- dst := make([]int64, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// Int64Map converts a string map of int64 values into a string
-// map of int64 pointers
-func Int64Map(src map[string]int64) map[string]*int64 {
- dst := make(map[string]*int64)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// Int64ValueMap converts a string map of int64 pointers into a string
-// map of int64 values
-func Int64ValueMap(src map[string]*int64) map[string]int64 {
- dst := make(map[string]int64)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Uint16 returns a pointer to of the uint16 value passed in.
-func Uint16(v uint16) *uint16 {
- return &v
-}
-
-// Uint16Value returns the value of the uint16 pointer passed in or
-// 0 if the pointer is nil.
-func Uint16Value(v *uint16) uint16 {
- if v != nil {
- return *v
- }
-
- return 0
-}
-
-// Uint16Slice converts a slice of uint16 values into a slice of
-// uint16 pointers
-func Uint16Slice(src []uint16) []*uint16 {
- dst := make([]*uint16, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
-
- return dst
-}
-
-// Uint16ValueSlice converts a slice of uint16 pointers into a slice of
-// uint16 values
-func Uint16ValueSlice(src []*uint16) []uint16 {
- dst := make([]uint16, len(src))
-
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
-
- return dst
-}
-
-// Uint16Map converts a string map of uint16 values into a string
-// map of uint16 pointers
-func Uint16Map(src map[string]uint16) map[string]*uint16 {
- dst := make(map[string]*uint16)
-
- for k, val := range src {
- v := val
- dst[k] = &v
- }
-
- return dst
-}
-
-// Uint16ValueMap converts a string map of uint16 pointers into a string
-// map of uint16 values
-func Uint16ValueMap(src map[string]*uint16) map[string]uint16 {
- dst := make(map[string]uint16)
-
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
-
- return dst
-}
-
-// Uint returns a pointer to of the uint value passed in.
-func Uint(v uint) *uint {
- return &v
-}
-
-// UintValue returns the value of the uint pointer passed in or
-// 0 if the pointer is nil.
-func UintValue(v *uint) uint {
- if v != nil {
- return *v
- }
- return 0
-}
-
-// UintSlice converts a slice of uint values into a slice of
-// uint pointers
-func UintSlice(src []uint) []*uint {
- dst := make([]*uint, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// UintValueSlice converts a slice of uint pointers into a slice of
-// uint values
-func UintValueSlice(src []*uint) []uint {
- dst := make([]uint, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// UintMap converts a string map of uint values into a string
-// map of uint pointers
-func UintMap(src map[string]uint) map[string]*uint {
- dst := make(map[string]*uint)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// UintValueMap converts a string map of uint pointers into a string
-// map of uint values
-func UintValueMap(src map[string]*uint) map[string]uint {
- dst := make(map[string]uint)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Uint32 returns a pointer to of the uint32 value passed in.
-func Uint32(v uint32) *uint32 {
- return &v
-}
-
-// Uint32Value returns the value of the uint32 pointer passed in or
-// 0 if the pointer is nil.
-func Uint32Value(v *uint32) uint32 {
- if v != nil {
- return *v
- }
- return 0
-}
-
-// Uint32Slice converts a slice of uint32 values into a slice of
-// uint32 pointers
-func Uint32Slice(src []uint32) []*uint32 {
- dst := make([]*uint32, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// Uint32ValueSlice converts a slice of uint32 pointers into a slice of
-// uint32 values
-func Uint32ValueSlice(src []*uint32) []uint32 {
- dst := make([]uint32, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// Uint32Map converts a string map of uint32 values into a string
-// map of uint32 pointers
-func Uint32Map(src map[string]uint32) map[string]*uint32 {
- dst := make(map[string]*uint32)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// Uint32ValueMap converts a string map of uint32 pointers into a string
-// map of uint32 values
-func Uint32ValueMap(src map[string]*uint32) map[string]uint32 {
- dst := make(map[string]uint32)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Uint64 returns a pointer to of the uint64 value passed in.
-func Uint64(v uint64) *uint64 {
- return &v
-}
-
-// Uint64Value returns the value of the uint64 pointer passed in or
-// 0 if the pointer is nil.
-func Uint64Value(v *uint64) uint64 {
- if v != nil {
- return *v
- }
- return 0
-}
-
-// Uint64Slice converts a slice of uint64 values into a slice of
-// uint64 pointers
-func Uint64Slice(src []uint64) []*uint64 {
- dst := make([]*uint64, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// Uint64ValueSlice converts a slice of uint64 pointers into a slice of
-// uint64 values
-func Uint64ValueSlice(src []*uint64) []uint64 {
- dst := make([]uint64, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// Uint64Map converts a string map of uint64 values into a string
-// map of uint64 pointers
-func Uint64Map(src map[string]uint64) map[string]*uint64 {
- dst := make(map[string]*uint64)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// Uint64ValueMap converts a string map of uint64 pointers into a string
-// map of uint64 values
-func Uint64ValueMap(src map[string]*uint64) map[string]uint64 {
- dst := make(map[string]uint64)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Float32 returns a pointer to of the float32 value passed in.
-func Float32(v float32) *float32 {
- return &v
-}
-
-// Float32Value returns the value of the float32 pointer passed in or
-// 0 if the pointer is nil.
-func Float32Value(v *float32) float32 {
- if v != nil {
- return *v
- }
-
- return 0
-}
-
-// Float32Slice converts a slice of float32 values into a slice of
-// float32 pointers
-func Float32Slice(src []float32) []*float32 {
- dst := make([]*float32, len(src))
-
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
-
- return dst
-}
-
-// Float32ValueSlice converts a slice of float32 pointers into a slice of
-// float32 values
-func Float32ValueSlice(src []*float32) []float32 {
- dst := make([]float32, len(src))
-
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
-
- return dst
-}
-
-// Float32Map converts a string map of float32 values into a string
-// map of float32 pointers
-func Float32Map(src map[string]float32) map[string]*float32 {
- dst := make(map[string]*float32)
-
- for k, val := range src {
- v := val
- dst[k] = &v
- }
-
- return dst
-}
-
-// Float32ValueMap converts a string map of float32 pointers into a string
-// map of float32 values
-func Float32ValueMap(src map[string]*float32) map[string]float32 {
- dst := make(map[string]float32)
-
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
-
- return dst
-}
-
-// Float64 returns a pointer to of the float64 value passed in.
-func Float64(v float64) *float64 {
- return &v
-}
-
-// Float64Value returns the value of the float64 pointer passed in or
-// 0 if the pointer is nil.
-func Float64Value(v *float64) float64 {
- if v != nil {
- return *v
- }
- return 0
-}
-
-// Float64Slice converts a slice of float64 values into a slice of
-// float64 pointers
-func Float64Slice(src []float64) []*float64 {
- dst := make([]*float64, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// Float64ValueSlice converts a slice of float64 pointers into a slice of
-// float64 values
-func Float64ValueSlice(src []*float64) []float64 {
- dst := make([]float64, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// Float64Map converts a string map of float64 values into a string
-// map of float64 pointers
-func Float64Map(src map[string]float64) map[string]*float64 {
- dst := make(map[string]*float64)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// Float64ValueMap converts a string map of float64 pointers into a string
-// map of float64 values
-func Float64ValueMap(src map[string]*float64) map[string]float64 {
- dst := make(map[string]float64)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Time returns a pointer to of the time.Time value passed in.
-func Time(v time.Time) *time.Time {
- return &v
-}
-
-// TimeValue returns the value of the time.Time pointer passed in or
-// time.Time{} if the pointer is nil.
-func TimeValue(v *time.Time) time.Time {
- if v != nil {
- return *v
- }
- return time.Time{}
-}
-
-// TimeSlice converts a slice of time.Time values into a slice of
-// time.Time pointers
-func TimeSlice(src []time.Time) []*time.Time {
- dst := make([]*time.Time, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// TimeValueSlice converts a slice of time.Time pointers into a slice of
-// time.Time values
-func TimeValueSlice(src []*time.Time) []time.Time {
- dst := make([]time.Time, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// TimeMap converts a string map of time.Time values into a string
-// map of time.Time pointers
-func TimeMap(src map[string]time.Time) map[string]*time.Time {
- dst := make(map[string]*time.Time)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// TimeValueMap converts a string map of time.Time pointers into a string
-// map of time.Time values
-func TimeValueMap(src map[string]*time.Time) map[string]time.Time {
- dst := make(map[string]time.Time)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
diff --git a/vendor/github.com/go-openapi/swag/doc.go b/vendor/github.com/go-openapi/swag/doc.go
deleted file mode 100644
index 55094cb..0000000
--- a/vendor/github.com/go-openapi/swag/doc.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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 swag contains a bunch of helper functions for go-openapi and go-swagger projects.
-
-You may also use it standalone for your projects.
-
- - convert between value and pointers for builtin types
- - convert from string to builtin types (wraps strconv)
- - fast json concatenation
- - search in path
- - load from file or http
- - name mangling
-
-This repo has only few dependencies outside of the standard library:
-
- - YAML utilities depend on gopkg.in/yaml.v2
-*/
-package swag
diff --git a/vendor/github.com/go-openapi/swag/file.go b/vendor/github.com/go-openapi/swag/file.go
deleted file mode 100644
index 16accc5..0000000
--- a/vendor/github.com/go-openapi/swag/file.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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 swag
-
-import "mime/multipart"
-
-// File represents an uploaded file.
-type File struct {
- Data multipart.File
- Header *multipart.FileHeader
-}
-
-// Read bytes from the file
-func (f *File) Read(p []byte) (n int, err error) {
- return f.Data.Read(p)
-}
-
-// Close the file
-func (f *File) Close() error {
- return f.Data.Close()
-}
diff --git a/vendor/github.com/go-openapi/swag/initialism_index.go b/vendor/github.com/go-openapi/swag/initialism_index.go
deleted file mode 100644
index 20a359b..0000000
--- a/vendor/github.com/go-openapi/swag/initialism_index.go
+++ /dev/null
@@ -1,202 +0,0 @@
-// 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 swag
-
-import (
- "sort"
- "strings"
- "sync"
-)
-
-var (
- // commonInitialisms are common acronyms that are kept as whole uppercased words.
- commonInitialisms *indexOfInitialisms
-
- // initialisms is a slice of sorted initialisms
- initialisms []string
-
- // a copy of initialisms pre-baked as []rune
- initialismsRunes [][]rune
- initialismsUpperCased [][]rune
-
- isInitialism func(string) bool
-
- maxAllocMatches int
-)
-
-func init() {
- // Taken from https://github.com/golang/lint/blob/3390df4df2787994aea98de825b964ac7944b817/lint.go#L732-L769
- configuredInitialisms := map[string]bool{
- "ACL": true,
- "API": true,
- "ASCII": true,
- "CPU": true,
- "CSS": true,
- "DNS": true,
- "EOF": true,
- "GUID": true,
- "HTML": true,
- "HTTPS": true,
- "HTTP": true,
- "ID": true,
- "IP": true,
- "IPv4": true,
- "IPv6": true,
- "JSON": true,
- "LHS": true,
- "OAI": true,
- "QPS": true,
- "RAM": true,
- "RHS": true,
- "RPC": true,
- "SLA": true,
- "SMTP": true,
- "SQL": true,
- "SSH": true,
- "TCP": true,
- "TLS": true,
- "TTL": true,
- "UDP": true,
- "UI": true,
- "UID": true,
- "UUID": true,
- "URI": true,
- "URL": true,
- "UTF8": true,
- "VM": true,
- "XML": true,
- "XMPP": true,
- "XSRF": true,
- "XSS": true,
- }
-
- // a thread-safe index of initialisms
- commonInitialisms = newIndexOfInitialisms().load(configuredInitialisms)
- initialisms = commonInitialisms.sorted()
- initialismsRunes = asRunes(initialisms)
- initialismsUpperCased = asUpperCased(initialisms)
- maxAllocMatches = maxAllocHeuristic(initialismsRunes)
-
- // a test function
- isInitialism = commonInitialisms.isInitialism
-}
-
-func asRunes(in []string) [][]rune {
- out := make([][]rune, len(in))
- for i, initialism := range in {
- out[i] = []rune(initialism)
- }
-
- return out
-}
-
-func asUpperCased(in []string) [][]rune {
- out := make([][]rune, len(in))
-
- for i, initialism := range in {
- out[i] = []rune(upper(trim(initialism)))
- }
-
- return out
-}
-
-func maxAllocHeuristic(in [][]rune) int {
- heuristic := make(map[rune]int)
- for _, initialism := range in {
- heuristic[initialism[0]]++
- }
-
- var maxAlloc int
- for _, val := range heuristic {
- if val > maxAlloc {
- maxAlloc = val
- }
- }
-
- return maxAlloc
-}
-
-// AddInitialisms add additional initialisms
-func AddInitialisms(words ...string) {
- for _, word := range words {
- // commonInitialisms[upper(word)] = true
- commonInitialisms.add(upper(word))
- }
- // sort again
- initialisms = commonInitialisms.sorted()
- initialismsRunes = asRunes(initialisms)
- initialismsUpperCased = asUpperCased(initialisms)
-}
-
-// indexOfInitialisms is a thread-safe implementation of the sorted index of initialisms.
-// Since go1.9, this may be implemented with sync.Map.
-type indexOfInitialisms struct {
- sortMutex *sync.Mutex
- index *sync.Map
-}
-
-func newIndexOfInitialisms() *indexOfInitialisms {
- return &indexOfInitialisms{
- sortMutex: new(sync.Mutex),
- index: new(sync.Map),
- }
-}
-
-func (m *indexOfInitialisms) load(initial map[string]bool) *indexOfInitialisms {
- m.sortMutex.Lock()
- defer m.sortMutex.Unlock()
- for k, v := range initial {
- m.index.Store(k, v)
- }
- return m
-}
-
-func (m *indexOfInitialisms) isInitialism(key string) bool {
- _, ok := m.index.Load(key)
- return ok
-}
-
-func (m *indexOfInitialisms) add(key string) *indexOfInitialisms {
- m.index.Store(key, true)
- return m
-}
-
-func (m *indexOfInitialisms) sorted() (result []string) {
- m.sortMutex.Lock()
- defer m.sortMutex.Unlock()
- m.index.Range(func(key, _ interface{}) bool {
- k := key.(string)
- result = append(result, k)
- return true
- })
- sort.Sort(sort.Reverse(byInitialism(result)))
- return
-}
-
-type byInitialism []string
-
-func (s byInitialism) Len() int {
- return len(s)
-}
-func (s byInitialism) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-func (s byInitialism) Less(i, j int) bool {
- if len(s[i]) != len(s[j]) {
- return len(s[i]) < len(s[j])
- }
-
- return strings.Compare(s[i], s[j]) > 0
-}
diff --git a/vendor/github.com/go-openapi/swag/json.go b/vendor/github.com/go-openapi/swag/json.go
deleted file mode 100644
index 7e9902c..0000000
--- a/vendor/github.com/go-openapi/swag/json.go
+++ /dev/null
@@ -1,312 +0,0 @@
-// 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 swag
-
-import (
- "bytes"
- "encoding/json"
- "log"
- "reflect"
- "strings"
- "sync"
-
- "github.com/mailru/easyjson/jlexer"
- "github.com/mailru/easyjson/jwriter"
-)
-
-// nullJSON represents a JSON object with null type
-var nullJSON = []byte("null")
-
-// DefaultJSONNameProvider the default cache for types
-var DefaultJSONNameProvider = NewNameProvider()
-
-const comma = byte(',')
-
-var closers map[byte]byte
-
-func init() {
- closers = map[byte]byte{
- '{': '}',
- '[': ']',
- }
-}
-
-type ejMarshaler interface {
- MarshalEasyJSON(w *jwriter.Writer)
-}
-
-type ejUnmarshaler interface {
- UnmarshalEasyJSON(w *jlexer.Lexer)
-}
-
-// WriteJSON writes json data, prefers finding an appropriate interface to short-circuit the marshaler
-// so it takes the fastest option available.
-func WriteJSON(data interface{}) ([]byte, error) {
- if d, ok := data.(ejMarshaler); ok {
- jw := new(jwriter.Writer)
- d.MarshalEasyJSON(jw)
- return jw.BuildBytes()
- }
- if d, ok := data.(json.Marshaler); ok {
- return d.MarshalJSON()
- }
- return json.Marshal(data)
-}
-
-// ReadJSON reads json data, prefers finding an appropriate interface to short-circuit the unmarshaler
-// so it takes the fastest option available
-func ReadJSON(data []byte, value interface{}) error {
- trimmedData := bytes.Trim(data, "\x00")
- if d, ok := value.(ejUnmarshaler); ok {
- jl := &jlexer.Lexer{Data: trimmedData}
- d.UnmarshalEasyJSON(jl)
- return jl.Error()
- }
- if d, ok := value.(json.Unmarshaler); ok {
- return d.UnmarshalJSON(trimmedData)
- }
- return json.Unmarshal(trimmedData, value)
-}
-
-// DynamicJSONToStruct converts an untyped json structure into a struct
-func DynamicJSONToStruct(data interface{}, target interface{}) error {
- // TODO: convert straight to a json typed map (mergo + iterate?)
- b, err := WriteJSON(data)
- if err != nil {
- return err
- }
- return ReadJSON(b, target)
-}
-
-// ConcatJSON concatenates multiple json objects efficiently
-func ConcatJSON(blobs ...[]byte) []byte {
- if len(blobs) == 0 {
- return nil
- }
-
- last := len(blobs) - 1
- for blobs[last] == nil || bytes.Equal(blobs[last], nullJSON) {
- // strips trailing null objects
- last--
- if last < 0 {
- // there was nothing but "null"s or nil...
- return nil
- }
- }
- if last == 0 {
- return blobs[0]
- }
-
- var opening, closing byte
- var idx, a int
- buf := bytes.NewBuffer(nil)
-
- for i, b := range blobs[:last+1] {
- if b == nil || bytes.Equal(b, nullJSON) {
- // a null object is in the list: skip it
- continue
- }
- if len(b) > 0 && opening == 0 { // is this an array or an object?
- opening, closing = b[0], closers[b[0]]
- }
-
- if opening != '{' && opening != '[' {
- continue // don't know how to concatenate non container objects
- }
-
- if len(b) < 3 { // yep empty but also the last one, so closing this thing
- if i == last && a > 0 {
- if err := buf.WriteByte(closing); err != nil {
- log.Println(err)
- }
- }
- continue
- }
-
- idx = 0
- if a > 0 { // we need to join with a comma for everything beyond the first non-empty item
- if err := buf.WriteByte(comma); err != nil {
- log.Println(err)
- }
- idx = 1 // this is not the first or the last so we want to drop the leading bracket
- }
-
- if i != last { // not the last one, strip brackets
- if _, err := buf.Write(b[idx : len(b)-1]); err != nil {
- log.Println(err)
- }
- } else { // last one, strip only the leading bracket
- if _, err := buf.Write(b[idx:]); err != nil {
- log.Println(err)
- }
- }
- a++
- }
- // somehow it ended up being empty, so provide a default value
- if buf.Len() == 0 {
- if err := buf.WriteByte(opening); err != nil {
- log.Println(err)
- }
- if err := buf.WriteByte(closing); err != nil {
- log.Println(err)
- }
- }
- return buf.Bytes()
-}
-
-// ToDynamicJSON turns an object into a properly JSON typed structure
-func ToDynamicJSON(data interface{}) interface{} {
- // TODO: convert straight to a json typed map (mergo + iterate?)
- b, err := json.Marshal(data)
- if err != nil {
- log.Println(err)
- }
- var res interface{}
- if err := json.Unmarshal(b, &res); err != nil {
- log.Println(err)
- }
- return res
-}
-
-// FromDynamicJSON turns an object into a properly JSON typed structure
-func FromDynamicJSON(data, target interface{}) error {
- b, err := json.Marshal(data)
- if err != nil {
- log.Println(err)
- }
- return json.Unmarshal(b, target)
-}
-
-// NameProvider represents an object capable of translating from go property names
-// to json property names
-// This type is thread-safe.
-type NameProvider struct {
- lock *sync.Mutex
- index map[reflect.Type]nameIndex
-}
-
-type nameIndex struct {
- jsonNames map[string]string
- goNames map[string]string
-}
-
-// NewNameProvider creates a new name provider
-func NewNameProvider() *NameProvider {
- return &NameProvider{
- lock: &sync.Mutex{},
- index: make(map[reflect.Type]nameIndex),
- }
-}
-
-func buildnameIndex(tpe reflect.Type, idx, reverseIdx map[string]string) {
- for i := 0; i < tpe.NumField(); i++ {
- targetDes := tpe.Field(i)
-
- if targetDes.PkgPath != "" { // unexported
- continue
- }
-
- if targetDes.Anonymous { // walk embedded structures tree down first
- buildnameIndex(targetDes.Type, idx, reverseIdx)
- continue
- }
-
- if tag := targetDes.Tag.Get("json"); tag != "" {
-
- parts := strings.Split(tag, ",")
- if len(parts) == 0 {
- continue
- }
-
- nm := parts[0]
- if nm == "-" {
- continue
- }
- if nm == "" { // empty string means we want to use the Go name
- nm = targetDes.Name
- }
-
- idx[nm] = targetDes.Name
- reverseIdx[targetDes.Name] = nm
- }
- }
-}
-
-func newNameIndex(tpe reflect.Type) nameIndex {
- var idx = make(map[string]string, tpe.NumField())
- var reverseIdx = make(map[string]string, tpe.NumField())
-
- buildnameIndex(tpe, idx, reverseIdx)
- return nameIndex{jsonNames: idx, goNames: reverseIdx}
-}
-
-// GetJSONNames gets all the json property names for a type
-func (n *NameProvider) GetJSONNames(subject interface{}) []string {
- n.lock.Lock()
- defer n.lock.Unlock()
- tpe := reflect.Indirect(reflect.ValueOf(subject)).Type()
- names, ok := n.index[tpe]
- if !ok {
- names = n.makeNameIndex(tpe)
- }
-
- res := make([]string, 0, len(names.jsonNames))
- for k := range names.jsonNames {
- res = append(res, k)
- }
- return res
-}
-
-// GetJSONName gets the json name for a go property name
-func (n *NameProvider) GetJSONName(subject interface{}, name string) (string, bool) {
- tpe := reflect.Indirect(reflect.ValueOf(subject)).Type()
- return n.GetJSONNameForType(tpe, name)
-}
-
-// GetJSONNameForType gets the json name for a go property name on a given type
-func (n *NameProvider) GetJSONNameForType(tpe reflect.Type, name string) (string, bool) {
- n.lock.Lock()
- defer n.lock.Unlock()
- names, ok := n.index[tpe]
- if !ok {
- names = n.makeNameIndex(tpe)
- }
- nme, ok := names.goNames[name]
- return nme, ok
-}
-
-func (n *NameProvider) makeNameIndex(tpe reflect.Type) nameIndex {
- names := newNameIndex(tpe)
- n.index[tpe] = names
- return names
-}
-
-// GetGoName gets the go name for a json property name
-func (n *NameProvider) GetGoName(subject interface{}, name string) (string, bool) {
- tpe := reflect.Indirect(reflect.ValueOf(subject)).Type()
- return n.GetGoNameForType(tpe, name)
-}
-
-// GetGoNameForType gets the go name for a given type for a json property name
-func (n *NameProvider) GetGoNameForType(tpe reflect.Type, name string) (string, bool) {
- n.lock.Lock()
- defer n.lock.Unlock()
- names, ok := n.index[tpe]
- if !ok {
- names = n.makeNameIndex(tpe)
- }
- nme, ok := names.jsonNames[name]
- return nme, ok
-}
diff --git a/vendor/github.com/go-openapi/swag/loading.go b/vendor/github.com/go-openapi/swag/loading.go
deleted file mode 100644
index 783442f..0000000
--- a/vendor/github.com/go-openapi/swag/loading.go
+++ /dev/null
@@ -1,176 +0,0 @@
-// 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 swag
-
-import (
- "fmt"
- "io"
- "log"
- "net/http"
- "net/url"
- "os"
- "path"
- "path/filepath"
- "runtime"
- "strings"
- "time"
-)
-
-// LoadHTTPTimeout the default timeout for load requests
-var LoadHTTPTimeout = 30 * time.Second
-
-// LoadHTTPBasicAuthUsername the username to use when load requests require basic auth
-var LoadHTTPBasicAuthUsername = ""
-
-// LoadHTTPBasicAuthPassword the password to use when load requests require basic auth
-var LoadHTTPBasicAuthPassword = ""
-
-// LoadHTTPCustomHeaders an optional collection of custom HTTP headers for load requests
-var LoadHTTPCustomHeaders = map[string]string{}
-
-// LoadFromFileOrHTTP loads the bytes from a file or a remote http server based on the path passed in
-func LoadFromFileOrHTTP(pth string) ([]byte, error) {
- return LoadStrategy(pth, os.ReadFile, loadHTTPBytes(LoadHTTPTimeout))(pth)
-}
-
-// LoadFromFileOrHTTPWithTimeout loads the bytes from a file or a remote http server based on the path passed in
-// timeout arg allows for per request overriding of the request timeout
-func LoadFromFileOrHTTPWithTimeout(pth string, timeout time.Duration) ([]byte, error) {
- return LoadStrategy(pth, os.ReadFile, loadHTTPBytes(timeout))(pth)
-}
-
-// LoadStrategy returns a loader function for a given path or URI.
-//
-// The load strategy returns the remote load for any path starting with `http`.
-// So this works for any URI with a scheme `http` or `https`.
-//
-// The fallback strategy is to call the local loader.
-//
-// The local loader takes a local file system path (absolute or relative) as argument,
-// or alternatively a `file://...` URI, **without host** (see also below for windows).
-//
-// There are a few liberalities, initially intended to be tolerant regarding the URI syntax,
-// especially on windows.
-//
-// Before the local loader is called, the given path is transformed:
-// - percent-encoded characters are unescaped
-// - simple paths (e.g. `./folder/file`) are passed as-is
-// - on windows, occurrences of `/` are replaced by `\`, so providing a relative path such a `folder/file` works too.
-//
-// For paths provided as URIs with the "file" scheme, please note that:
-// - `file://` is simply stripped.
-// This means that the host part of the URI is not parsed at all.
-// For example, `file:///folder/file" becomes "/folder/file`,
-// but `file://localhost/folder/file` becomes `localhost/folder/file` on unix systems.
-// Similarly, `file://./folder/file` yields `./folder/file`.
-// - on windows, `file://...` can take a host so as to specify an UNC share location.
-//
-// Reminder about windows-specifics:
-// - `file://host/folder/file` becomes an UNC path like `\\host\folder\file` (no port specification is supported)
-// - `file:///c:/folder/file` becomes `C:\folder\file`
-// - `file://c:/folder/file` is tolerated (without leading `/`) and becomes `c:\folder\file`
-func LoadStrategy(pth string, local, remote func(string) ([]byte, error)) func(string) ([]byte, error) {
- if strings.HasPrefix(pth, "http") {
- return remote
- }
-
- return func(p string) ([]byte, error) {
- upth, err := url.PathUnescape(p)
- if err != nil {
- return nil, err
- }
-
- if !strings.HasPrefix(p, `file://`) {
- // regular file path provided: just normalize slashes
- return local(filepath.FromSlash(upth))
- }
-
- if runtime.GOOS != "windows" {
- // crude processing: this leaves full URIs with a host with a (mostly) unexpected result
- upth = strings.TrimPrefix(upth, `file://`)
-
- return local(filepath.FromSlash(upth))
- }
-
- // windows-only pre-processing of file://... URIs
-
- // support for canonical file URIs on windows.
- u, err := url.Parse(filepath.ToSlash(upth))
- if err != nil {
- return nil, err
- }
-
- if u.Host != "" {
- // assume UNC name (volume share)
- // NOTE: UNC port not yet supported
-
- // when the "host" segment is a drive letter:
- // file://C:/folder/... => C:\folder
- upth = path.Clean(strings.Join([]string{u.Host, u.Path}, `/`))
- if !strings.HasSuffix(u.Host, ":") && u.Host[0] != '.' {
- // tolerance: if we have a leading dot, this can't be a host
- // file://host/share/folder\... ==> \\host\share\path\folder
- upth = "//" + upth
- }
- } else {
- // no host, let's figure out if this is a drive letter
- upth = strings.TrimPrefix(upth, `file://`)
- first, _, _ := strings.Cut(strings.TrimPrefix(u.Path, "/"), "/")
- if strings.HasSuffix(first, ":") {
- // drive letter in the first segment:
- // file:///c:/folder/... ==> strip the leading slash
- upth = strings.TrimPrefix(upth, `/`)
- }
- }
-
- return local(filepath.FromSlash(upth))
- }
-}
-
-func loadHTTPBytes(timeout time.Duration) func(path string) ([]byte, error) {
- return func(path string) ([]byte, error) {
- client := &http.Client{Timeout: timeout}
- req, err := http.NewRequest(http.MethodGet, path, nil) //nolint:noctx
- if err != nil {
- return nil, err
- }
-
- if LoadHTTPBasicAuthUsername != "" && LoadHTTPBasicAuthPassword != "" {
- req.SetBasicAuth(LoadHTTPBasicAuthUsername, LoadHTTPBasicAuthPassword)
- }
-
- for key, val := range LoadHTTPCustomHeaders {
- req.Header.Set(key, val)
- }
-
- resp, err := client.Do(req)
- defer func() {
- if resp != nil {
- if e := resp.Body.Close(); e != nil {
- log.Println(e)
- }
- }
- }()
- if err != nil {
- return nil, err
- }
-
- if resp.StatusCode != http.StatusOK {
- return nil, fmt.Errorf("could not access document at %q [%s] ", path, resp.Status)
- }
-
- return io.ReadAll(resp.Body)
- }
-}
diff --git a/vendor/github.com/go-openapi/swag/name_lexem.go b/vendor/github.com/go-openapi/swag/name_lexem.go
deleted file mode 100644
index 8bb64ac..0000000
--- a/vendor/github.com/go-openapi/swag/name_lexem.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// 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 swag
-
-import (
- "unicode"
- "unicode/utf8"
-)
-
-type (
- lexemKind uint8
-
- nameLexem struct {
- original string
- matchedInitialism string
- kind lexemKind
- }
-)
-
-const (
- lexemKindCasualName lexemKind = iota
- lexemKindInitialismName
-)
-
-func newInitialismNameLexem(original, matchedInitialism string) nameLexem {
- return nameLexem{
- kind: lexemKindInitialismName,
- original: original,
- matchedInitialism: matchedInitialism,
- }
-}
-
-func newCasualNameLexem(original string) nameLexem {
- return nameLexem{
- kind: lexemKindCasualName,
- original: original,
- }
-}
-
-func (l nameLexem) GetUnsafeGoName() string {
- if l.kind == lexemKindInitialismName {
- return l.matchedInitialism
- }
-
- var (
- first rune
- rest string
- )
-
- for i, orig := range l.original {
- if i == 0 {
- first = orig
- continue
- }
-
- if i > 0 {
- rest = l.original[i:]
- break
- }
- }
-
- if len(l.original) > 1 {
- b := poolOfBuffers.BorrowBuffer(utf8.UTFMax + len(rest))
- defer func() {
- poolOfBuffers.RedeemBuffer(b)
- }()
- b.WriteRune(unicode.ToUpper(first))
- b.WriteString(lower(rest))
- return b.String()
- }
-
- return l.original
-}
-
-func (l nameLexem) GetOriginal() string {
- return l.original
-}
-
-func (l nameLexem) IsInitialism() bool {
- return l.kind == lexemKindInitialismName
-}
diff --git a/vendor/github.com/go-openapi/swag/net.go b/vendor/github.com/go-openapi/swag/net.go
deleted file mode 100644
index 821235f..0000000
--- a/vendor/github.com/go-openapi/swag/net.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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 swag
-
-import (
- "net"
- "strconv"
-)
-
-// SplitHostPort splits a network address into a host and a port.
-// The port is -1 when there is no port to be found
-func SplitHostPort(addr string) (host string, port int, err error) {
- h, p, err := net.SplitHostPort(addr)
- if err != nil {
- return "", -1, err
- }
- if p == "" {
- return "", -1, &net.AddrError{Err: "missing port in address", Addr: addr}
- }
-
- pi, err := strconv.Atoi(p)
- if err != nil {
- return "", -1, err
- }
- return h, pi, nil
-}
diff --git a/vendor/github.com/go-openapi/swag/path.go b/vendor/github.com/go-openapi/swag/path.go
deleted file mode 100644
index 941bd01..0000000
--- a/vendor/github.com/go-openapi/swag/path.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// 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 swag
-
-import (
- "os"
- "path/filepath"
- "runtime"
- "strings"
-)
-
-const (
- // GOPATHKey represents the env key for gopath
- GOPATHKey = "GOPATH"
-)
-
-// FindInSearchPath finds a package in a provided lists of paths
-func FindInSearchPath(searchPath, pkg string) string {
- pathsList := filepath.SplitList(searchPath)
- for _, path := range pathsList {
- if evaluatedPath, err := filepath.EvalSymlinks(filepath.Join(path, "src", pkg)); err == nil {
- if _, err := os.Stat(evaluatedPath); err == nil {
- return evaluatedPath
- }
- }
- }
- return ""
-}
-
-// FindInGoSearchPath finds a package in the $GOPATH:$GOROOT
-func FindInGoSearchPath(pkg string) string {
- return FindInSearchPath(FullGoSearchPath(), pkg)
-}
-
-// FullGoSearchPath gets the search paths for finding packages
-func FullGoSearchPath() string {
- allPaths := os.Getenv(GOPATHKey)
- if allPaths == "" {
- allPaths = filepath.Join(os.Getenv("HOME"), "go")
- }
- if allPaths != "" {
- allPaths = strings.Join([]string{allPaths, runtime.GOROOT()}, ":")
- } else {
- allPaths = runtime.GOROOT()
- }
- return allPaths
-}
diff --git a/vendor/github.com/go-openapi/swag/split.go b/vendor/github.com/go-openapi/swag/split.go
deleted file mode 100644
index 274727a..0000000
--- a/vendor/github.com/go-openapi/swag/split.go
+++ /dev/null
@@ -1,508 +0,0 @@
-// 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 swag
-
-import (
- "bytes"
- "sync"
- "unicode"
- "unicode/utf8"
-)
-
-type (
- splitter struct {
- initialisms []string
- initialismsRunes [][]rune
- initialismsUpperCased [][]rune // initialisms cached in their trimmed, upper-cased version
- postSplitInitialismCheck bool
- }
-
- splitterOption func(*splitter)
-
- initialismMatch struct {
- body []rune
- start, end int
- complete bool
- }
- initialismMatches []initialismMatch
-)
-
-type (
- // memory pools of temporary objects.
- //
- // These are used to recycle temporarily allocated objects
- // and relieve the GC from undue pressure.
-
- matchesPool struct {
- *sync.Pool
- }
-
- buffersPool struct {
- *sync.Pool
- }
-
- lexemsPool struct {
- *sync.Pool
- }
-
- splittersPool struct {
- *sync.Pool
- }
-)
-
-var (
- // poolOfMatches holds temporary slices for recycling during the initialism match process
- poolOfMatches = matchesPool{
- Pool: &sync.Pool{
- New: func() any {
- s := make(initialismMatches, 0, maxAllocMatches)
-
- return &s
- },
- },
- }
-
- poolOfBuffers = buffersPool{
- Pool: &sync.Pool{
- New: func() any {
- return new(bytes.Buffer)
- },
- },
- }
-
- poolOfLexems = lexemsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := make([]nameLexem, 0, maxAllocMatches)
-
- return &s
- },
- },
- }
-
- poolOfSplitters = splittersPool{
- Pool: &sync.Pool{
- New: func() any {
- s := newSplitter()
-
- return &s
- },
- },
- }
-)
-
-// nameReplaceTable finds a word representation for special characters.
-func nameReplaceTable(r rune) (string, bool) {
- switch r {
- case '@':
- return "At ", true
- case '&':
- return "And ", true
- case '|':
- return "Pipe ", true
- case '$':
- return "Dollar ", true
- case '!':
- return "Bang ", true
- case '-':
- return "", true
- case '_':
- return "", true
- default:
- return "", false
- }
-}
-
-// split calls the splitter.
-//
-// Use newSplitter for more control and options
-func split(str string) []string {
- s := poolOfSplitters.BorrowSplitter()
- lexems := s.split(str)
- result := make([]string, 0, len(*lexems))
-
- for _, lexem := range *lexems {
- result = append(result, lexem.GetOriginal())
- }
- poolOfLexems.RedeemLexems(lexems)
- poolOfSplitters.RedeemSplitter(s)
-
- return result
-
-}
-
-func newSplitter(options ...splitterOption) splitter {
- s := splitter{
- postSplitInitialismCheck: false,
- initialisms: initialisms,
- initialismsRunes: initialismsRunes,
- initialismsUpperCased: initialismsUpperCased,
- }
-
- for _, option := range options {
- option(&s)
- }
-
- return s
-}
-
-// withPostSplitInitialismCheck allows to catch initialisms after main split process
-func withPostSplitInitialismCheck(s *splitter) {
- s.postSplitInitialismCheck = true
-}
-
-func (p matchesPool) BorrowMatches() *initialismMatches {
- s := p.Get().(*initialismMatches)
- *s = (*s)[:0] // reset slice, keep allocated capacity
-
- return s
-}
-
-func (p buffersPool) BorrowBuffer(size int) *bytes.Buffer {
- s := p.Get().(*bytes.Buffer)
- s.Reset()
-
- if s.Cap() < size {
- s.Grow(size)
- }
-
- return s
-}
-
-func (p lexemsPool) BorrowLexems() *[]nameLexem {
- s := p.Get().(*[]nameLexem)
- *s = (*s)[:0] // reset slice, keep allocated capacity
-
- return s
-}
-
-func (p splittersPool) BorrowSplitter(options ...splitterOption) *splitter {
- s := p.Get().(*splitter)
- s.postSplitInitialismCheck = false // reset options
- for _, apply := range options {
- apply(s)
- }
-
- return s
-}
-
-func (p matchesPool) RedeemMatches(s *initialismMatches) {
- p.Put(s)
-}
-
-func (p buffersPool) RedeemBuffer(s *bytes.Buffer) {
- p.Put(s)
-}
-
-func (p lexemsPool) RedeemLexems(s *[]nameLexem) {
- p.Put(s)
-}
-
-func (p splittersPool) RedeemSplitter(s *splitter) {
- p.Put(s)
-}
-
-func (m initialismMatch) isZero() bool {
- return m.start == 0 && m.end == 0
-}
-
-func (s splitter) split(name string) *[]nameLexem {
- nameRunes := []rune(name)
- matches := s.gatherInitialismMatches(nameRunes)
- if matches == nil {
- return poolOfLexems.BorrowLexems()
- }
-
- return s.mapMatchesToNameLexems(nameRunes, matches)
-}
-
-func (s splitter) gatherInitialismMatches(nameRunes []rune) *initialismMatches {
- var matches *initialismMatches
-
- for currentRunePosition, currentRune := range nameRunes {
- // recycle these allocations as we loop over runes
- // with such recycling, only 2 slices should be allocated per call
- // instead of o(n).
- newMatches := poolOfMatches.BorrowMatches()
-
- // check current initialism matches
- if matches != nil { // skip first iteration
- for _, match := range *matches {
- if keepCompleteMatch := match.complete; keepCompleteMatch {
- *newMatches = append(*newMatches, match)
- continue
- }
-
- // drop failed match
- currentMatchRune := match.body[currentRunePosition-match.start]
- if currentMatchRune != currentRune {
- continue
- }
-
- // try to complete ongoing match
- if currentRunePosition-match.start == len(match.body)-1 {
- // we are close; the next step is to check the symbol ahead
- // if it is a small letter, then it is not the end of match
- // but beginning of the next word
-
- if currentRunePosition < len(nameRunes)-1 {
- nextRune := nameRunes[currentRunePosition+1]
- if newWord := unicode.IsLower(nextRune); newWord {
- // oh ok, it was the start of a new word
- continue
- }
- }
-
- match.complete = true
- match.end = currentRunePosition
- }
-
- *newMatches = append(*newMatches, match)
- }
- }
-
- // check for new initialism matches
- for i := range s.initialisms {
- initialismRunes := s.initialismsRunes[i]
- if initialismRunes[0] == currentRune {
- *newMatches = append(*newMatches, initialismMatch{
- start: currentRunePosition,
- body: initialismRunes,
- complete: false,
- })
- }
- }
-
- if matches != nil {
- poolOfMatches.RedeemMatches(matches)
- }
- matches = newMatches
- }
-
- // up to the caller to redeem this last slice
- return matches
-}
-
-func (s splitter) mapMatchesToNameLexems(nameRunes []rune, matches *initialismMatches) *[]nameLexem {
- nameLexems := poolOfLexems.BorrowLexems()
-
- var lastAcceptedMatch initialismMatch
- for _, match := range *matches {
- if !match.complete {
- continue
- }
-
- if firstMatch := lastAcceptedMatch.isZero(); firstMatch {
- s.appendBrokenDownCasualString(nameLexems, nameRunes[:match.start])
- *nameLexems = append(*nameLexems, s.breakInitialism(string(match.body)))
-
- lastAcceptedMatch = match
-
- continue
- }
-
- if overlappedMatch := match.start <= lastAcceptedMatch.end; overlappedMatch {
- continue
- }
-
- middle := nameRunes[lastAcceptedMatch.end+1 : match.start]
- s.appendBrokenDownCasualString(nameLexems, middle)
- *nameLexems = append(*nameLexems, s.breakInitialism(string(match.body)))
-
- lastAcceptedMatch = match
- }
-
- // we have not found any accepted matches
- if lastAcceptedMatch.isZero() {
- *nameLexems = (*nameLexems)[:0]
- s.appendBrokenDownCasualString(nameLexems, nameRunes)
- } else if lastAcceptedMatch.end+1 != len(nameRunes) {
- rest := nameRunes[lastAcceptedMatch.end+1:]
- s.appendBrokenDownCasualString(nameLexems, rest)
- }
-
- poolOfMatches.RedeemMatches(matches)
-
- return nameLexems
-}
-
-func (s splitter) breakInitialism(original string) nameLexem {
- return newInitialismNameLexem(original, original)
-}
-
-func (s splitter) appendBrokenDownCasualString(segments *[]nameLexem, str []rune) {
- currentSegment := poolOfBuffers.BorrowBuffer(len(str)) // unlike strings.Builder, bytes.Buffer initial storage can reused
- defer func() {
- poolOfBuffers.RedeemBuffer(currentSegment)
- }()
-
- addCasualNameLexem := func(original string) {
- *segments = append(*segments, newCasualNameLexem(original))
- }
-
- addInitialismNameLexem := func(original, match string) {
- *segments = append(*segments, newInitialismNameLexem(original, match))
- }
-
- var addNameLexem func(string)
- if s.postSplitInitialismCheck {
- addNameLexem = func(original string) {
- for i := range s.initialisms {
- if isEqualFoldIgnoreSpace(s.initialismsUpperCased[i], original) {
- addInitialismNameLexem(original, s.initialisms[i])
-
- return
- }
- }
-
- addCasualNameLexem(original)
- }
- } else {
- addNameLexem = addCasualNameLexem
- }
-
- for _, rn := range str {
- if replace, found := nameReplaceTable(rn); found {
- if currentSegment.Len() > 0 {
- addNameLexem(currentSegment.String())
- currentSegment.Reset()
- }
-
- if replace != "" {
- addNameLexem(replace)
- }
-
- continue
- }
-
- if !unicode.In(rn, unicode.L, unicode.M, unicode.N, unicode.Pc) {
- if currentSegment.Len() > 0 {
- addNameLexem(currentSegment.String())
- currentSegment.Reset()
- }
-
- continue
- }
-
- if unicode.IsUpper(rn) {
- if currentSegment.Len() > 0 {
- addNameLexem(currentSegment.String())
- }
- currentSegment.Reset()
- }
-
- currentSegment.WriteRune(rn)
- }
-
- if currentSegment.Len() > 0 {
- addNameLexem(currentSegment.String())
- }
-}
-
-// isEqualFoldIgnoreSpace is the same as strings.EqualFold, but
-// it ignores leading and trailing blank spaces in the compared
-// string.
-//
-// base is assumed to be composed of upper-cased runes, and be already
-// trimmed.
-//
-// This code is heavily inspired from strings.EqualFold.
-func isEqualFoldIgnoreSpace(base []rune, str string) bool {
- var i, baseIndex int
- // equivalent to b := []byte(str), but without data copy
- b := hackStringBytes(str)
-
- for i < len(b) {
- if c := b[i]; c < utf8.RuneSelf {
- // fast path for ASCII
- if c != ' ' && c != '\t' {
- break
- }
- i++
-
- continue
- }
-
- // unicode case
- r, size := utf8.DecodeRune(b[i:])
- if !unicode.IsSpace(r) {
- break
- }
- i += size
- }
-
- if i >= len(b) {
- return len(base) == 0
- }
-
- for _, baseRune := range base {
- if i >= len(b) {
- break
- }
-
- if c := b[i]; c < utf8.RuneSelf {
- // single byte rune case (ASCII)
- if baseRune >= utf8.RuneSelf {
- return false
- }
-
- baseChar := byte(baseRune)
- if c != baseChar &&
- !('a' <= c && c <= 'z' && c-'a'+'A' == baseChar) {
- return false
- }
-
- baseIndex++
- i++
-
- continue
- }
-
- // unicode case
- r, size := utf8.DecodeRune(b[i:])
- if unicode.ToUpper(r) != baseRune {
- return false
- }
- baseIndex++
- i += size
- }
-
- if baseIndex != len(base) {
- return false
- }
-
- // all passed: now we should only have blanks
- for i < len(b) {
- if c := b[i]; c < utf8.RuneSelf {
- // fast path for ASCII
- if c != ' ' && c != '\t' {
- return false
- }
- i++
-
- continue
- }
-
- // unicode case
- r, size := utf8.DecodeRune(b[i:])
- if !unicode.IsSpace(r) {
- return false
- }
-
- i += size
- }
-
- return true
-}
diff --git a/vendor/github.com/go-openapi/swag/string_bytes.go b/vendor/github.com/go-openapi/swag/string_bytes.go
deleted file mode 100644
index 90745d5..0000000
--- a/vendor/github.com/go-openapi/swag/string_bytes.go
+++ /dev/null
@@ -1,8 +0,0 @@
-package swag
-
-import "unsafe"
-
-// hackStringBytes returns the (unsafe) underlying bytes slice of a string.
-func hackStringBytes(str string) []byte {
- return unsafe.Slice(unsafe.StringData(str), len(str))
-}
diff --git a/vendor/github.com/go-openapi/swag/util.go b/vendor/github.com/go-openapi/swag/util.go
deleted file mode 100644
index 5051401..0000000
--- a/vendor/github.com/go-openapi/swag/util.go
+++ /dev/null
@@ -1,364 +0,0 @@
-// 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 swag
-
-import (
- "reflect"
- "strings"
- "unicode"
- "unicode/utf8"
-)
-
-// GoNamePrefixFunc sets an optional rule to prefix go names
-// which do not start with a letter.
-//
-// The prefix function is assumed to return a string that starts with an upper case letter.
-//
-// e.g. to help convert "123" into "{prefix}123"
-//
-// The default is to prefix with "X"
-var GoNamePrefixFunc func(string) string
-
-func prefixFunc(name, in string) string {
- if GoNamePrefixFunc == nil {
- return "X" + in
- }
-
- return GoNamePrefixFunc(name) + in
-}
-
-const (
- // collectionFormatComma = "csv"
- collectionFormatSpace = "ssv"
- collectionFormatTab = "tsv"
- collectionFormatPipe = "pipes"
- collectionFormatMulti = "multi"
-)
-
-// JoinByFormat joins a string array by a known format (e.g. swagger's collectionFormat attribute):
-//
-// ssv: space separated value
-// tsv: tab separated value
-// pipes: pipe (|) separated value
-// csv: comma separated value (default)
-func JoinByFormat(data []string, format string) []string {
- if len(data) == 0 {
- return data
- }
- var sep string
- switch format {
- case collectionFormatSpace:
- sep = " "
- case collectionFormatTab:
- sep = "\t"
- case collectionFormatPipe:
- sep = "|"
- case collectionFormatMulti:
- return data
- default:
- sep = ","
- }
- return []string{strings.Join(data, sep)}
-}
-
-// SplitByFormat splits a string by a known format:
-//
-// ssv: space separated value
-// tsv: tab separated value
-// pipes: pipe (|) separated value
-// csv: comma separated value (default)
-func SplitByFormat(data, format string) []string {
- if data == "" {
- return nil
- }
- var sep string
- switch format {
- case collectionFormatSpace:
- sep = " "
- case collectionFormatTab:
- sep = "\t"
- case collectionFormatPipe:
- sep = "|"
- case collectionFormatMulti:
- return nil
- default:
- sep = ","
- }
- var result []string
- for _, s := range strings.Split(data, sep) {
- if ts := strings.TrimSpace(s); ts != "" {
- result = append(result, ts)
- }
- }
- return result
-}
-
-// Removes leading whitespaces
-func trim(str string) string {
- return strings.TrimSpace(str)
-}
-
-// Shortcut to strings.ToUpper()
-func upper(str string) string {
- return strings.ToUpper(trim(str))
-}
-
-// Shortcut to strings.ToLower()
-func lower(str string) string {
- return strings.ToLower(trim(str))
-}
-
-// Camelize an uppercased word
-func Camelize(word string) string {
- camelized := poolOfBuffers.BorrowBuffer(len(word))
- defer func() {
- poolOfBuffers.RedeemBuffer(camelized)
- }()
-
- for pos, ru := range []rune(word) {
- if pos > 0 {
- camelized.WriteRune(unicode.ToLower(ru))
- } else {
- camelized.WriteRune(unicode.ToUpper(ru))
- }
- }
- return camelized.String()
-}
-
-// ToFileName lowercases and underscores a go type name
-func ToFileName(name string) string {
- in := split(name)
- out := make([]string, 0, len(in))
-
- for _, w := range in {
- out = append(out, lower(w))
- }
-
- return strings.Join(out, "_")
-}
-
-// ToCommandName lowercases and underscores a go type name
-func ToCommandName(name string) string {
- in := split(name)
- out := make([]string, 0, len(in))
-
- for _, w := range in {
- out = append(out, lower(w))
- }
- return strings.Join(out, "-")
-}
-
-// ToHumanNameLower represents a code name as a human series of words
-func ToHumanNameLower(name string) string {
- s := poolOfSplitters.BorrowSplitter(withPostSplitInitialismCheck)
- in := s.split(name)
- poolOfSplitters.RedeemSplitter(s)
- out := make([]string, 0, len(*in))
-
- for _, w := range *in {
- if !w.IsInitialism() {
- out = append(out, lower(w.GetOriginal()))
- } else {
- out = append(out, trim(w.GetOriginal()))
- }
- }
- poolOfLexems.RedeemLexems(in)
-
- return strings.Join(out, " ")
-}
-
-// ToHumanNameTitle represents a code name as a human series of words with the first letters titleized
-func ToHumanNameTitle(name string) string {
- s := poolOfSplitters.BorrowSplitter(withPostSplitInitialismCheck)
- in := s.split(name)
- poolOfSplitters.RedeemSplitter(s)
-
- out := make([]string, 0, len(*in))
- for _, w := range *in {
- original := trim(w.GetOriginal())
- if !w.IsInitialism() {
- out = append(out, Camelize(original))
- } else {
- out = append(out, original)
- }
- }
- poolOfLexems.RedeemLexems(in)
-
- return strings.Join(out, " ")
-}
-
-// ToJSONName camelcases a name which can be underscored or pascal cased
-func ToJSONName(name string) string {
- in := split(name)
- out := make([]string, 0, len(in))
-
- for i, w := range in {
- if i == 0 {
- out = append(out, lower(w))
- continue
- }
- out = append(out, Camelize(trim(w)))
- }
- return strings.Join(out, "")
-}
-
-// ToVarName camelcases a name which can be underscored or pascal cased
-func ToVarName(name string) string {
- res := ToGoName(name)
- if isInitialism(res) {
- return lower(res)
- }
- if len(res) <= 1 {
- return lower(res)
- }
- return lower(res[:1]) + res[1:]
-}
-
-// ToGoName translates a swagger name which can be underscored or camel cased to a name that golint likes
-func ToGoName(name string) string {
- s := poolOfSplitters.BorrowSplitter(withPostSplitInitialismCheck)
- lexems := s.split(name)
- poolOfSplitters.RedeemSplitter(s)
- defer func() {
- poolOfLexems.RedeemLexems(lexems)
- }()
- lexemes := *lexems
-
- if len(lexemes) == 0 {
- return ""
- }
-
- result := poolOfBuffers.BorrowBuffer(len(name))
- defer func() {
- poolOfBuffers.RedeemBuffer(result)
- }()
-
- // check if not starting with a letter, upper case
- firstPart := lexemes[0].GetUnsafeGoName()
- if lexemes[0].IsInitialism() {
- firstPart = upper(firstPart)
- }
-
- if c := firstPart[0]; c < utf8.RuneSelf {
- // ASCII
- switch {
- case 'A' <= c && c <= 'Z':
- result.WriteString(firstPart)
- case 'a' <= c && c <= 'z':
- result.WriteByte(c - 'a' + 'A')
- result.WriteString(firstPart[1:])
- default:
- result.WriteString(prefixFunc(name, firstPart))
- // NOTE: no longer check if prefixFunc returns a string that starts with uppercase:
- // assume this is always the case
- }
- } else {
- // unicode
- firstRune, _ := utf8.DecodeRuneInString(firstPart)
- switch {
- case !unicode.IsLetter(firstRune):
- result.WriteString(prefixFunc(name, firstPart))
- case !unicode.IsUpper(firstRune):
- result.WriteString(prefixFunc(name, firstPart))
- /*
- result.WriteRune(unicode.ToUpper(firstRune))
- result.WriteString(firstPart[offset:])
- */
- default:
- result.WriteString(firstPart)
- }
- }
-
- for _, lexem := range lexemes[1:] {
- goName := lexem.GetUnsafeGoName()
-
- // to support old behavior
- if lexem.IsInitialism() {
- goName = upper(goName)
- }
- result.WriteString(goName)
- }
-
- return result.String()
-}
-
-// ContainsStrings searches a slice of strings for a case-sensitive match
-func ContainsStrings(coll []string, item string) bool {
- for _, a := range coll {
- if a == item {
- return true
- }
- }
- return false
-}
-
-// ContainsStringsCI searches a slice of strings for a case-insensitive match
-func ContainsStringsCI(coll []string, item string) bool {
- for _, a := range coll {
- if strings.EqualFold(a, item) {
- return true
- }
- }
- return false
-}
-
-type zeroable interface {
- IsZero() bool
-}
-
-// IsZero returns true when the value passed into the function is a zero value.
-// This allows for safer checking of interface values.
-func IsZero(data interface{}) bool {
- v := reflect.ValueOf(data)
- // check for nil data
- switch v.Kind() { //nolint:exhaustive
- case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
- if v.IsNil() {
- return true
- }
- }
-
- // check for things that have an IsZero method instead
- if vv, ok := data.(zeroable); ok {
- return vv.IsZero()
- }
-
- // continue with slightly more complex reflection
- switch v.Kind() { //nolint:exhaustive
- case reflect.String:
- return v.Len() == 0
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.Struct, reflect.Array:
- return reflect.DeepEqual(data, reflect.Zero(v.Type()).Interface())
- case reflect.Invalid:
- return true
- default:
- return false
- }
-}
-
-// CommandLineOptionsGroup represents a group of user-defined command line options
-type CommandLineOptionsGroup struct {
- ShortDescription string
- LongDescription string
- Options interface{}
-}
diff --git a/vendor/github.com/go-openapi/swag/yaml.go b/vendor/github.com/go-openapi/swag/yaml.go
deleted file mode 100644
index f59e025..0000000
--- a/vendor/github.com/go-openapi/swag/yaml.go
+++ /dev/null
@@ -1,481 +0,0 @@
-// 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 swag
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "path/filepath"
- "reflect"
- "sort"
- "strconv"
-
- "github.com/mailru/easyjson/jlexer"
- "github.com/mailru/easyjson/jwriter"
- yaml "gopkg.in/yaml.v3"
-)
-
-// YAMLMatcher matches yaml
-func YAMLMatcher(path string) bool {
- ext := filepath.Ext(path)
- return ext == ".yaml" || ext == ".yml"
-}
-
-// YAMLToJSON converts YAML unmarshaled data into json compatible data
-func YAMLToJSON(data interface{}) (json.RawMessage, error) {
- jm, err := transformData(data)
- if err != nil {
- return nil, err
- }
- b, err := WriteJSON(jm)
- return json.RawMessage(b), err
-}
-
-// BytesToYAMLDoc converts a byte slice into a YAML document
-func BytesToYAMLDoc(data []byte) (interface{}, error) {
- var document yaml.Node // preserve order that is present in the document
- if err := yaml.Unmarshal(data, &document); err != nil {
- return nil, err
- }
- if document.Kind != yaml.DocumentNode || len(document.Content) != 1 || document.Content[0].Kind != yaml.MappingNode {
- return nil, errors.New("only YAML documents that are objects are supported")
- }
- return &document, nil
-}
-
-func yamlNode(root *yaml.Node) (interface{}, error) {
- switch root.Kind {
- case yaml.DocumentNode:
- return yamlDocument(root)
- case yaml.SequenceNode:
- return yamlSequence(root)
- case yaml.MappingNode:
- return yamlMapping(root)
- case yaml.ScalarNode:
- return yamlScalar(root)
- case yaml.AliasNode:
- return yamlNode(root.Alias)
- default:
- return nil, fmt.Errorf("unsupported YAML node type: %v", root.Kind)
- }
-}
-
-func yamlDocument(node *yaml.Node) (interface{}, error) {
- if len(node.Content) != 1 {
- return nil, fmt.Errorf("unexpected YAML Document node content length: %d", len(node.Content))
- }
- return yamlNode(node.Content[0])
-}
-
-func yamlMapping(node *yaml.Node) (interface{}, error) {
- m := make(JSONMapSlice, len(node.Content)/2)
-
- var j int
- for i := 0; i < len(node.Content); i += 2 {
- var nmi JSONMapItem
- k, err := yamlStringScalarC(node.Content[i])
- if err != nil {
- return nil, fmt.Errorf("unable to decode YAML map key: %w", err)
- }
- nmi.Key = k
- v, err := yamlNode(node.Content[i+1])
- if err != nil {
- return nil, fmt.Errorf("unable to process YAML map value for key %q: %w", k, err)
- }
- nmi.Value = v
- m[j] = nmi
- j++
- }
- return m, nil
-}
-
-func yamlSequence(node *yaml.Node) (interface{}, error) {
- s := make([]interface{}, 0)
-
- for i := 0; i < len(node.Content); i++ {
-
- v, err := yamlNode(node.Content[i])
- if err != nil {
- return nil, fmt.Errorf("unable to decode YAML sequence value: %w", err)
- }
- s = append(s, v)
- }
- return s, nil
-}
-
-const ( // See https://yaml.org/type/
- yamlStringScalar = "tag:yaml.org,2002:str"
- yamlIntScalar = "tag:yaml.org,2002:int"
- yamlBoolScalar = "tag:yaml.org,2002:bool"
- yamlFloatScalar = "tag:yaml.org,2002:float"
- yamlTimestamp = "tag:yaml.org,2002:timestamp"
- yamlNull = "tag:yaml.org,2002:null"
-)
-
-func yamlScalar(node *yaml.Node) (interface{}, error) {
- switch node.LongTag() {
- case yamlStringScalar:
- return node.Value, nil
- case yamlBoolScalar:
- b, err := strconv.ParseBool(node.Value)
- if err != nil {
- return nil, fmt.Errorf("unable to process scalar node. Got %q. Expecting bool content: %w", node.Value, err)
- }
- return b, nil
- case yamlIntScalar:
- i, err := strconv.ParseInt(node.Value, 10, 64)
- if err != nil {
- return nil, fmt.Errorf("unable to process scalar node. Got %q. Expecting integer content: %w", node.Value, err)
- }
- return i, nil
- case yamlFloatScalar:
- f, err := strconv.ParseFloat(node.Value, 64)
- if err != nil {
- return nil, fmt.Errorf("unable to process scalar node. Got %q. Expecting float content: %w", node.Value, err)
- }
- return f, nil
- case yamlTimestamp:
- return node.Value, nil
- case yamlNull:
- return nil, nil //nolint:nilnil
- default:
- return nil, fmt.Errorf("YAML tag %q is not supported", node.LongTag())
- }
-}
-
-func yamlStringScalarC(node *yaml.Node) (string, error) {
- if node.Kind != yaml.ScalarNode {
- return "", fmt.Errorf("expecting a string scalar but got %q", node.Kind)
- }
- switch node.LongTag() {
- case yamlStringScalar, yamlIntScalar, yamlFloatScalar:
- return node.Value, nil
- default:
- return "", fmt.Errorf("YAML tag %q is not supported as map key", node.LongTag())
- }
-}
-
-// JSONMapSlice represent a JSON object, with the order of keys maintained
-type JSONMapSlice []JSONMapItem
-
-// MarshalJSON renders a JSONMapSlice as JSON
-func (s JSONMapSlice) MarshalJSON() ([]byte, error) {
- w := &jwriter.Writer{Flags: jwriter.NilMapAsEmpty | jwriter.NilSliceAsEmpty}
- s.MarshalEasyJSON(w)
- return w.BuildBytes()
-}
-
-// MarshalEasyJSON renders a JSONMapSlice as JSON, using easyJSON
-func (s JSONMapSlice) MarshalEasyJSON(w *jwriter.Writer) {
- w.RawByte('{')
-
- ln := len(s)
- last := ln - 1
- for i := 0; i < ln; i++ {
- s[i].MarshalEasyJSON(w)
- if i != last { // last item
- w.RawByte(',')
- }
- }
-
- w.RawByte('}')
-}
-
-// UnmarshalJSON makes a JSONMapSlice from JSON
-func (s *JSONMapSlice) UnmarshalJSON(data []byte) error {
- l := jlexer.Lexer{Data: data}
- s.UnmarshalEasyJSON(&l)
- return l.Error()
-}
-
-// UnmarshalEasyJSON makes a JSONMapSlice from JSON, using easyJSON
-func (s *JSONMapSlice) UnmarshalEasyJSON(in *jlexer.Lexer) {
- if in.IsNull() {
- in.Skip()
- return
- }
-
- var result JSONMapSlice
- in.Delim('{')
- for !in.IsDelim('}') {
- var mi JSONMapItem
- mi.UnmarshalEasyJSON(in)
- result = append(result, mi)
- }
- *s = result
-}
-
-func (s JSONMapSlice) MarshalYAML() (interface{}, error) {
- var n yaml.Node
- n.Kind = yaml.DocumentNode
- var nodes []*yaml.Node
- for _, item := range s {
- nn, err := json2yaml(item.Value)
- if err != nil {
- return nil, err
- }
- ns := []*yaml.Node{
- {
- Kind: yaml.ScalarNode,
- Tag: yamlStringScalar,
- Value: item.Key,
- },
- nn,
- }
- nodes = append(nodes, ns...)
- }
-
- n.Content = []*yaml.Node{
- {
- Kind: yaml.MappingNode,
- Content: nodes,
- },
- }
-
- return yaml.Marshal(&n)
-}
-
-func isNil(input interface{}) bool {
- if input == nil {
- return true
- }
- kind := reflect.TypeOf(input).Kind()
- switch kind { //nolint:exhaustive
- case reflect.Ptr, reflect.Map, reflect.Slice, reflect.Chan:
- return reflect.ValueOf(input).IsNil()
- default:
- return false
- }
-}
-
-func json2yaml(item interface{}) (*yaml.Node, error) {
- if isNil(item) {
- return &yaml.Node{
- Kind: yaml.ScalarNode,
- Value: "null",
- }, nil
- }
-
- switch val := item.(type) {
- case JSONMapSlice:
- var n yaml.Node
- n.Kind = yaml.MappingNode
- for i := range val {
- childNode, err := json2yaml(&val[i].Value)
- if err != nil {
- return nil, err
- }
- n.Content = append(n.Content, &yaml.Node{
- Kind: yaml.ScalarNode,
- Tag: yamlStringScalar,
- Value: val[i].Key,
- }, childNode)
- }
- return &n, nil
- case map[string]interface{}:
- var n yaml.Node
- n.Kind = yaml.MappingNode
- keys := make([]string, 0, len(val))
- for k := range val {
- keys = append(keys, k)
- }
- sort.Strings(keys)
-
- for _, k := range keys {
- v := val[k]
- childNode, err := json2yaml(v)
- if err != nil {
- return nil, err
- }
- n.Content = append(n.Content, &yaml.Node{
- Kind: yaml.ScalarNode,
- Tag: yamlStringScalar,
- Value: k,
- }, childNode)
- }
- return &n, nil
- case []interface{}:
- var n yaml.Node
- n.Kind = yaml.SequenceNode
- for i := range val {
- childNode, err := json2yaml(val[i])
- if err != nil {
- return nil, err
- }
- n.Content = append(n.Content, childNode)
- }
- return &n, nil
- case string:
- return &yaml.Node{
- Kind: yaml.ScalarNode,
- Tag: yamlStringScalar,
- Value: val,
- }, nil
- case float64:
- return &yaml.Node{
- Kind: yaml.ScalarNode,
- Tag: yamlFloatScalar,
- Value: strconv.FormatFloat(val, 'f', -1, 64),
- }, nil
- case int64:
- return &yaml.Node{
- Kind: yaml.ScalarNode,
- Tag: yamlIntScalar,
- Value: strconv.FormatInt(val, 10),
- }, nil
- case uint64:
- return &yaml.Node{
- Kind: yaml.ScalarNode,
- Tag: yamlIntScalar,
- Value: strconv.FormatUint(val, 10),
- }, nil
- case bool:
- return &yaml.Node{
- Kind: yaml.ScalarNode,
- Tag: yamlBoolScalar,
- Value: strconv.FormatBool(val),
- }, nil
- default:
- return nil, fmt.Errorf("unhandled type: %T", val)
- }
-}
-
-// JSONMapItem represents the value of a key in a JSON object held by JSONMapSlice
-type JSONMapItem struct {
- Key string
- Value interface{}
-}
-
-// MarshalJSON renders a JSONMapItem as JSON
-func (s JSONMapItem) MarshalJSON() ([]byte, error) {
- w := &jwriter.Writer{Flags: jwriter.NilMapAsEmpty | jwriter.NilSliceAsEmpty}
- s.MarshalEasyJSON(w)
- return w.BuildBytes()
-}
-
-// MarshalEasyJSON renders a JSONMapItem as JSON, using easyJSON
-func (s JSONMapItem) MarshalEasyJSON(w *jwriter.Writer) {
- w.String(s.Key)
- w.RawByte(':')
- w.Raw(WriteJSON(s.Value))
-}
-
-// UnmarshalJSON makes a JSONMapItem from JSON
-func (s *JSONMapItem) UnmarshalJSON(data []byte) error {
- l := jlexer.Lexer{Data: data}
- s.UnmarshalEasyJSON(&l)
- return l.Error()
-}
-
-// UnmarshalEasyJSON makes a JSONMapItem from JSON, using easyJSON
-func (s *JSONMapItem) UnmarshalEasyJSON(in *jlexer.Lexer) {
- key := in.UnsafeString()
- in.WantColon()
- value := in.Interface()
- in.WantComma()
- s.Key = key
- s.Value = value
-}
-
-func transformData(input interface{}) (out interface{}, err error) {
- format := func(t interface{}) (string, error) {
- switch k := t.(type) {
- case string:
- return k, nil
- case uint:
- return strconv.FormatUint(uint64(k), 10), nil
- case uint8:
- return strconv.FormatUint(uint64(k), 10), nil
- case uint16:
- return strconv.FormatUint(uint64(k), 10), nil
- case uint32:
- return strconv.FormatUint(uint64(k), 10), nil
- case uint64:
- return strconv.FormatUint(k, 10), nil
- case int:
- return strconv.Itoa(k), nil
- case int8:
- return strconv.FormatInt(int64(k), 10), nil
- case int16:
- return strconv.FormatInt(int64(k), 10), nil
- case int32:
- return strconv.FormatInt(int64(k), 10), nil
- case int64:
- return strconv.FormatInt(k, 10), nil
- default:
- return "", fmt.Errorf("unexpected map key type, got: %T", k)
- }
- }
-
- switch in := input.(type) {
- case yaml.Node:
- return yamlNode(&in)
- case *yaml.Node:
- return yamlNode(in)
- case map[interface{}]interface{}:
- o := make(JSONMapSlice, 0, len(in))
- for ke, va := range in {
- var nmi JSONMapItem
- if nmi.Key, err = format(ke); err != nil {
- return nil, err
- }
-
- v, ert := transformData(va)
- if ert != nil {
- return nil, ert
- }
- nmi.Value = v
- o = append(o, nmi)
- }
- return o, nil
- case []interface{}:
- len1 := len(in)
- o := make([]interface{}, len1)
- for i := 0; i < len1; i++ {
- o[i], err = transformData(in[i])
- if err != nil {
- return nil, err
- }
- }
- return o, nil
- }
- return input, nil
-}
-
-// YAMLDoc loads a yaml document from either http or a file and converts it to json
-func YAMLDoc(path string) (json.RawMessage, error) {
- yamlDoc, err := YAMLData(path)
- if err != nil {
- return nil, err
- }
-
- data, err := YAMLToJSON(yamlDoc)
- if err != nil {
- return nil, err
- }
-
- return data, nil
-}
-
-// YAMLData loads a yaml document from either http or a file
-func YAMLData(path string) (interface{}, error) {
- data, err := LoadFromFileOrHTTP(path)
- if err != nil {
- return nil, err
- }
-
- return BytesToYAMLDoc(data)
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/.gitignore b/vendor/github.com/go-ozzo/ozzo-validation/.gitignore
deleted file mode 100644
index 5a3865c..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/.gitignore
+++ /dev/null
@@ -1,25 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
-.DS_Store
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/.travis.yml b/vendor/github.com/go-ozzo/ozzo-validation/.travis.yml
deleted file mode 100644
index fc2af59..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/.travis.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-language: go
-
-go:
- - 1.8
- - 1.9
- - tip
-
-install:
- - go get golang.org/x/tools/cmd/cover
- - go get github.com/mattn/goveralls
- - go list -f '{{range .Imports}}{{.}} {{end}}' ./... | xargs go get -v
- - go list -f '{{range .TestImports}}{{.}} {{end}}' ./... | xargs go get -v
-
-script:
- - go test -v -covermode=count -coverprofile=coverage.out
- - $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/LICENSE b/vendor/github.com/go-ozzo/ozzo-validation/LICENSE
deleted file mode 100644
index d235be9..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/LICENSE
+++ /dev/null
@@ -1,17 +0,0 @@
-The MIT License (MIT)
-Copyright (c) 2016, Qiang Xue
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software
-and associated documentation files (the "Software"), to deal in the Software without restriction,
-including without limitation the rights to use, copy, modify, merge, publish, distribute,
-sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
-is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or
-substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
-BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/README.md b/vendor/github.com/go-ozzo/ozzo-validation/README.md
deleted file mode 100644
index 2f74a1d..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/README.md
+++ /dev/null
@@ -1,585 +0,0 @@
-# ozzo-validation
-
-[![GoDoc](https://godoc.org/github.com/go-ozzo/ozzo-validation?status.png)](http://godoc.org/github.com/go-ozzo/ozzo-validation)
-[![Build Status](https://travis-ci.org/go-ozzo/ozzo-validation.svg?branch=master)](https://travis-ci.org/go-ozzo/ozzo-validation)
-[![Coverage Status](https://coveralls.io/repos/github/go-ozzo/ozzo-validation/badge.svg?branch=master)](https://coveralls.io/github/go-ozzo/ozzo-validation?branch=master)
-[![Go Report](https://goreportcard.com/badge/github.com/go-ozzo/ozzo-validation)](https://goreportcard.com/report/github.com/go-ozzo/ozzo-validation)
-
-## Description
-
-ozzo-validation is a Go package that provides configurable and extensible data validation capabilities.
-It has the following features:
-
-* use normal programming constructs rather than error-prone struct tags to specify how data should be validated.
-* can validate data of different types, e.g., structs, strings, byte slices, slices, maps, arrays.
-* can validate custom data types as long as they implement the `Validatable` interface.
-* can validate data types that implement the `sql.Valuer` interface (e.g. `sql.NullString`).
-* customizable and well-formatted validation errors.
-* provide a rich set of validation rules right out of box.
-* extremely easy to create and use custom validation rules.
-
-
-## Requirements
-
-Go 1.8 or above.
-
-
-## Getting Started
-
-The ozzo-validation package mainly includes a set of validation rules and two validation methods. You use
-validation rules to describe how a value should be considered valid, and you call either `validation.Validate()`
-or `validation.ValidateStruct()` to validate the value.
-
-
-### Installation
-
-Run the following command to install the package:
-
-```
-go get github.com/go-ozzo/ozzo-validation
-go get github.com/go-ozzo/ozzo-validation/is
-```
-
-### Validating a Simple Value
-
-For a simple value, such as a string or an integer, you may use `validation.Validate()` to validate it. For example,
-
-```go
-package main
-
-import (
- "fmt"
-
- "github.com/go-ozzo/ozzo-validation"
- "github.com/go-ozzo/ozzo-validation/is"
-)
-
-func main() {
- data := "example"
- err := validation.Validate(data,
- validation.Required, // not empty
- validation.Length(5, 100), // length between 5 and 100
- is.URL, // is a valid URL
- )
- fmt.Println(err)
- // Output:
- // must be a valid URL
-}
-```
-
-The method `validation.Validate()` will run through the rules in the order that they are listed. If a rule fails
-the validation, the method will return the corresponding error and skip the rest of the rules. The method will
-return nil if the value passes all validation rules.
-
-
-### Validating a Struct
-
-For a struct value, you usually want to check if its fields are valid. For example, in a RESTful application, you
-may unmarshal the request payload into a struct and then validate the struct fields. If one or multiple fields
-are invalid, you may want to get an error describing which fields are invalid. You can use `validation.ValidateStruct()`
-to achieve this purpose. A single struct can have rules for multiple fields, and a field can be associated with multiple
-rules. For example,
-
-```go
-package main
-
-import (
- "fmt"
- "regexp"
-
- "github.com/go-ozzo/ozzo-validation"
- "github.com/go-ozzo/ozzo-validation/is"
-)
-
-type Address struct {
- Street string
- City string
- State string
- Zip string
-}
-
-func (a Address) Validate() error {
- return validation.ValidateStruct(&a,
- // Street cannot be empty, and the length must between 5 and 50
- validation.Field(&a.Street, validation.Required, validation.Length(5, 50)),
- // City cannot be empty, and the length must between 5 and 50
- validation.Field(&a.City, validation.Required, validation.Length(5, 50)),
- // State cannot be empty, and must be a string consisting of two letters in upper case
- validation.Field(&a.State, validation.Required, validation.Match(regexp.MustCompile("^[A-Z]{2}$"))),
- // State cannot be empty, and must be a string consisting of five digits
- validation.Field(&a.Zip, validation.Required, validation.Match(regexp.MustCompile("^[0-9]{5}$"))),
- )
-}
-
-func main() {
- a := Address{
- Street: "123",
- City: "Unknown",
- State: "Virginia",
- Zip: "12345",
- }
-
- err := a.Validate()
- fmt.Println(err)
- // Output:
- // Street: the length must be between 5 and 50; State: must be in a valid format.
-}
-```
-
-Note that when calling `validation.ValidateStruct` to validate a struct, you should pass to the method a pointer
-to the struct instead of the struct itself. Similarly, when calling `validation.Field` to specify the rules
-for a struct field, you should use a pointer to the struct field.
-
-When the struct validation is performed, the fields are validated in the order they are specified in `ValidateStruct`.
-And when each field is validated, its rules are also evaluated in the order they are associated with the field.
-If a rule fails, an error is recorded for that field, and the validation will continue with the next field.
-
-
-### Validation Errors
-
-The `validation.ValidateStruct` method returns validation errors found in struct fields in terms of `validation.Errors`
-which is a map of fields and their corresponding errors. Nil is returned if validation passes.
-
-By default, `validation.Errors` uses the struct tags named `json` to determine what names should be used to
-represent the invalid fields. The type also implements the `json.Marshaler` interface so that it can be marshaled
-into a proper JSON object. For example,
-
-```go
-type Address struct {
- Street string `json:"street"`
- City string `json:"city"`
- State string `json:"state"`
- Zip string `json:"zip"`
-}
-
-// ...perform validation here...
-
-err := a.Validate()
-b, _ := json.Marshal(err)
-fmt.Println(string(b))
-// Output:
-// {"street":"the length must be between 5 and 50","state":"must be in a valid format"}
-```
-
-You may modify `validation.ErrorTag` to use a different struct tag name.
-
-If you do not like the magic that `ValidateStruct` determines error keys based on struct field names or corresponding
-tag values, you may use the following alternative approach:
-
-```go
-c := Customer{
- Name: "Qiang Xue",
- Email: "q",
- Address: Address{
- State: "Virginia",
- },
-}
-
-err := validation.Errors{
- "name": validation.Validate(c.Name, validation.Required, validation.Length(5, 20)),
- "email": validation.Validate(c.Name, validation.Required, is.Email),
- "zip": validation.Validate(c.Address.Zip, validation.Required, validation.Match(regexp.MustCompile("^[0-9]{5}$"))),
-}.Filter()
-fmt.Println(err)
-// Output:
-// email: must be a valid email address; zip: cannot be blank.
-```
-
-In the above example, we build a `validation.Errors` by a list of names and the corresponding validation results.
-At the end we call `Errors.Filter()` to remove from `Errors` all nils which correspond to those successful validation
-results. The method will return nil if `Errors` is empty.
-
-The above approach is very flexible as it allows you to freely build up your validation error structure. You can use
-it to validate both struct and non-struct values. Compared to using `ValidateStruct` to validate a struct,
-it has the drawback that you have to redundantly specify the error keys while `ValidateStruct` can automatically
-find them out.
-
-
-### Internal Errors
-
-Internal errors are different from validation errors in that internal errors are caused by malfunctioning code (e.g.
-a validator making a remote call to validate some data when the remote service is down) rather
-than the data being validated. When an internal error happens during data validation, you may allow the user to resubmit
-the same data to perform validation again, hoping the program resumes functioning. On the other hand, if data validation
-fails due to data error, the user should generally not resubmit the same data again.
-
-To differentiate internal errors from validation errors, when an internal error occurs in a validator, wrap it
-into `validation.InternalError` by calling `validation.NewInternalError()`. The user of the validator can then check
-if a returned error is an internal error or not. For example,
-
-```go
-if err := a.Validate(); err != nil {
- if e, ok := err.(validation.InternalError); ok {
- // an internal error happened
- fmt.Println(e.InternalError())
- }
-}
-```
-
-
-## Validatable Types
-
-A type is validatable if it implements the `validation.Validatable` interface.
-
-When `validation.Validate` is used to validate a validatable value, if it does not find any error with the
-given validation rules, it will further call the value's `Validate()` method.
-
-Similarly, when `validation.ValidateStruct` is validating a struct field whose type is validatable, it will call
-the field's `Validate` method after it passes the listed rules.
-
-In the following example, the `Address` field of `Customer` is validatable because `Address` implements
-`validation.Validatable`. Therefore, when validating a `Customer` struct with `validation.ValidateStruct`,
-validation will "dive" into the `Address` field.
-
-```go
-type Customer struct {
- Name string
- Gender string
- Email string
- Address Address
-}
-
-func (c Customer) Validate() error {
- return validation.ValidateStruct(&c,
- // Name cannot be empty, and the length must be between 5 and 20.
- validation.Field(&c.Name, validation.Required, validation.Length(5, 20)),
- // Gender is optional, and should be either "Female" or "Male".
- validation.Field(&c.Gender, validation.In("Female", "Male")),
- // Email cannot be empty and should be in a valid email format.
- validation.Field(&c.Email, validation.Required, is.Email),
- // Validate Address using its own validation rules
- validation.Field(&c.Address),
- )
-}
-
-c := Customer{
- Name: "Qiang Xue",
- Email: "q",
- Address: Address{
- Street: "123 Main Street",
- City: "Unknown",
- State: "Virginia",
- Zip: "12345",
- },
-}
-
-err := c.Validate()
-fmt.Println(err)
-// Output:
-// Address: (State: must be in a valid format.); Email: must be a valid email address.
-```
-
-Sometimes, you may want to skip the invocation of a type's `Validate` method. To do so, simply associate
-a `validation.Skip` rule with the value being validated.
-
-### Maps/Slices/Arrays of Validatables
-
-When validating an iterable (map, slice, or array), whose element type implements the `validation.Validatable` interface,
-the `validation.Validate` method will call the `Validate` method of every non-nil element.
-The validation errors of the elements will be returned as `validation.Errors` which maps the keys of the
-invalid elements to their corresponding validation errors. For example,
-
-```go
-addresses := []Address{
- Address{State: "MD", Zip: "12345"},
- Address{Street: "123 Main St", City: "Vienna", State: "VA", Zip: "12345"},
- Address{City: "Unknown", State: "NC", Zip: "123"},
-}
-err := validation.Validate(addresses)
-fmt.Println(err)
-// Output:
-// 0: (City: cannot be blank; Street: cannot be blank.); 2: (Street: cannot be blank; Zip: must be in a valid format.).
-```
-
-When using `validation.ValidateStruct` to validate a struct, the above validation procedure also applies to those struct
-fields which are map/slices/arrays of validatables.
-
-#### Each
-
-An other option is to use the `validation.Each` method.
-This method allows you to define the rules for the iterables within a struct.
-
-```go
-type Customer struct {
- Name string
- Emails []string
-}
-
-func (c Customer) Validate() error {
- return validation.ValidateStruct(&c,
- // Name cannot be empty, and the length must be between 5 and 20.
- validation.Field(&c.Name, validation.Required, validation.Length(5, 20)),
- // Emails are optional, but if given must be valid.
- validation.Field(&c.Emails, validation.Each(is.Email)),
- )
-}
-
-c := Customer{
- Name: "Qiang Xue",
- Emails: []Email{
- "valid@example.com",
- "invalid",
- },
-}
-
-err := c.Validate()
-fmt.Println(err)
-// Output:
-// Emails: (1: must be a valid email address.).
-```
-
-### Pointers
-
-When a value being validated is a pointer, most validation rules will validate the actual value pointed to by the pointer.
-If the pointer is nil, these rules will skip the validation.
-
-An exception is the `validation.Required` and `validation.NotNil` rules. When a pointer is nil, they
-will report a validation error.
-
-
-### Types Implementing `sql.Valuer`
-
-If a data type implements the `sql.Valuer` interface (e.g. `sql.NullString`), the built-in validation rules will handle
-it properly. In particular, when a rule is validating such data, it will call the `Value()` method and validate
-the returned value instead.
-
-
-### Required vs. Not Nil
-
-When validating input values, there are two different scenarios about checking if input values are provided or not.
-
-In the first scenario, an input value is considered missing if it is not entered or it is entered as a zero value
-(e.g. an empty string, a zero integer). You can use the `validation.Required` rule in this case.
-
-In the second scenario, an input value is considered missing only if it is not entered. A pointer field is usually
-used in this case so that you can detect if a value is entered or not by checking if the pointer is nil or not.
-You can use the `validation.NotNil` rule to ensure a value is entered (even if it is a zero value).
-
-
-### Embedded Structs
-
-The `validation.ValidateStruct` method will properly validate a struct that contains embedded structs. In particular,
-the fields of an embedded struct are treated as if they belong directly to the containing struct. For example,
-
-```go
-type Employee struct {
- Name string
-}
-
-func ()
-
-type Manager struct {
- Employee
- Level int
-}
-
-m := Manager{}
-err := validation.ValidateStruct(&m,
- validation.Field(&m.Name, validation.Required),
- validation.Field(&m.Level, validation.Required),
-)
-fmt.Println(err)
-// Output:
-// Level: cannot be blank; Name: cannot be blank.
-```
-
-In the above code, we use `&m.Name` to specify the validation of the `Name` field of the embedded struct `Employee`.
-And the validation error uses `Name` as the key for the error associated with the `Name` field as if `Name` a field
-directly belonging to `Manager`.
-
-If `Employee` implements the `validation.Validatable` interface, we can also use the following code to validate
-`Manager`, which generates the same validation result:
-
-```go
-func (e Employee) Validate() error {
- return validation.ValidateStruct(&e,
- validation.Field(&e.Name, validation.Required),
- )
-}
-
-err := validation.ValidateStruct(&m,
- validation.Field(&m.Employee),
- validation.Field(&m.Level, validation.Required),
-)
-fmt.Println(err)
-// Output:
-// Level: cannot be blank; Name: cannot be blank.
-```
-
-
-## Built-in Validation Rules
-
-The following rules are provided in the `validation` package:
-
-* `In(...interface{})`: checks if a value can be found in the given list of values.
-* `Length(min, max int)`: checks if the length of a value is within the specified range.
- This rule should only be used for validating strings, slices, maps, and arrays.
-* `RuneLength(min, max int)`: checks if the length of a string is within the specified range.
- This rule is similar as `Length` except that when the value being validated is a string, it checks
- its rune length instead of byte length.
-* `Min(min interface{})` and `Max(max interface{})`: checks if a value is within the specified range.
- These two rules should only be used for validating int, uint, float and time.Time types.
-* `Match(*regexp.Regexp)`: checks if a value matches the specified regular expression.
- This rule should only be used for strings and byte slices.
-* `Date(layout string)`: checks if a string value is a date whose format is specified by the layout.
- By calling `Min()` and/or `Max()`, you can check additionally if the date is within the specified range.
-* `Required`: checks if a value is not empty (neither nil nor zero).
-* `NotNil`: checks if a pointer value is not nil. Non-pointer values are considered valid.
-* `NilOrNotEmpty`: checks if a value is a nil pointer or a non-empty value. This differs from `Required` in that it treats a nil pointer as valid.
-* `Skip`: this is a special rule used to indicate that all rules following it should be skipped (including the nested ones).
-* `MultipleOf`: checks if the value is a multiple of the specified range.
-* `Each(rules ...Rule)`: checks the elements within an iterable (map/slice/array) with other rules.
-
-The `is` sub-package provides a list of commonly used string validation rules that can be used to check if the format
-of a value satisfies certain requirements. Note that these rules only handle strings and byte slices and if a string
- or byte slice is empty, it is considered valid. You may use a `Required` rule to ensure a value is not empty.
-Below is the whole list of the rules provided by the `is` package:
-
-* `Email`: validates if a string is an email or not
-* `URL`: validates if a string is a valid URL
-* `RequestURL`: validates if a string is a valid request URL
-* `RequestURI`: validates if a string is a valid request URI
-* `Alpha`: validates if a string contains English letters only (a-zA-Z)
-* `Digit`: validates if a string contains digits only (0-9)
-* `Alphanumeric`: validates if a string contains English letters and digits only (a-zA-Z0-9)
-* `UTFLetter`: validates if a string contains unicode letters only
-* `UTFDigit`: validates if a string contains unicode decimal digits only
-* `UTFLetterNumeric`: validates if a string contains unicode letters and numbers only
-* `UTFNumeric`: validates if a string contains unicode number characters (category N) only
-* `LowerCase`: validates if a string contains lower case unicode letters only
-* `UpperCase`: validates if a string contains upper case unicode letters only
-* `Hexadecimal`: validates if a string is a valid hexadecimal number
-* `HexColor`: validates if a string is a valid hexadecimal color code
-* `RGBColor`: validates if a string is a valid RGB color in the form of rgb(R, G, B)
-* `Int`: validates if a string is a valid integer number
-* `Float`: validates if a string is a floating point number
-* `UUIDv3`: validates if a string is a valid version 3 UUID
-* `UUIDv4`: validates if a string is a valid version 4 UUID
-* `UUIDv5`: validates if a string is a valid version 5 UUID
-* `UUID`: validates if a string is a valid UUID
-* `CreditCard`: validates if a string is a valid credit card number
-* `ISBN10`: validates if a string is an ISBN version 10
-* `ISBN13`: validates if a string is an ISBN version 13
-* `ISBN`: validates if a string is an ISBN (either version 10 or 13)
-* `JSON`: validates if a string is in valid JSON format
-* `ASCII`: validates if a string contains ASCII characters only
-* `PrintableASCII`: validates if a string contains printable ASCII characters only
-* `Multibyte`: validates if a string contains multibyte characters
-* `FullWidth`: validates if a string contains full-width characters
-* `HalfWidth`: validates if a string contains half-width characters
-* `VariableWidth`: validates if a string contains both full-width and half-width characters
-* `Base64`: validates if a string is encoded in Base64
-* `DataURI`: validates if a string is a valid base64-encoded data URI
-* `E164`: validates if a string is a valid E164 phone number (+19251232233)
-* `CountryCode2`: validates if a string is a valid ISO3166 Alpha 2 country code
-* `CountryCode3`: validates if a string is a valid ISO3166 Alpha 3 country code
-* `DialString`: validates if a string is a valid dial string that can be passed to Dial()
-* `MAC`: validates if a string is a MAC address
-* `IP`: validates if a string is a valid IP address (either version 4 or 6)
-* `IPv4`: validates if a string is a valid version 4 IP address
-* `IPv6`: validates if a string is a valid version 6 IP address
-* `Subdomain`: validates if a string is valid subdomain
-* `Domain`: validates if a string is valid domain
-* `DNSName`: validates if a string is valid DNS name
-* `Host`: validates if a string is a valid IP (both v4 and v6) or a valid DNS name
-* `Port`: validates if a string is a valid port number
-* `MongoID`: validates if a string is a valid Mongo ID
-* `Latitude`: validates if a string is a valid latitude
-* `Longitude`: validates if a string is a valid longitude
-* `SSN`: validates if a string is a social security number (SSN)
-* `Semver`: validates if a string is a valid semantic version
-
-### Customizing Error Messages
-
-All built-in validation rules allow you to customize error messages. To do so, simply call the `Error()` method
-of the rules. For example,
-
-```go
-data := "2123"
-err := validation.Validate(data,
- validation.Required.Error("is required"),
- validation.Match(regexp.MustCompile("^[0-9]{5}$")).Error("must be a string with five digits"),
-)
-fmt.Println(err)
-// Output:
-// must be a string with five digits
-```
-
-
-## Creating Custom Rules
-
-Creating a custom rule is as simple as implementing the `validation.Rule` interface. The interface contains a single
-method as shown below, which should validate the value and return the validation error, if any:
-
-```go
-// Validate validates a value and returns an error if validation fails.
-Validate(value interface{}) error
-```
-
-If you already have a function with the same signature as shown above, you can call `validation.By()` to turn
-it into a validation rule. For example,
-
-```go
-func checkAbc(value interface{}) error {
- s, _ := value.(string)
- if s != "abc" {
- return errors.New("must be abc")
- }
- return nil
-}
-
-err := validation.Validate("xyz", validation.By(checkAbc))
-fmt.Println(err)
-// Output: must be abc
-```
-
-If your validation function takes additional parameters, you can use the following closure trick:
-
-```go
-func stringEquals(str string) validation.RuleFunc {
- return func(value interface{}) error {
- s, _ := value.(string)
- if s != str {
- return errors.New("unexpected string")
- }
- return nil
- }
-}
-
-err := validation.Validate("xyz", validation.By(stringEquals("abc")))
-fmt.Println(err)
-// Output: unexpected string
-```
-
-
-### Rule Groups
-
-When a combination of several rules are used in multiple places, you may use the following trick to create a
-rule group so that your code is more maintainable.
-
-```go
-var NameRule = []validation.Rule{
- validation.Required,
- validation.Length(5, 20),
-}
-
-type User struct {
- FirstName string
- LastName string
-}
-
-func (u User) Validate() error {
- return validation.ValidateStruct(&u,
- validation.Field(&u.FirstName, NameRule...),
- validation.Field(&u.LastName, NameRule...),
- )
-}
-```
-
-In the above example, we create a rule group `NameRule` which consists of two validation rules. We then use this rule
-group to validate both `FirstName` and `LastName`.
-
-
-## Credits
-
-The `is` sub-package wraps the excellent validators provided by the [govalidator](https://github.com/asaskevich/govalidator) package.
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/UPGRADE.md b/vendor/github.com/go-ozzo/ozzo-validation/UPGRADE.md
deleted file mode 100644
index 8f11d03..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/UPGRADE.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# Upgrade Instructions
-
-## Upgrade from 2.x to 3.x
-
-* Instead of using `StructRules` to define struct validation rules, use `ValidateStruct()` to declare and perform
- struct validation. The following code snippet shows how to modify your code:
-```go
-// 2.x usage
-err := validation.StructRules{}.
- Add("Street", validation.Required, validation.Length(5, 50)).
- Add("City", validation.Required, validation.Length(5, 50)).
- Add("State", validation.Required, validation.Match(regexp.MustCompile("^[A-Z]{2}$"))).
- Add("Zip", validation.Required, validation.Match(regexp.MustCompile("^[0-9]{5}$"))).
- Validate(a)
-
-// 3.x usage
-err := validation.ValidateStruct(&a,
- validation.Field(&a.Street, validation.Required, validation.Length(5, 50)),
- validation.Field(&a.City, validation.Required, validation.Length(5, 50)),
- validation.Field(&a.State, validation.Required, validation.Match(regexp.MustCompile("^[A-Z]{2}$"))),
- validation.Field(&a.Zip, validation.Required, validation.Match(regexp.MustCompile("^[0-9]{5}$"))),
-)
-```
-
-* Instead of using `Rules` to declare a rule list and use it to validate a value, call `Validate()` with the rules directly.
-```go
-data := "example"
-
-// 2.x usage
-rules := validation.Rules{
- validation.Required,
- validation.Length(5, 100),
- is.URL,
-}
-err := rules.Validate(data)
-
-// 3.x usage
-err := validation.Validate(data,
- validation.Required,
- validation.Length(5, 100),
- is.URL,
-)
-```
-
-* The default struct tags used for determining error keys is changed from `validation` to `json`. You may modify
- `validation.ErrorTag` to change it back.
\ No newline at end of file
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/date.go b/vendor/github.com/go-ozzo/ozzo-validation/date.go
deleted file mode 100644
index 94cff5b..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/date.go
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "errors"
- "time"
-)
-
-type DateRule struct {
- layout string
-
- min, max time.Time
-
- message string
-
- rangeMessage string
-}
-
-// Date returns a validation rule that checks if a string value is in a format that can be parsed into a date.
-
-// The format of the date should be specified as the layout parameter which accepts the same value as that for time.Parse.
-
-// For example,
-
-//
-
-// validation.Date(time.ANSIC)
-
-// validation.Date("02 Jan 06 15:04 MST")
-
-// validation.Date("2006-01-02")
-
-//
-
-// By calling Min() and/or Max(), you can let the Date rule to check if a parsed date value is within
-
-// the specified date range.
-
-//
-
-// An empty value is considered valid. Use the Required rule to make sure a value is not empty.
-
-func Date(layout string) *DateRule {
-
- return &DateRule{
-
- layout: layout,
-
- message: "must be a valid date",
-
- rangeMessage: "the data is out of range",
- }
-
-}
-
-// Error sets the error message that is used when the value being validated is not a valid date.
-
-func (r *DateRule) Error(message string) *DateRule {
-
- r.message = message
-
- return r
-
-}
-
-// RangeError sets the error message that is used when the value being validated is out of the specified Min/Max date range.
-
-func (r *DateRule) RangeError(message string) *DateRule {
-
- r.rangeMessage = message
-
- return r
-
-}
-
-// Min sets the minimum date range. A zero value means skipping the minimum range validation.
-
-func (r *DateRule) Min(min time.Time) *DateRule {
-
- r.min = min
-
- return r
-
-}
-
-// Max sets the maximum date range. A zero value means skipping the maximum range validation.
-
-func (r *DateRule) Max(max time.Time) *DateRule {
-
- r.max = max
-
- return r
-
-}
-
-// Validate checks if the given value is a valid date.
-
-func (r *DateRule) Validate(value interface{}) error {
-
- value, isNil := Indirect(value)
-
- if isNil || IsEmpty(value) {
-
- return nil
-
- }
-
- str, err := EnsureString(value)
-
- if err != nil {
-
- return err
-
- }
-
- date, err := time.Parse(r.layout, str)
-
- if err != nil {
-
- return errors.New(r.message)
-
- }
-
- if !r.min.IsZero() && r.min.After(date) || !r.max.IsZero() && date.After(r.max) {
-
- return errors.New(r.rangeMessage)
-
- }
-
- return nil
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/each.go b/vendor/github.com/go-ozzo/ozzo-validation/each.go
deleted file mode 100644
index faadfa2..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/each.go
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "errors"
- "reflect"
- "strconv"
-)
-
-// Each returns a validation rule that loops through an iterable (map, slice or array)
-
-// and validates each value inside with the provided rules.
-
-// An empty iterable is considered valid. Use the Required rule to make sure the iterable is not empty.
-
-func Each(rules ...Rule) *EachRule {
-
- return &EachRule{
-
- rules: rules,
- }
-
-}
-
-type EachRule struct {
- rules []Rule
-}
-
-// Loops through the given iterable and calls the Ozzo Validate() method for each value.
-
-func (r *EachRule) Validate(value interface{}) error {
-
- errs := Errors{}
-
- v := reflect.ValueOf(value)
-
- switch v.Kind() {
-
- case reflect.Map:
-
- for _, k := range v.MapKeys() {
-
- val := r.getInterface(v.MapIndex(k))
-
- if err := Validate(val, r.rules...); err != nil {
-
- errs[r.getString(k)] = err
-
- }
-
- }
-
- case reflect.Slice, reflect.Array:
-
- for i := 0; i < v.Len(); i++ {
-
- val := r.getInterface(v.Index(i))
-
- if err := Validate(val, r.rules...); err != nil {
-
- errs[strconv.Itoa(i)] = err
-
- }
-
- }
-
- default:
-
- return errors.New("must be an iterable (map, slice or array)")
-
- }
-
- if len(errs) > 0 {
-
- return errs
-
- }
-
- return nil
-
-}
-
-func (r *EachRule) getInterface(value reflect.Value) interface{} {
-
- switch value.Kind() {
-
- case reflect.Ptr, reflect.Interface:
-
- if value.IsNil() {
-
- return nil
-
- }
-
- return value.Elem().Interface()
-
- default:
-
- return value.Interface()
-
- }
-
-}
-
-func (r *EachRule) getString(value reflect.Value) string {
-
- switch value.Kind() {
-
- case reflect.Ptr, reflect.Interface:
-
- if value.IsNil() {
-
- return ""
-
- }
-
- return value.Elem().String()
-
- default:
-
- return value.String()
-
- }
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/error.go b/vendor/github.com/go-ozzo/ozzo-validation/error.go
deleted file mode 100644
index 0bb2fcb..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/error.go
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "encoding/json"
- "fmt"
- "sort"
-)
-
-type (
-
- // Errors represents the validation errors that are indexed by struct field names, map or slice keys.
-
- Errors map[string]error
-
- // InternalError represents an error that should NOT be treated as a validation error.
-
- InternalError interface {
- error
-
- InternalError() error
- }
-
- internalError struct {
- error
- }
-)
-
-// NewInternalError wraps a given error into an InternalError.
-
-func NewInternalError(err error) InternalError {
-
- return &internalError{error: err}
-
-}
-
-// InternalError returns the actual error that it wraps around.
-
-func (e *internalError) InternalError() error {
-
- return e.error
-
-}
-
-// Error returns the error string of Errors.
-
-func (es Errors) Error() string {
-
- if len(es) == 0 {
-
- return ""
-
- }
-
- keys := []string{}
-
- for key := range es {
-
- keys = append(keys, key)
-
- }
-
- sort.Strings(keys)
-
- s := ""
-
- for i, key := range keys {
-
- if i > 0 {
-
- s += "; "
-
- }
-
- if errs, ok := es[key].(Errors); ok {
-
- s += fmt.Sprintf("%v: (%v)", key, errs)
-
- } else {
-
- s += fmt.Sprintf("%v: %v", key, es[key].Error())
-
- }
-
- }
-
- return s + "."
-
-}
-
-// MarshalJSON converts the Errors into a valid JSON.
-
-func (es Errors) MarshalJSON() ([]byte, error) {
-
- errs := map[string]interface{}{}
-
- for key, err := range es {
-
- if ms, ok := err.(json.Marshaler); ok {
-
- errs[key] = ms
-
- } else {
-
- errs[key] = err.Error()
-
- }
-
- }
-
- return json.Marshal(errs)
-
-}
-
-// Filter removes all nils from Errors and returns back the updated Errors as an error.
-
-// If the length of Errors becomes 0, it will return nil.
-
-func (es Errors) Filter() error {
-
- for key, value := range es {
-
- if value == nil {
-
- delete(es, key)
-
- }
-
- }
-
- if len(es) == 0 {
-
- return nil
-
- }
-
- return es
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/in.go b/vendor/github.com/go-ozzo/ozzo-validation/in.go
deleted file mode 100644
index 33ee5e5..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/in.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package validation
-
-import "errors"
-
-// In returns a validation rule that checks if a value can be found in the given list of values.
-// Note that the value being checked and the possible range of values must be of the same type.
-// An empty value is considered valid. Use the Required rule to make sure a value is not empty.
-func In(values ...interface{}) *InRule {
- return &InRule{
- elements: values,
- message: "must be a valid value",
- }
-}
-
-type InRule struct {
- elements []interface{}
- message string
-}
-
-// Validate checks if the given value is valid or not.
-func (r *InRule) Validate(value interface{}) error {
- value, isNil := Indirect(value)
- if isNil || IsEmpty(value) {
- return nil
- }
-
- for _, e := range r.elements {
- if e == value {
- return nil
- }
- }
- return errors.New(r.message)
-}
-
-// Error sets the error message for the rule.
-func (r *InRule) Error(message string) *InRule {
- r.message = message
- return r
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/is/rules.go b/vendor/github.com/go-ozzo/ozzo-validation/is/rules.go
deleted file mode 100644
index 2427243..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/is/rules.go
+++ /dev/null
@@ -1,308 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-// Package is provides a list of commonly used string validation rules.
-
-package is
-
-import (
- "regexp"
- "unicode"
-
- "github.com/asaskevich/govalidator"
- "github.com/go-ozzo/ozzo-validation"
-)
-
-var (
-
- // Email validates if a string is an email or not.
-
- Email = validation.NewStringRule(govalidator.IsEmail, "must be a valid email address")
-
- // URL validates if a string is a valid URL
-
- URL = validation.NewStringRule(govalidator.IsURL, "must be a valid URL")
-
- // RequestURL validates if a string is a valid request URL
-
- RequestURL = validation.NewStringRule(govalidator.IsRequestURL, "must be a valid request URL")
-
- // RequestURI validates if a string is a valid request URI
-
- RequestURI = validation.NewStringRule(govalidator.IsRequestURI, "must be a valid request URI")
-
- // Alpha validates if a string contains English letters only (a-zA-Z)
-
- Alpha = validation.NewStringRule(govalidator.IsAlpha, "must contain English letters only")
-
- // Digit validates if a string contains digits only (0-9)
-
- Digit = validation.NewStringRule(isDigit, "must contain digits only")
-
- // Alphanumeric validates if a string contains English letters and digits only (a-zA-Z0-9)
-
- Alphanumeric = validation.NewStringRule(govalidator.IsAlphanumeric, "must contain English letters and digits only")
-
- // UTFLetter validates if a string contains unicode letters only
-
- UTFLetter = validation.NewStringRule(govalidator.IsUTFLetter, "must contain unicode letter characters only")
-
- // UTFDigit validates if a string contains unicode decimal digits only
-
- UTFDigit = validation.NewStringRule(govalidator.IsUTFDigit, "must contain unicode decimal digits only")
-
- // UTFLetterNumeric validates if a string contains unicode letters and numbers only
-
- UTFLetterNumeric = validation.NewStringRule(govalidator.IsUTFLetterNumeric, "must contain unicode letters and numbers only")
-
- // UTFNumeric validates if a string contains unicode number characters (category N) only
-
- UTFNumeric = validation.NewStringRule(isUTFNumeric, "must contain unicode number characters only")
-
- // LowerCase validates if a string contains lower case unicode letters only
-
- LowerCase = validation.NewStringRule(govalidator.IsLowerCase, "must be in lower case")
-
- // UpperCase validates if a string contains upper case unicode letters only
-
- UpperCase = validation.NewStringRule(govalidator.IsUpperCase, "must be in upper case")
-
- // Hexadecimal validates if a string is a valid hexadecimal number
-
- Hexadecimal = validation.NewStringRule(govalidator.IsHexadecimal, "must be a valid hexadecimal number")
-
- // HexColor validates if a string is a valid hexadecimal color code
-
- HexColor = validation.NewStringRule(govalidator.IsHexcolor, "must be a valid hexadecimal color code")
-
- // RGBColor validates if a string is a valid RGB color in the form of rgb(R, G, B)
-
- RGBColor = validation.NewStringRule(govalidator.IsRGBcolor, "must be a valid RGB color code")
-
- // Int validates if a string is a valid integer number
-
- Int = validation.NewStringRule(govalidator.IsInt, "must be an integer number")
-
- // Float validates if a string is a floating point number
-
- Float = validation.NewStringRule(govalidator.IsFloat, "must be a floating point number")
-
- // UUIDv3 validates if a string is a valid version 3 UUID
-
- UUIDv3 = validation.NewStringRule(govalidator.IsUUIDv3, "must be a valid UUID v3")
-
- // UUIDv4 validates if a string is a valid version 4 UUID
-
- UUIDv4 = validation.NewStringRule(govalidator.IsUUIDv4, "must be a valid UUID v4")
-
- // UUIDv5 validates if a string is a valid version 5 UUID
-
- UUIDv5 = validation.NewStringRule(govalidator.IsUUIDv5, "must be a valid UUID v5")
-
- // UUID validates if a string is a valid UUID
-
- UUID = validation.NewStringRule(govalidator.IsUUID, "must be a valid UUID")
-
- // CreditCard validates if a string is a valid credit card number
-
- CreditCard = validation.NewStringRule(govalidator.IsCreditCard, "must be a valid credit card number")
-
- // ISBN10 validates if a string is an ISBN version 10
-
- ISBN10 = validation.NewStringRule(govalidator.IsISBN10, "must be a valid ISBN-10")
-
- // ISBN13 validates if a string is an ISBN version 13
-
- ISBN13 = validation.NewStringRule(govalidator.IsISBN13, "must be a valid ISBN-13")
-
- // ISBN validates if a string is an ISBN (either version 10 or 13)
-
- ISBN = validation.NewStringRule(isISBN, "must be a valid ISBN")
-
- // JSON validates if a string is in valid JSON format
-
- JSON = validation.NewStringRule(govalidator.IsJSON, "must be in valid JSON format")
-
- // ASCII validates if a string contains ASCII characters only
-
- ASCII = validation.NewStringRule(govalidator.IsASCII, "must contain ASCII characters only")
-
- // PrintableASCII validates if a string contains printable ASCII characters only
-
- PrintableASCII = validation.NewStringRule(govalidator.IsPrintableASCII, "must contain printable ASCII characters only")
-
- // Multibyte validates if a string contains multibyte characters
-
- Multibyte = validation.NewStringRule(govalidator.IsMultibyte, "must contain multibyte characters")
-
- // FullWidth validates if a string contains full-width characters
-
- FullWidth = validation.NewStringRule(govalidator.IsFullWidth, "must contain full-width characters")
-
- // HalfWidth validates if a string contains half-width characters
-
- HalfWidth = validation.NewStringRule(govalidator.IsHalfWidth, "must contain half-width characters")
-
- // VariableWidth validates if a string contains both full-width and half-width characters
-
- VariableWidth = validation.NewStringRule(govalidator.IsVariableWidth, "must contain both full-width and half-width characters")
-
- // Base64 validates if a string is encoded in Base64
-
- Base64 = validation.NewStringRule(govalidator.IsBase64, "must be encoded in Base64")
-
- // DataURI validates if a string is a valid base64-encoded data URI
-
- DataURI = validation.NewStringRule(govalidator.IsDataURI, "must be a Base64-encoded data URI")
-
- // E164 validates if a string is a valid ISO3166 Alpha 2 country code
-
- E164 = validation.NewStringRule(isE164Number, "must be a valid E164 number")
-
- // CountryCode2 validates if a string is a valid ISO3166 Alpha 2 country code
-
- CountryCode2 = validation.NewStringRule(govalidator.IsISO3166Alpha2, "must be a valid two-letter country code")
-
- // CountryCode3 validates if a string is a valid ISO3166 Alpha 3 country code
-
- CountryCode3 = validation.NewStringRule(govalidator.IsISO3166Alpha3, "must be a valid three-letter country code")
-
- // CurrencyCode validates if a string is a valid IsISO4217 currency code.
-
- CurrencyCode = validation.NewStringRule(govalidator.IsISO4217, "must be valid ISO 4217 currency code")
-
- // DialString validates if a string is a valid dial string that can be passed to Dial()
-
- DialString = validation.NewStringRule(govalidator.IsDialString, "must be a valid dial string")
-
- // MAC validates if a string is a MAC address
-
- MAC = validation.NewStringRule(govalidator.IsMAC, "must be a valid MAC address")
-
- // IP validates if a string is a valid IP address (either version 4 or 6)
-
- IP = validation.NewStringRule(govalidator.IsIP, "must be a valid IP address")
-
- // IPv4 validates if a string is a valid version 4 IP address
-
- IPv4 = validation.NewStringRule(govalidator.IsIPv4, "must be a valid IPv4 address")
-
- // IPv6 validates if a string is a valid version 6 IP address
-
- IPv6 = validation.NewStringRule(govalidator.IsIPv6, "must be a valid IPv6 address")
-
- // Subdomain validates if a string is valid subdomain
-
- Subdomain = validation.NewStringRule(isSubdomain, "must be a valid subdomain")
-
- // Domain validates if a string is valid domain
-
- Domain = validation.NewStringRule(isDomain, "must be a valid domain")
-
- // DNSName validates if a string is valid DNS name
-
- DNSName = validation.NewStringRule(govalidator.IsDNSName, "must be a valid DNS name")
-
- // Host validates if a string is a valid IP (both v4 and v6) or a valid DNS name
-
- Host = validation.NewStringRule(govalidator.IsHost, "must be a valid IP address or DNS name")
-
- // Port validates if a string is a valid port number
-
- Port = validation.NewStringRule(govalidator.IsPort, "must be a valid port number")
-
- // MongoID validates if a string is a valid Mongo ID
-
- MongoID = validation.NewStringRule(govalidator.IsMongoID, "must be a valid hex-encoded MongoDB ObjectId")
-
- // Latitude validates if a string is a valid latitude
-
- Latitude = validation.NewStringRule(govalidator.IsLatitude, "must be a valid latitude")
-
- // Longitude validates if a string is a valid longitude
-
- Longitude = validation.NewStringRule(govalidator.IsLongitude, "must be a valid longitude")
-
- // SSN validates if a string is a social security number (SSN)
-
- SSN = validation.NewStringRule(govalidator.IsSSN, "must be a valid social security number")
-
- // Semver validates if a string is a valid semantic version
-
- Semver = validation.NewStringRule(govalidator.IsSemver, "must be a valid semantic version")
-)
-
-var (
- reDigit = regexp.MustCompile("^[0-9]+$")
-
- // Subdomain regex source: https://stackoverflow.com/a/7933253
-
- reSubdomain = regexp.MustCompile(`^[A-Za-z0-9](?:[A-Za-z0-9\-]{0,61}[A-Za-z0-9])?$`)
-
- // E164 regex source: https://stackoverflow.com/a/23299989
-
- reE164 = regexp.MustCompile(`^\+?[1-9]\d{1,14}$`)
-
- // Domain regex source: https://stackoverflow.com/a/7933253
-
- // Slightly modified: Removed 255 max length validation since Go regex does not
-
- // support lookarounds. More info: https://stackoverflow.com/a/38935027
-
- reDomain = regexp.MustCompile(`^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+(?:[a-z]{1,63}| xn--[a-z0-9]{1,59})$`)
-)
-
-func isISBN(value string) bool {
-
- return govalidator.IsISBN(value, 10) || govalidator.IsISBN(value, 13)
-
-}
-
-func isDigit(value string) bool {
-
- return reDigit.MatchString(value)
-
-}
-
-func isE164Number(value string) bool {
-
- return reE164.MatchString(value)
-
-}
-
-func isSubdomain(value string) bool {
-
- return reSubdomain.MatchString(value)
-
-}
-
-func isDomain(value string) bool {
-
- if len(value) > 255 {
-
- return false
-
- }
-
- return reDomain.MatchString(value)
-
-}
-
-func isUTFNumeric(value string) bool {
-
- for _, c := range value {
-
- if unicode.IsNumber(c) == false {
-
- return false
-
- }
-
- }
-
- return true
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/length.go b/vendor/github.com/go-ozzo/ozzo-validation/length.go
deleted file mode 100644
index 7c13d31..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/length.go
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "errors"
- "fmt"
- "unicode/utf8"
-)
-
-// Length returns a validation rule that checks if a value's length is within the specified range.
-
-// If max is 0, it means there is no upper bound for the length.
-
-// This rule should only be used for validating strings, slices, maps, and arrays.
-
-// An empty value is considered valid. Use the Required rule to make sure a value is not empty.
-
-func Length(min, max int) *LengthRule {
-
- message := "the value must be empty"
-
- if min == 0 && max > 0 {
-
- message = fmt.Sprintf("the length must be no more than %v", max)
-
- } else if min > 0 && max == 0 {
-
- message = fmt.Sprintf("the length must be no less than %v", min)
-
- } else if min > 0 && max > 0 {
-
- if min == max {
-
- message = fmt.Sprintf("the length must be exactly %v", min)
-
- } else {
-
- message = fmt.Sprintf("the length must be between %v and %v", min, max)
-
- }
-
- }
-
- return &LengthRule{
-
- min: min,
-
- max: max,
-
- message: message,
- }
-
-}
-
-// RuneLength returns a validation rule that checks if a string's rune length is within the specified range.
-
-// If max is 0, it means there is no upper bound for the length.
-
-// This rule should only be used for validating strings, slices, maps, and arrays.
-
-// An empty value is considered valid. Use the Required rule to make sure a value is not empty.
-
-// If the value being validated is not a string, the rule works the same as Length.
-
-func RuneLength(min, max int) *LengthRule {
-
- r := Length(min, max)
-
- r.rune = true
-
- return r
-
-}
-
-type LengthRule struct {
- min, max int
-
- message string
-
- rune bool
-}
-
-// Validate checks if the given value is valid or not.
-
-func (v *LengthRule) Validate(value interface{}) error {
-
- value, isNil := Indirect(value)
-
- if isNil || IsEmpty(value) {
-
- return nil
-
- }
-
- var (
- l int
-
- err error
- )
-
- if s, ok := value.(string); ok && v.rune {
-
- l = utf8.RuneCountInString(s)
-
- } else if l, err = LengthOfValue(value); err != nil {
-
- return err
-
- }
-
- if v.min > 0 && l < v.min || v.max > 0 && l > v.max {
-
- return errors.New(v.message)
-
- }
-
- return nil
-
-}
-
-// Error sets the error message for the rule.
-
-func (v *LengthRule) Error(message string) *LengthRule {
-
- v.message = message
-
- return v
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/match.go b/vendor/github.com/go-ozzo/ozzo-validation/match.go
deleted file mode 100644
index bd547a6..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/match.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "errors"
- "regexp"
-)
-
-// Match returns a validation rule that checks if a value matches the specified regular expression.
-
-// This rule should only be used for validating strings and byte slices, or a validation error will be reported.
-
-// An empty value is considered valid. Use the Required rule to make sure a value is not empty.
-
-func Match(re *regexp.Regexp) *MatchRule {
-
- return &MatchRule{
-
- re: re,
-
- message: "must be in a valid format",
- }
-
-}
-
-type MatchRule struct {
- re *regexp.Regexp
-
- message string
-}
-
-// Validate checks if the given value is valid or not.
-
-func (v *MatchRule) Validate(value interface{}) error {
-
- value, isNil := Indirect(value)
-
- if isNil {
-
- return nil
-
- }
-
- isString, str, isBytes, bs := StringOrBytes(value)
-
- if isString && (str == "" || v.re.MatchString(str)) {
-
- return nil
-
- } else if isBytes && (len(bs) == 0 || v.re.Match(bs)) {
-
- return nil
-
- }
-
- return errors.New(v.message)
-
-}
-
-// Error sets the error message for the rule.
-
-func (v *MatchRule) Error(message string) *MatchRule {
-
- v.message = message
-
- return v
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/minmax.go b/vendor/github.com/go-ozzo/ozzo-validation/minmax.go
deleted file mode 100644
index e288110..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/minmax.go
+++ /dev/null
@@ -1,304 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "errors"
- "fmt"
- "reflect"
- "time"
-)
-
-type ThresholdRule struct {
- threshold interface{}
-
- operator int
-
- message string
-}
-
-const (
- greaterThan = iota
-
- greaterEqualThan
-
- lessThan
-
- lessEqualThan
-)
-
-// Min is a validation rule that checks if a value is greater or equal than the specified value.
-
-// By calling Exclusive, the rule will check if the value is strictly greater than the specified value.
-
-// Note that the value being checked and the threshold value must be of the same type.
-
-// Only int, uint, float and time.Time types are supported.
-
-// An empty value is considered valid. Please use the Required rule to make sure a value is not empty.
-
-func Min(min interface{}) *ThresholdRule {
-
- return &ThresholdRule{
-
- threshold: min,
-
- operator: greaterEqualThan,
-
- message: fmt.Sprintf("must be no less than %v", min),
- }
-
-}
-
-// Max is a validation rule that checks if a value is less or equal than the specified value.
-
-// By calling Exclusive, the rule will check if the value is strictly less than the specified value.
-
-// Note that the value being checked and the threshold value must be of the same type.
-
-// Only int, uint, float and time.Time types are supported.
-
-// An empty value is considered valid. Please use the Required rule to make sure a value is not empty.
-
-func Max(max interface{}) *ThresholdRule {
-
- return &ThresholdRule{
-
- threshold: max,
-
- operator: lessEqualThan,
-
- message: fmt.Sprintf("must be no greater than %v", max),
- }
-
-}
-
-// Exclusive sets the comparison to exclude the boundary value.
-
-func (r *ThresholdRule) Exclusive() *ThresholdRule {
-
- if r.operator == greaterEqualThan {
-
- r.operator = greaterThan
-
- r.message = fmt.Sprintf("must be greater than %v", r.threshold)
-
- } else if r.operator == lessEqualThan {
-
- r.operator = lessThan
-
- r.message = fmt.Sprintf("must be less than %v", r.threshold)
-
- }
-
- return r
-
-}
-
-// Validate checks if the given value is valid or not.
-
-func (r *ThresholdRule) Validate(value interface{}) error {
-
- value, isNil := Indirect(value)
-
- if isNil || IsEmpty(value) {
-
- return nil
-
- }
-
- rv := reflect.ValueOf(r.threshold)
-
- switch rv.Kind() {
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-
- v, err := ToInt(value)
-
- if err != nil {
-
- return err
-
- }
-
- if r.compareInt(rv.Int(), v) {
-
- return nil
-
- }
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
-
- v, err := ToUint(value)
-
- if err != nil {
-
- return err
-
- }
-
- if r.compareUint(rv.Uint(), v) {
-
- return nil
-
- }
-
- case reflect.Float32, reflect.Float64:
-
- v, err := ToFloat(value)
-
- if err != nil {
-
- return err
-
- }
-
- if r.compareFloat(rv.Float(), v) {
-
- return nil
-
- }
-
- case reflect.Struct:
-
- t, ok := r.threshold.(time.Time)
-
- if !ok {
-
- return fmt.Errorf("type not supported: %v", rv.Type())
-
- }
-
- v, ok := value.(time.Time)
-
- if !ok {
-
- return fmt.Errorf("cannot convert %v to time.Time", reflect.TypeOf(value))
-
- }
-
- if v.IsZero() || r.compareTime(t, v) {
-
- return nil
-
- }
-
- default:
-
- return fmt.Errorf("type not supported: %v", rv.Type())
-
- }
-
- return errors.New(r.message)
-
-}
-
-// Error sets the error message for the rule.
-
-func (r *ThresholdRule) Error(message string) *ThresholdRule {
-
- r.message = message
-
- return r
-
-}
-
-func (r *ThresholdRule) compareInt(threshold, value int64) bool {
-
- switch r.operator {
-
- case greaterThan:
-
- return value > threshold
-
- case greaterEqualThan:
-
- return value >= threshold
-
- case lessThan:
-
- return value < threshold
-
- default:
-
- return value <= threshold
-
- }
-
-}
-
-func (r *ThresholdRule) compareUint(threshold, value uint64) bool {
-
- switch r.operator {
-
- case greaterThan:
-
- return value > threshold
-
- case greaterEqualThan:
-
- return value >= threshold
-
- case lessThan:
-
- return value < threshold
-
- default:
-
- return value <= threshold
-
- }
-
-}
-
-func (r *ThresholdRule) compareFloat(threshold, value float64) bool {
-
- switch r.operator {
-
- case greaterThan:
-
- return value > threshold
-
- case greaterEqualThan:
-
- return value >= threshold
-
- case lessThan:
-
- return value < threshold
-
- default:
-
- return value <= threshold
-
- }
-
-}
-
-func (r *ThresholdRule) compareTime(threshold, value time.Time) bool {
-
- switch r.operator {
-
- case greaterThan:
-
- return value.After(threshold)
-
- case greaterEqualThan:
-
- return value.After(threshold) || value.Equal(threshold)
-
- case lessThan:
-
- return value.Before(threshold)
-
- default:
-
- return value.Before(threshold) || value.Equal(threshold)
-
- }
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/multipleof.go b/vendor/github.com/go-ozzo/ozzo-validation/multipleof.go
deleted file mode 100644
index 7a59088..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/multipleof.go
+++ /dev/null
@@ -1,82 +0,0 @@
-package validation
-
-import (
- "errors"
- "fmt"
- "reflect"
-)
-
-func MultipleOf(threshold interface{}) *multipleOfRule {
-
- return &multipleOfRule{
-
- threshold,
-
- fmt.Sprintf("must be multiple of %v", threshold),
- }
-
-}
-
-type multipleOfRule struct {
- threshold interface{}
-
- message string
-}
-
-// Error sets the error message for the rule.
-
-func (r *multipleOfRule) Error(message string) *multipleOfRule {
-
- r.message = message
-
- return r
-
-}
-
-func (r *multipleOfRule) Validate(value interface{}) error {
-
- rv := reflect.ValueOf(r.threshold)
-
- switch rv.Kind() {
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-
- v, err := ToInt(value)
-
- if err != nil {
-
- return err
-
- }
-
- if v%rv.Int() == 0 {
-
- return nil
-
- }
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
-
- v, err := ToUint(value)
-
- if err != nil {
-
- return err
-
- }
-
- if v%rv.Uint() == 0 {
-
- return nil
-
- }
-
- default:
-
- return fmt.Errorf("type not supported: %v", rv.Type())
-
- }
-
- return errors.New(r.message)
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/not_in.go b/vendor/github.com/go-ozzo/ozzo-validation/not_in.go
deleted file mode 100644
index 18cf4a0..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/not_in.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2018 Qiang Xue, Google LLC. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "errors"
-)
-
-// NotIn returns a validation rule that checks if a value os absent from, the given list of values.
-// Note that the value being checked and the possible range of values must be of the same type.
-// An empty value is considered valid. Use the Required rule to make sure a value is not empty.
-func NotIn(values ...interface{}) *NotInRule {
- return &NotInRule{
- elements: values,
- message: "must not be in list",
- }
-}
-
-type NotInRule struct {
- elements []interface{}
- message string
-}
-
-// Validate checks if the given value is valid or not.
-func (r *NotInRule) Validate(value interface{}) error {
- value, isNil := Indirect(value)
- if isNil || IsEmpty(value) {
- return nil
- }
-
- for _, e := range r.elements {
- if e == value {
- return errors.New(r.message)
- }
- }
- return nil
-}
-
-// Error sets the error message for the rule.
-func (r *NotInRule) Error(message string) *NotInRule {
- r.message = message
- return r
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/not_nil.go b/vendor/github.com/go-ozzo/ozzo-validation/not_nil.go
deleted file mode 100644
index 6cfca12..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/not_nil.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package validation
-
-import "errors"
-
-// NotNil is a validation rule that checks if a value is not nil.
-// NotNil only handles types including interface, pointer, slice, and map.
-// All other types are considered valid.
-var NotNil = ¬NilRule{message: "is required"}
-
-type notNilRule struct {
- message string
-}
-
-// Validate checks if the given value is valid or not.
-func (r *notNilRule) Validate(value interface{}) error {
- _, isNil := Indirect(value)
- if isNil {
- return errors.New(r.message)
- }
- return nil
-}
-
-// Error sets the error message for the rule.
-func (r *notNilRule) Error(message string) *notNilRule {
- return ¬NilRule{
- message: message,
- }
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/required.go b/vendor/github.com/go-ozzo/ozzo-validation/required.go
deleted file mode 100644
index ef9558e..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/required.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package validation
-
-import "errors"
-
-// Required is a validation rule that checks if a value is not empty.
-// A value is considered not empty if
-// - integer, float: not zero
-// - bool: true
-// - string, array, slice, map: len() > 0
-// - interface, pointer: not nil and the referenced value is not empty
-// - any other types
-var Required = &requiredRule{message: "cannot be blank", skipNil: false}
-
-// NilOrNotEmpty checks if a value is a nil pointer or a value that is not empty.
-// NilOrNotEmpty differs from Required in that it treats a nil pointer as valid.
-var NilOrNotEmpty = &requiredRule{message: "cannot be blank", skipNil: true}
-
-type requiredRule struct {
- message string
- skipNil bool
-}
-
-// Validate checks if the given value is valid or not.
-func (v *requiredRule) Validate(value interface{}) error {
- value, isNil := Indirect(value)
- if v.skipNil && !isNil && IsEmpty(value) || !v.skipNil && (isNil || IsEmpty(value)) {
- return errors.New(v.message)
- }
- return nil
-}
-
-// Error sets the error message for the rule.
-func (v *requiredRule) Error(message string) *requiredRule {
- return &requiredRule{
- message: message,
- skipNil: v.skipNil,
- }
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/string.go b/vendor/github.com/go-ozzo/ozzo-validation/string.go
deleted file mode 100644
index e8f2a5e..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/string.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package validation
-
-import "errors"
-
-type stringValidator func(string) bool
-
-// StringRule is a rule that checks a string variable using a specified stringValidator.
-type StringRule struct {
- validate stringValidator
- message string
-}
-
-// NewStringRule creates a new validation rule using a function that takes a string value and returns a bool.
-// The rule returned will use the function to check if a given string or byte slice is valid or not.
-// An empty value is considered to be valid. Please use the Required rule to make sure a value is not empty.
-func NewStringRule(validator stringValidator, message string) *StringRule {
- return &StringRule{
- validate: validator,
- message: message,
- }
-}
-
-// Error sets the error message for the rule.
-func (v *StringRule) Error(message string) *StringRule {
- return NewStringRule(v.validate, message)
-}
-
-// Validate checks if the given value is valid or not.
-func (v *StringRule) Validate(value interface{}) error {
- value, isNil := Indirect(value)
- if isNil || IsEmpty(value) {
- return nil
- }
-
- str, err := EnsureString(value)
- if err != nil {
- return err
- }
-
- if v.validate(str) {
- return nil
- }
- return errors.New(v.message)
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/struct.go b/vendor/github.com/go-ozzo/ozzo-validation/struct.go
deleted file mode 100644
index 237b8f2..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/struct.go
+++ /dev/null
@@ -1,267 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "errors"
- "fmt"
- "reflect"
- "strings"
-)
-
-var (
-
- // ErrStructPointer is the error that a struct being validated is not specified as a pointer.
-
- ErrStructPointer = errors.New("only a pointer to a struct can be validated")
-)
-
-type (
-
- // ErrFieldPointer is the error that a field is not specified as a pointer.
-
- ErrFieldPointer int
-
- // ErrFieldNotFound is the error that a field cannot be found in the struct.
-
- ErrFieldNotFound int
-
- // FieldRules represents a rule set associated with a struct field.
-
- FieldRules struct {
- fieldPtr interface{}
-
- rules []Rule
- }
-)
-
-// Error returns the error string of ErrFieldPointer.
-
-func (e ErrFieldPointer) Error() string {
-
- return fmt.Sprintf("field #%v must be specified as a pointer", int(e))
-
-}
-
-// Error returns the error string of ErrFieldNotFound.
-
-func (e ErrFieldNotFound) Error() string {
-
- return fmt.Sprintf("field #%v cannot be found in the struct", int(e))
-
-}
-
-// ValidateStruct validates a struct by checking the specified struct fields against the corresponding validation rules.
-
-// Note that the struct being validated must be specified as a pointer to it. If the pointer is nil, it is considered valid.
-
-// Use Field() to specify struct fields that need to be validated. Each Field() call specifies a single field which
-
-// should be specified as a pointer to the field. A field can be associated with multiple rules.
-
-// For example,
-
-//
-
-// value := struct {
-
-// Name string
-
-// Value string
-
-// }{"name", "demo"}
-
-// err := validation.ValidateStruct(&value,
-
-// validation.Field(&a.Name, validation.Required),
-
-// validation.Field(&a.Value, validation.Required, validation.Length(5, 10)),
-
-// )
-
-// fmt.Println(err)
-
-// // Value: the length must be between 5 and 10.
-
-//
-
-// An error will be returned if validation fails.
-
-func ValidateStruct(structPtr interface{}, fields ...*FieldRules) error {
-
- value := reflect.ValueOf(structPtr)
-
- if value.Kind() != reflect.Ptr || !value.IsNil() && value.Elem().Kind() != reflect.Struct {
-
- // must be a pointer to a struct
-
- return NewInternalError(ErrStructPointer)
-
- }
-
- if value.IsNil() {
-
- // treat a nil struct pointer as valid
-
- return nil
-
- }
-
- value = value.Elem()
-
- errs := Errors{}
-
- for i, fr := range fields {
-
- fv := reflect.ValueOf(fr.fieldPtr)
-
- if fv.Kind() != reflect.Ptr {
-
- return NewInternalError(ErrFieldPointer(i))
-
- }
-
- ft := findStructField(value, fv)
-
- if ft == nil {
-
- return NewInternalError(ErrFieldNotFound(i))
-
- }
-
- if err := Validate(fv.Elem().Interface(), fr.rules...); err != nil {
-
- if ie, ok := err.(InternalError); ok && ie.InternalError() != nil {
-
- return err
-
- }
-
- if ft.Anonymous {
-
- // merge errors from anonymous struct field
-
- if es, ok := err.(Errors); ok {
-
- for name, value := range es {
-
- errs[name] = value
-
- }
-
- continue
-
- }
-
- }
-
- errs[getErrorFieldName(ft)] = err
-
- }
-
- }
-
- if len(errs) > 0 {
-
- return errs
-
- }
-
- return nil
-
-}
-
-// Field specifies a struct field and the corresponding validation rules.
-
-// The struct field must be specified as a pointer to it.
-
-func Field(fieldPtr interface{}, rules ...Rule) *FieldRules {
-
- return &FieldRules{
-
- fieldPtr: fieldPtr,
-
- rules: rules,
- }
-
-}
-
-// findStructField looks for a field in the given struct.
-
-// The field being looked for should be a pointer to the actual struct field.
-
-// If found, the field info will be returned. Otherwise, nil will be returned.
-
-func findStructField(structValue reflect.Value, fieldValue reflect.Value) *reflect.StructField {
-
- ptr := fieldValue.Pointer()
-
- for i := structValue.NumField() - 1; i >= 0; i-- {
-
- sf := structValue.Type().Field(i)
-
- if ptr == structValue.Field(i).UnsafeAddr() {
-
- // do additional type comparison because it's possible that the address of
-
- // an embedded struct is the same as the first field of the embedded struct
-
- if sf.Type == fieldValue.Elem().Type() {
-
- return &sf
-
- }
-
- }
-
- if sf.Anonymous {
-
- // delve into anonymous struct to look for the field
-
- fi := structValue.Field(i)
-
- if sf.Type.Kind() == reflect.Ptr {
-
- fi = fi.Elem()
-
- }
-
- if fi.Kind() == reflect.Struct {
-
- if f := findStructField(fi, fieldValue); f != nil {
-
- return f
-
- }
-
- }
-
- }
-
- }
-
- return nil
-
-}
-
-// getErrorFieldName returns the name that should be used to represent the validation error of a struct field.
-
-func getErrorFieldName(f *reflect.StructField) string {
-
- if tag := f.Tag.Get(ErrorTag); tag != "" {
-
- if cps := strings.SplitN(tag, ",", 2); cps[0] != "" {
-
- return cps[0]
-
- }
-
- }
-
- return f.Name
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/util.go b/vendor/github.com/go-ozzo/ozzo-validation/util.go
deleted file mode 100644
index 8db818b..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/util.go
+++ /dev/null
@@ -1,287 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "database/sql/driver"
- "errors"
- "fmt"
- "reflect"
- "time"
-)
-
-var (
- bytesType = reflect.TypeOf([]byte(nil))
-
- valuerType = reflect.TypeOf((*driver.Valuer)(nil)).Elem()
-)
-
-// EnsureString ensures the given value is a string.
-
-// If the value is a byte slice, it will be typecast into a string.
-
-// An error is returned otherwise.
-
-func EnsureString(value interface{}) (string, error) {
-
- v := reflect.ValueOf(value)
-
- if v.Kind() == reflect.String {
-
- return v.String(), nil
-
- }
-
- if v.Type() == bytesType {
-
- return string(v.Interface().([]byte)), nil
-
- }
-
- return "", errors.New("must be either a string or byte slice")
-
-}
-
-// StringOrBytes typecasts a value into a string or byte slice.
-
-// Boolean flags are returned to indicate if the typecasting succeeds or not.
-
-func StringOrBytes(value interface{}) (isString bool, str string, isBytes bool, bs []byte) {
-
- v := reflect.ValueOf(value)
-
- if v.Kind() == reflect.String {
-
- str = v.String()
-
- isString = true
-
- } else if v.Kind() == reflect.Slice && v.Type() == bytesType {
-
- bs = v.Interface().([]byte)
-
- isBytes = true
-
- }
-
- return
-
-}
-
-// LengthOfValue returns the length of a value that is a string, slice, map, or array.
-
-// An error is returned for all other types.
-
-func LengthOfValue(value interface{}) (int, error) {
-
- v := reflect.ValueOf(value)
-
- switch v.Kind() {
-
- case reflect.String, reflect.Slice, reflect.Map, reflect.Array:
-
- return v.Len(), nil
-
- }
-
- return 0, fmt.Errorf("cannot get the length of %v", v.Kind())
-
-}
-
-// ToInt converts the given value to an int64.
-
-// An error is returned for all incompatible types.
-
-func ToInt(value interface{}) (int64, error) {
-
- v := reflect.ValueOf(value)
-
- switch v.Kind() {
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-
- return v.Int(), nil
-
- }
-
- return 0, fmt.Errorf("cannot convert %v to int64", v.Kind())
-
-}
-
-// ToUint converts the given value to an uint64.
-
-// An error is returned for all incompatible types.
-
-func ToUint(value interface{}) (uint64, error) {
-
- v := reflect.ValueOf(value)
-
- switch v.Kind() {
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
-
- return v.Uint(), nil
-
- }
-
- return 0, fmt.Errorf("cannot convert %v to uint64", v.Kind())
-
-}
-
-// ToFloat converts the given value to a float64.
-
-// An error is returned for all incompatible types.
-
-func ToFloat(value interface{}) (float64, error) {
-
- v := reflect.ValueOf(value)
-
- switch v.Kind() {
-
- case reflect.Float32, reflect.Float64:
-
- return v.Float(), nil
-
- }
-
- return 0, fmt.Errorf("cannot convert %v to float64", v.Kind())
-
-}
-
-// IsEmpty checks if a value is empty or not.
-
-// A value is considered empty if
-
-// - integer, float: zero
-
-// - bool: false
-
-// - string, array: len() == 0
-
-// - slice, map: nil or len() == 0
-
-// - interface, pointer: nil or the referenced value is empty
-
-func IsEmpty(value interface{}) bool {
-
- v := reflect.ValueOf(value)
-
- switch v.Kind() {
-
- case reflect.String, reflect.Array, reflect.Map, reflect.Slice:
-
- return v.Len() == 0
-
- case reflect.Bool:
-
- return !v.Bool()
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-
- return v.Int() == 0
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
-
- return v.Uint() == 0
-
- case reflect.Float32, reflect.Float64:
-
- return v.Float() == 0
-
- case reflect.Invalid:
-
- return true
-
- case reflect.Interface, reflect.Ptr:
-
- if v.IsNil() {
-
- return true
-
- }
-
- return IsEmpty(v.Elem().Interface())
-
- case reflect.Struct:
-
- v, ok := value.(time.Time)
-
- if ok && v.IsZero() {
-
- return true
-
- }
-
- }
-
- return false
-
-}
-
-// Indirect returns the value that the given interface or pointer references to.
-
-// If the value implements driver.Valuer, it will deal with the value returned by
-
-// the Value() method instead. A boolean value is also returned to indicate if
-
-// the value is nil or not (only applicable to interface, pointer, map, and slice).
-
-// If the value is neither an interface nor a pointer, it will be returned back.
-
-func Indirect(value interface{}) (interface{}, bool) {
-
- rv := reflect.ValueOf(value)
-
- kind := rv.Kind()
-
- switch kind {
-
- case reflect.Invalid:
-
- return nil, true
-
- case reflect.Ptr, reflect.Interface:
-
- if rv.IsNil() {
-
- return nil, true
-
- }
-
- return Indirect(rv.Elem().Interface())
-
- case reflect.Slice, reflect.Map, reflect.Func, reflect.Chan:
-
- if rv.IsNil() {
-
- return nil, true
-
- }
-
- }
-
- if rv.Type().Implements(valuerType) {
-
- return indirectValuer(value.(driver.Valuer))
-
- }
-
- return value, false
-
-}
-
-func indirectValuer(valuer driver.Valuer) (interface{}, bool) {
-
- if value, err := valuer.Value(); value != nil && err == nil {
-
- return Indirect(value)
-
- }
-
- return nil, true
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/.gitignore b/vendor/github.com/go-ozzo/ozzo-validation/v4/.gitignore
deleted file mode 100644
index ef6e33f..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/.gitignore
+++ /dev/null
@@ -1,28 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Idea Directory
-.idea
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
-.DS_Store
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/.travis.yml b/vendor/github.com/go-ozzo/ozzo-validation/v4/.travis.yml
deleted file mode 100644
index 28febbd..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/.travis.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-dist: bionic
-
-language: go
-
-go:
- - 1.13.x
-
-install:
- - go get golang.org/x/tools/cmd/cover
- - go get github.com/mattn/goveralls
- - go get golang.org/x/lint/golint
-
-script:
- - test -z "`gofmt -l -d .`"
- - test -z "`golint ./...`"
- - go test -v -covermode=count -coverprofile=coverage.out
- - $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/LICENSE b/vendor/github.com/go-ozzo/ozzo-validation/v4/LICENSE
deleted file mode 100644
index d235be9..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/LICENSE
+++ /dev/null
@@ -1,17 +0,0 @@
-The MIT License (MIT)
-Copyright (c) 2016, Qiang Xue
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software
-and associated documentation files (the "Software"), to deal in the Software without restriction,
-including without limitation the rights to use, copy, modify, merge, publish, distribute,
-sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
-is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or
-substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
-BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/README.md b/vendor/github.com/go-ozzo/ozzo-validation/v4/README.md
deleted file mode 100644
index 6c14bbf..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/README.md
+++ /dev/null
@@ -1,703 +0,0 @@
-# ozzo-validation
-
-[![GoDoc](https://godoc.org/github.com/go-ozzo/ozzo-validation?status.png)](http://godoc.org/github.com/go-ozzo/ozzo-validation)
-[![Build Status](https://travis-ci.org/go-ozzo/ozzo-validation.svg?branch=master)](https://travis-ci.org/go-ozzo/ozzo-validation)
-[![Coverage Status](https://coveralls.io/repos/github/go-ozzo/ozzo-validation/badge.svg?branch=master)](https://coveralls.io/github/go-ozzo/ozzo-validation?branch=master)
-[![Go Report](https://goreportcard.com/badge/github.com/go-ozzo/ozzo-validation)](https://goreportcard.com/report/github.com/go-ozzo/ozzo-validation)
-
-## Description
-
-ozzo-validation is a Go package that provides configurable and extensible data validation capabilities.
-It has the following features:
-
-* use normal programming constructs rather than error-prone struct tags to specify how data should be validated.
-* can validate data of different types, e.g., structs, strings, byte slices, slices, maps, arrays.
-* can validate custom data types as long as they implement the `Validatable` interface.
-* can validate data types that implement the `sql.Valuer` interface (e.g. `sql.NullString`).
-* customizable and well-formatted validation errors.
-* error code and message translation support.
-* provide a rich set of validation rules right out of box.
-* extremely easy to create and use custom validation rules.
-
-For an example on how this library is used in an application, please refer to [go-rest-api](https://github.com/qiangxue/go-rest-api) which is a starter kit for building RESTful APIs in Go.
-
-## Requirements
-
-Go 1.13 or above.
-
-
-## Getting Started
-
-The ozzo-validation package mainly includes a set of validation rules and two validation methods. You use
-validation rules to describe how a value should be considered valid, and you call either `validation.Validate()`
-or `validation.ValidateStruct()` to validate the value.
-
-
-### Installation
-
-Run the following command to install the package:
-
-```
-go get github.com/go-ozzo/ozzo-validation
-```
-
-### Validating a Simple Value
-
-For a simple value, such as a string or an integer, you may use `validation.Validate()` to validate it. For example,
-
-```go
-package main
-
-import (
- "fmt"
-
- "github.com/go-ozzo/ozzo-validation/v4"
- "github.com/go-ozzo/ozzo-validation/v4/is"
-)
-
-func main() {
- data := "example"
- err := validation.Validate(data,
- validation.Required, // not empty
- validation.Length(5, 100), // length between 5 and 100
- is.URL, // is a valid URL
- )
- fmt.Println(err)
- // Output:
- // must be a valid URL
-}
-```
-
-The method `validation.Validate()` will run through the rules in the order that they are listed. If a rule fails
-the validation, the method will return the corresponding error and skip the rest of the rules. The method will
-return nil if the value passes all validation rules.
-
-
-### Validating a Struct
-
-For a struct value, you usually want to check if its fields are valid. For example, in a RESTful application, you
-may unmarshal the request payload into a struct and then validate the struct fields. If one or multiple fields
-are invalid, you may want to get an error describing which fields are invalid. You can use `validation.ValidateStruct()`
-to achieve this purpose. A single struct can have rules for multiple fields, and a field can be associated with multiple
-rules. For example,
-
-```go
-type Address struct {
- Street string
- City string
- State string
- Zip string
-}
-
-func (a Address) Validate() error {
- return validation.ValidateStruct(&a,
- // Street cannot be empty, and the length must between 5 and 50
- validation.Field(&a.Street, validation.Required, validation.Length(5, 50)),
- // City cannot be empty, and the length must between 5 and 50
- validation.Field(&a.City, validation.Required, validation.Length(5, 50)),
- // State cannot be empty, and must be a string consisting of two letters in upper case
- validation.Field(&a.State, validation.Required, validation.Match(regexp.MustCompile("^[A-Z]{2}$"))),
- // State cannot be empty, and must be a string consisting of five digits
- validation.Field(&a.Zip, validation.Required, validation.Match(regexp.MustCompile("^[0-9]{5}$"))),
- )
-}
-
-a := Address{
- Street: "123",
- City: "Unknown",
- State: "Virginia",
- Zip: "12345",
-}
-
-err := a.Validate()
-fmt.Println(err)
-// Output:
-// Street: the length must be between 5 and 50; State: must be in a valid format.
-```
-
-Note that when calling `validation.ValidateStruct` to validate a struct, you should pass to the method a pointer
-to the struct instead of the struct itself. Similarly, when calling `validation.Field` to specify the rules
-for a struct field, you should use a pointer to the struct field.
-
-When the struct validation is performed, the fields are validated in the order they are specified in `ValidateStruct`.
-And when each field is validated, its rules are also evaluated in the order they are associated with the field.
-If a rule fails, an error is recorded for that field, and the validation will continue with the next field.
-
-
-### Validating a Map
-
-Sometimes you might need to work with dynamic data stored in maps rather than a typed model. You can use `validation.Map()`
-in this situation. A single map can have rules for multiple keys, and a key can be associated with multiple
-rules. For example,
-
-```go
-c := map[string]interface{}{
- "Name": "Qiang Xue",
- "Email": "q",
- "Address": map[string]interface{}{
- "Street": "123",
- "City": "Unknown",
- "State": "Virginia",
- "Zip": "12345",
- },
-}
-
-err := validation.Validate(c,
- validation.Map(
- // Name cannot be empty, and the length must be between 5 and 20.
- validation.Key("Name", validation.Required, validation.Length(5, 20)),
- // Email cannot be empty and should be in a valid email format.
- validation.Key("Email", validation.Required, is.Email),
- // Validate Address using its own validation rules
- validation.Key("Address", validation.Map(
- // Street cannot be empty, and the length must between 5 and 50
- validation.Key("Street", validation.Required, validation.Length(5, 50)),
- // City cannot be empty, and the length must between 5 and 50
- validation.Key("City", validation.Required, validation.Length(5, 50)),
- // State cannot be empty, and must be a string consisting of two letters in upper case
- validation.Key("State", validation.Required, validation.Match(regexp.MustCompile("^[A-Z]{2}$"))),
- // State cannot be empty, and must be a string consisting of five digits
- validation.Key("Zip", validation.Required, validation.Match(regexp.MustCompile("^[0-9]{5}$"))),
- )),
- ),
-)
-fmt.Println(err)
-// Output:
-// Address: (State: must be in a valid format; Street: the length must be between 5 and 50.); Email: must be a valid email address.
-```
-
-When the map validation is performed, the keys are validated in the order they are specified in `Map`.
-And when each key is validated, its rules are also evaluated in the order they are associated with the key.
-If a rule fails, an error is recorded for that key, and the validation will continue with the next key.
-
-
-### Validation Errors
-
-The `validation.ValidateStruct` method returns validation errors found in struct fields in terms of `validation.Errors`
-which is a map of fields and their corresponding errors. Nil is returned if validation passes.
-
-By default, `validation.Errors` uses the struct tags named `json` to determine what names should be used to
-represent the invalid fields. The type also implements the `json.Marshaler` interface so that it can be marshaled
-into a proper JSON object. For example,
-
-```go
-type Address struct {
- Street string `json:"street"`
- City string `json:"city"`
- State string `json:"state"`
- Zip string `json:"zip"`
-}
-
-// ...perform validation here...
-
-err := a.Validate()
-b, _ := json.Marshal(err)
-fmt.Println(string(b))
-// Output:
-// {"street":"the length must be between 5 and 50","state":"must be in a valid format"}
-```
-
-You may modify `validation.ErrorTag` to use a different struct tag name.
-
-If you do not like the magic that `ValidateStruct` determines error keys based on struct field names or corresponding
-tag values, you may use the following alternative approach:
-
-```go
-c := Customer{
- Name: "Qiang Xue",
- Email: "q",
- Address: Address{
- State: "Virginia",
- },
-}
-
-err := validation.Errors{
- "name": validation.Validate(c.Name, validation.Required, validation.Length(5, 20)),
- "email": validation.Validate(c.Name, validation.Required, is.Email),
- "zip": validation.Validate(c.Address.Zip, validation.Required, validation.Match(regexp.MustCompile("^[0-9]{5}$"))),
-}.Filter()
-fmt.Println(err)
-// Output:
-// email: must be a valid email address; zip: cannot be blank.
-```
-
-In the above example, we build a `validation.Errors` by a list of names and the corresponding validation results.
-At the end we call `Errors.Filter()` to remove from `Errors` all nils which correspond to those successful validation
-results. The method will return nil if `Errors` is empty.
-
-The above approach is very flexible as it allows you to freely build up your validation error structure. You can use
-it to validate both struct and non-struct values. Compared to using `ValidateStruct` to validate a struct,
-it has the drawback that you have to redundantly specify the error keys while `ValidateStruct` can automatically
-find them out.
-
-
-### Internal Errors
-
-Internal errors are different from validation errors in that internal errors are caused by malfunctioning code (e.g.
-a validator making a remote call to validate some data when the remote service is down) rather
-than the data being validated. When an internal error happens during data validation, you may allow the user to resubmit
-the same data to perform validation again, hoping the program resumes functioning. On the other hand, if data validation
-fails due to data error, the user should generally not resubmit the same data again.
-
-To differentiate internal errors from validation errors, when an internal error occurs in a validator, wrap it
-into `validation.InternalError` by calling `validation.NewInternalError()`. The user of the validator can then check
-if a returned error is an internal error or not. For example,
-
-```go
-if err := a.Validate(); err != nil {
- if e, ok := err.(validation.InternalError); ok {
- // an internal error happened
- fmt.Println(e.InternalError())
- }
-}
-```
-
-
-## Validatable Types
-
-A type is validatable if it implements the `validation.Validatable` interface.
-
-When `validation.Validate` is used to validate a validatable value, if it does not find any error with the
-given validation rules, it will further call the value's `Validate()` method.
-
-Similarly, when `validation.ValidateStruct` is validating a struct field whose type is validatable, it will call
-the field's `Validate` method after it passes the listed rules.
-
-> Note: When implementing `validation.Validatable`, do not call `validation.Validate()` to validate the value in its
-> original type because this will cause infinite loops. For example, if you define a new type `MyString` as `string`
-> and implement `validation.Validatable` for `MyString`, within the `Validate()` function you should cast the value
-> to `string` first before calling `validation.Validate()` to validate it.
-
-In the following example, the `Address` field of `Customer` is validatable because `Address` implements
-`validation.Validatable`. Therefore, when validating a `Customer` struct with `validation.ValidateStruct`,
-validation will "dive" into the `Address` field.
-
-```go
-type Customer struct {
- Name string
- Gender string
- Email string
- Address Address
-}
-
-func (c Customer) Validate() error {
- return validation.ValidateStruct(&c,
- // Name cannot be empty, and the length must be between 5 and 20.
- validation.Field(&c.Name, validation.Required, validation.Length(5, 20)),
- // Gender is optional, and should be either "Female" or "Male".
- validation.Field(&c.Gender, validation.In("Female", "Male")),
- // Email cannot be empty and should be in a valid email format.
- validation.Field(&c.Email, validation.Required, is.Email),
- // Validate Address using its own validation rules
- validation.Field(&c.Address),
- )
-}
-
-c := Customer{
- Name: "Qiang Xue",
- Email: "q",
- Address: Address{
- Street: "123 Main Street",
- City: "Unknown",
- State: "Virginia",
- Zip: "12345",
- },
-}
-
-err := c.Validate()
-fmt.Println(err)
-// Output:
-// Address: (State: must be in a valid format.); Email: must be a valid email address.
-```
-
-Sometimes, you may want to skip the invocation of a type's `Validate` method. To do so, simply associate
-a `validation.Skip` rule with the value being validated.
-
-### Maps/Slices/Arrays of Validatables
-
-When validating an iterable (map, slice, or array), whose element type implements the `validation.Validatable` interface,
-the `validation.Validate` method will call the `Validate` method of every non-nil element.
-The validation errors of the elements will be returned as `validation.Errors` which maps the keys of the
-invalid elements to their corresponding validation errors. For example,
-
-```go
-addresses := []Address{
- Address{State: "MD", Zip: "12345"},
- Address{Street: "123 Main St", City: "Vienna", State: "VA", Zip: "12345"},
- Address{City: "Unknown", State: "NC", Zip: "123"},
-}
-err := validation.Validate(addresses)
-fmt.Println(err)
-// Output:
-// 0: (City: cannot be blank; Street: cannot be blank.); 2: (Street: cannot be blank; Zip: must be in a valid format.).
-```
-
-When using `validation.ValidateStruct` to validate a struct, the above validation procedure also applies to those struct
-fields which are map/slices/arrays of validatables.
-
-#### Each
-
-The `Each` validation rule allows you to apply a set of rules to each element of an array, slice, or map.
-
-```go
-type Customer struct {
- Name string
- Emails []string
-}
-
-func (c Customer) Validate() error {
- return validation.ValidateStruct(&c,
- // Name cannot be empty, and the length must be between 5 and 20.
- validation.Field(&c.Name, validation.Required, validation.Length(5, 20)),
- // Emails are optional, but if given must be valid.
- validation.Field(&c.Emails, validation.Each(is.Email)),
- )
-}
-
-c := Customer{
- Name: "Qiang Xue",
- Emails: []Email{
- "valid@example.com",
- "invalid",
- },
-}
-
-err := c.Validate()
-fmt.Println(err)
-// Output:
-// Emails: (1: must be a valid email address.).
-```
-
-### Pointers
-
-When a value being validated is a pointer, most validation rules will validate the actual value pointed to by the pointer.
-If the pointer is nil, these rules will skip the validation.
-
-An exception is the `validation.Required` and `validation.NotNil` rules. When a pointer is nil, they
-will report a validation error.
-
-
-### Types Implementing `sql.Valuer`
-
-If a data type implements the `sql.Valuer` interface (e.g. `sql.NullString`), the built-in validation rules will handle
-it properly. In particular, when a rule is validating such data, it will call the `Value()` method and validate
-the returned value instead.
-
-
-### Required vs. Not Nil
-
-When validating input values, there are two different scenarios about checking if input values are provided or not.
-
-In the first scenario, an input value is considered missing if it is not entered or it is entered as a zero value
-(e.g. an empty string, a zero integer). You can use the `validation.Required` rule in this case.
-
-In the second scenario, an input value is considered missing only if it is not entered. A pointer field is usually
-used in this case so that you can detect if a value is entered or not by checking if the pointer is nil or not.
-You can use the `validation.NotNil` rule to ensure a value is entered (even if it is a zero value).
-
-
-### Embedded Structs
-
-The `validation.ValidateStruct` method will properly validate a struct that contains embedded structs. In particular,
-the fields of an embedded struct are treated as if they belong directly to the containing struct. For example,
-
-```go
-type Employee struct {
- Name string
-}
-
-type Manager struct {
- Employee
- Level int
-}
-
-m := Manager{}
-err := validation.ValidateStruct(&m,
- validation.Field(&m.Name, validation.Required),
- validation.Field(&m.Level, validation.Required),
-)
-fmt.Println(err)
-// Output:
-// Level: cannot be blank; Name: cannot be blank.
-```
-
-In the above code, we use `&m.Name` to specify the validation of the `Name` field of the embedded struct `Employee`.
-And the validation error uses `Name` as the key for the error associated with the `Name` field as if `Name` a field
-directly belonging to `Manager`.
-
-If `Employee` implements the `validation.Validatable` interface, we can also use the following code to validate
-`Manager`, which generates the same validation result:
-
-```go
-func (e Employee) Validate() error {
- return validation.ValidateStruct(&e,
- validation.Field(&e.Name, validation.Required),
- )
-}
-
-err := validation.ValidateStruct(&m,
- validation.Field(&m.Employee),
- validation.Field(&m.Level, validation.Required),
-)
-fmt.Println(err)
-// Output:
-// Level: cannot be blank; Name: cannot be blank.
-```
-
-
-### Conditional Validation
-
-Sometimes, we may want to validate a value only when certain condition is met. For example, we want to ensure the
-`unit` struct field is not empty only when the `quantity` field is not empty; or we may want to ensure either `email`
-or `phone` is provided. The so-called conditional validation can be achieved with the help of `validation.When`.
-The following code implements the aforementioned examples:
-
-```go
-result := validation.ValidateStruct(&a,
- validation.Field(&a.Unit, validation.When(a.Quantity != "", validation.Required).Else(validation.Nil)),
- validation.Field(&a.Phone, validation.When(a.Email == "", validation.Required.Error('Either phone or Email is required.')),
- validation.Field(&a.Email, validation.When(a.Phone == "", validation.Required.Error('Either phone or Email is required.')),
-)
-```
-
-Note that `validation.When` and `validation.When.Else` can take a list of validation rules. These rules will be executed only when the condition is true (When) or false (Else).
-
-The above code can also be simplified using the shortcut `validation.Required.When`:
-
-```go
-result := validation.ValidateStruct(&a,
- validation.Field(&a.Unit, validation.Required.When(a.Quantity != ""), validation.Nil.When(a.Quantity == "")),
- validation.Field(&a.Phone, validation.Required.When(a.Email == "").Error('Either phone or Email is required.')),
- validation.Field(&a.Email, validation.Required.When(a.Phone == "").Error('Either phone or Email is required.')),
-)
-```
-
-### Customizing Error Messages
-
-All built-in validation rules allow you to customize their error messages. To do so, simply call the `Error()` method
-of the rules. For example,
-
-```go
-data := "2123"
-err := validation.Validate(data,
- validation.Required.Error("is required"),
- validation.Match(regexp.MustCompile("^[0-9]{5}$")).Error("must be a string with five digits"),
-)
-fmt.Println(err)
-// Output:
-// must be a string with five digits
-```
-
-You can also customize the pre-defined error(s) of a built-in rule such that the customization applies to *every*
-instance of the rule. For example, the `Required` rule uses the pre-defined error `ErrRequired`. You can customize it
-during the application initialization:
-```go
-validation.ErrRequired = validation.ErrRequired.SetMessage("the value is required")
-```
-
-### Error Code and Message Translation
-
-The errors returned by the validation rules implement the `Error` interface which contains the `Code()` method
-to provide the error code information. While the message of a validation error is often customized, the code is immutable.
-You can use error code to programmatically check a validation error or look for the translation of the corresponding message.
-
-If you are developing your own validation rules, you can use `validation.NewError()` to create a validation error which
-implements the aforementioned `Error` interface.
-
-## Creating Custom Rules
-
-Creating a custom rule is as simple as implementing the `validation.Rule` interface. The interface contains a single
-method as shown below, which should validate the value and return the validation error, if any:
-
-```go
-// Validate validates a value and returns an error if validation fails.
-Validate(value interface{}) error
-```
-
-If you already have a function with the same signature as shown above, you can call `validation.By()` to turn
-it into a validation rule. For example,
-
-```go
-func checkAbc(value interface{}) error {
- s, _ := value.(string)
- if s != "abc" {
- return errors.New("must be abc")
- }
- return nil
-}
-
-err := validation.Validate("xyz", validation.By(checkAbc))
-fmt.Println(err)
-// Output: must be abc
-```
-
-If your validation function takes additional parameters, you can use the following closure trick:
-
-```go
-func stringEquals(str string) validation.RuleFunc {
- return func(value interface{}) error {
- s, _ := value.(string)
- if s != str {
- return errors.New("unexpected string")
- }
- return nil
- }
-}
-
-err := validation.Validate("xyz", validation.By(stringEquals("abc")))
-fmt.Println(err)
-// Output: unexpected string
-```
-
-
-### Rule Groups
-
-When a combination of several rules are used in multiple places, you may use the following trick to create a
-rule group so that your code is more maintainable.
-
-```go
-var NameRule = []validation.Rule{
- validation.Required,
- validation.Length(5, 20),
-}
-
-type User struct {
- FirstName string
- LastName string
-}
-
-func (u User) Validate() error {
- return validation.ValidateStruct(&u,
- validation.Field(&u.FirstName, NameRule...),
- validation.Field(&u.LastName, NameRule...),
- )
-}
-```
-
-In the above example, we create a rule group `NameRule` which consists of two validation rules. We then use this rule
-group to validate both `FirstName` and `LastName`.
-
-
-## Context-aware Validation
-
-While most validation rules are self-contained, some rules may depend dynamically on a context. A rule may implement the
-`validation.RuleWithContext` interface to support the so-called context-aware validation.
-
-To validate an arbitrary value with a context, call `validation.ValidateWithContext()`. The `context.Conext` parameter
-will be passed along to those rules that implement `validation.RuleWithContext`.
-
-To validate the fields of a struct with a context, call `validation.ValidateStructWithContext()`.
-
-You can define a context-aware rule from scratch by implementing both `validation.Rule` and `validation.RuleWithContext`.
-You can also use `validation.WithContext()` to turn a function into a context-aware rule. For example,
-
-
-```go
-rule := validation.WithContext(func(ctx context.Context, value interface{}) error {
- if ctx.Value("secret") == value.(string) {
- return nil
- }
- return errors.New("value incorrect")
-})
-value := "xyz"
-ctx := context.WithValue(context.Background(), "secret", "example")
-err := validation.ValidateWithContext(ctx, value, rule)
-fmt.Println(err)
-// Output: value incorrect
-```
-
-When performing context-aware validation, if a rule does not implement `validation.RuleWithContext`, its
-`validation.Rule` will be used instead.
-
-
-## Built-in Validation Rules
-
-The following rules are provided in the `validation` package:
-
-* `In(...interface{})`: checks if a value can be found in the given list of values.
-* `NotIn(...interface{})`: checks if a value is NOT among the given list of values.
-* `Length(min, max int)`: checks if the length of a value is within the specified range.
- This rule should only be used for validating strings, slices, maps, and arrays.
-* `RuneLength(min, max int)`: checks if the length of a string is within the specified range.
- This rule is similar as `Length` except that when the value being validated is a string, it checks
- its rune length instead of byte length.
-* `Min(min interface{})` and `Max(max interface{})`: checks if a value is within the specified range.
- These two rules should only be used for validating int, uint, float and time.Time types.
-* `Match(*regexp.Regexp)`: checks if a value matches the specified regular expression.
- This rule should only be used for strings and byte slices.
-* `Date(layout string)`: checks if a string value is a date whose format is specified by the layout.
- By calling `Min()` and/or `Max()`, you can check additionally if the date is within the specified range.
-* `Required`: checks if a value is not empty (neither nil nor zero).
-* `NotNil`: checks if a pointer value is not nil. Non-pointer values are considered valid.
-* `NilOrNotEmpty`: checks if a value is a nil pointer or a non-empty value. This differs from `Required` in that it treats a nil pointer as valid.
-* `Nil`: checks if a value is a nil pointer.
-* `Empty`: checks if a value is empty. nil pointers are considered valid.
-* `Skip`: this is a special rule used to indicate that all rules following it should be skipped (including the nested ones).
-* `MultipleOf`: checks if the value is a multiple of the specified range.
-* `Each(rules ...Rule)`: checks the elements within an iterable (map/slice/array) with other rules.
-* `When(condition, rules ...Rule)`: validates with the specified rules only when the condition is true.
-* `Else(rules ...Rule)`: must be used with `When(condition, rules ...Rule)`, validates with the specified rules only when the condition is false.
-
-The `is` sub-package provides a list of commonly used string validation rules that can be used to check if the format
-of a value satisfies certain requirements. Note that these rules only handle strings and byte slices and if a string
- or byte slice is empty, it is considered valid. You may use a `Required` rule to ensure a value is not empty.
-Below is the whole list of the rules provided by the `is` package:
-
-* `Email`: validates if a string is an email or not. It also checks if the MX record exists for the email domain.
-* `EmailFormat`: validates if a string is an email or not. It does NOT check the existence of the MX record.
-* `URL`: validates if a string is a valid URL
-* `RequestURL`: validates if a string is a valid request URL
-* `RequestURI`: validates if a string is a valid request URI
-* `Alpha`: validates if a string contains English letters only (a-zA-Z)
-* `Digit`: validates if a string contains digits only (0-9)
-* `Alphanumeric`: validates if a string contains English letters and digits only (a-zA-Z0-9)
-* `UTFLetter`: validates if a string contains unicode letters only
-* `UTFDigit`: validates if a string contains unicode decimal digits only
-* `UTFLetterNumeric`: validates if a string contains unicode letters and numbers only
-* `UTFNumeric`: validates if a string contains unicode number characters (category N) only
-* `LowerCase`: validates if a string contains lower case unicode letters only
-* `UpperCase`: validates if a string contains upper case unicode letters only
-* `Hexadecimal`: validates if a string is a valid hexadecimal number
-* `HexColor`: validates if a string is a valid hexadecimal color code
-* `RGBColor`: validates if a string is a valid RGB color in the form of rgb(R, G, B)
-* `Int`: validates if a string is a valid integer number
-* `Float`: validates if a string is a floating point number
-* `UUIDv3`: validates if a string is a valid version 3 UUID
-* `UUIDv4`: validates if a string is a valid version 4 UUID
-* `UUIDv5`: validates if a string is a valid version 5 UUID
-* `UUID`: validates if a string is a valid UUID
-* `CreditCard`: validates if a string is a valid credit card number
-* `ISBN10`: validates if a string is an ISBN version 10
-* `ISBN13`: validates if a string is an ISBN version 13
-* `ISBN`: validates if a string is an ISBN (either version 10 or 13)
-* `JSON`: validates if a string is in valid JSON format
-* `ASCII`: validates if a string contains ASCII characters only
-* `PrintableASCII`: validates if a string contains printable ASCII characters only
-* `Multibyte`: validates if a string contains multibyte characters
-* `FullWidth`: validates if a string contains full-width characters
-* `HalfWidth`: validates if a string contains half-width characters
-* `VariableWidth`: validates if a string contains both full-width and half-width characters
-* `Base64`: validates if a string is encoded in Base64
-* `DataURI`: validates if a string is a valid base64-encoded data URI
-* `E164`: validates if a string is a valid E164 phone number (+19251232233)
-* `CountryCode2`: validates if a string is a valid ISO3166 Alpha 2 country code
-* `CountryCode3`: validates if a string is a valid ISO3166 Alpha 3 country code
-* `DialString`: validates if a string is a valid dial string that can be passed to Dial()
-* `MAC`: validates if a string is a MAC address
-* `IP`: validates if a string is a valid IP address (either version 4 or 6)
-* `IPv4`: validates if a string is a valid version 4 IP address
-* `IPv6`: validates if a string is a valid version 6 IP address
-* `Subdomain`: validates if a string is valid subdomain
-* `Domain`: validates if a string is valid domain
-* `DNSName`: validates if a string is valid DNS name
-* `Host`: validates if a string is a valid IP (both v4 and v6) or a valid DNS name
-* `Port`: validates if a string is a valid port number
-* `MongoID`: validates if a string is a valid Mongo ID
-* `Latitude`: validates if a string is a valid latitude
-* `Longitude`: validates if a string is a valid longitude
-* `SSN`: validates if a string is a social security number (SSN)
-* `Semver`: validates if a string is a valid semantic version
-
-## Credits
-
-The `is` sub-package wraps the excellent validators provided by the [govalidator](https://github.com/asaskevich/govalidator) package.
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/UPGRADE.md b/vendor/github.com/go-ozzo/ozzo-validation/v4/UPGRADE.md
deleted file mode 100644
index 73bd222..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/UPGRADE.md
+++ /dev/null
@@ -1,64 +0,0 @@
-# Upgrade Instructions
-
-## Upgrade from 3.x to 4.x
-
-If you are customizing the error messages of the following built-in validation rules, you may need to
-change the parameter placeholders from `%v` to the Go template variable placeholders.
-* `Length`: use `{{.min}}` and `{{.max}}` in the error message to refer to the minimum and maximum lengths.
-* `Min`: use `{{.threshold}}` in the error message to refer to the lower bound.
-* `Max`: use `{{.threshold}}` in the error message to refer to the upper bound
-* `MultipleOf`: use `{{.base}}` in the error message to refer to the base of the multiples.
-
-For example,
- ```go
-// 3.x
-lengthRule := validation.Length(2,10).Error("the length must be between %v and %v")
-
-// 4.x
-lengthRule := validation.Length(2,10).Error("the length must be between {{.min}} and {{.max}}")
-```
-
-## Upgrade from 2.x to 3.x
-
-* Instead of using `StructRules` to define struct validation rules, use `ValidateStruct()` to declare and perform
- struct validation. The following code snippet shows how to modify your code:
-```go
-// 2.x usage
-err := validation.StructRules{}.
- Add("Street", validation.Required, validation.Length(5, 50)).
- Add("City", validation.Required, validation.Length(5, 50)).
- Add("State", validation.Required, validation.Match(regexp.MustCompile("^[A-Z]{2}$"))).
- Add("Zip", validation.Required, validation.Match(regexp.MustCompile("^[0-9]{5}$"))).
- Validate(a)
-
-// 3.x usage
-err := validation.ValidateStruct(&a,
- validation.Field(&a.Street, validation.Required, validation.Length(5, 50)),
- validation.Field(&a.City, validation.Required, validation.Length(5, 50)),
- validation.Field(&a.State, validation.Required, validation.Match(regexp.MustCompile("^[A-Z]{2}$"))),
- validation.Field(&a.Zip, validation.Required, validation.Match(regexp.MustCompile("^[0-9]{5}$"))),
-)
-```
-
-* Instead of using `Rules` to declare a rule list and use it to validate a value, call `Validate()` with the rules directly.
-```go
-data := "example"
-
-// 2.x usage
-rules := validation.Rules{
- validation.Required,
- validation.Length(5, 100),
- is.URL,
-}
-err := rules.Validate(data)
-
-// 3.x usage
-err := validation.Validate(data,
- validation.Required,
- validation.Length(5, 100),
- is.URL,
-)
-```
-
-* The default struct tags used for determining error keys is changed from `validation` to `json`. You may modify
- `validation.ErrorTag` to change it back.
\ No newline at end of file
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/absent.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/absent.go
deleted file mode 100644
index 91fefe1..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/absent.go
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package validation
-
-var (
- // ErrNil is the error that returns when a value is not nil.
- ErrNil = NewError("validation_nil", "must be blank")
- // ErrEmpty is the error that returns when a not nil value is not empty.
- ErrEmpty = NewError("validation_empty", "must be blank")
-)
-
-// Nil is a validation rule that checks if a value is nil.
-// It is the opposite of NotNil rule
-var Nil = absentRule{condition: true, skipNil: false}
-
-// Empty checks if a not nil value is empty.
-var Empty = absentRule{condition: true, skipNil: true}
-
-type absentRule struct {
- condition bool
- err Error
- skipNil bool
-}
-
-// Validate checks if the given value is valid or not.
-func (r absentRule) Validate(value interface{}) error {
- if r.condition {
- value, isNil := Indirect(value)
- if !r.skipNil && !isNil || r.skipNil && !isNil && !IsEmpty(value) {
- if r.err != nil {
- return r.err
- }
- if r.skipNil {
- return ErrEmpty
- }
- return ErrNil
- }
- }
- return nil
-}
-
-// When sets the condition that determines if the validation should be performed.
-func (r absentRule) When(condition bool) absentRule {
- r.condition = condition
- return r
-}
-
-// Error sets the error message for the rule.
-func (r absentRule) Error(message string) absentRule {
- if r.err == nil {
- if r.skipNil {
- r.err = ErrEmpty
- } else {
- r.err = ErrNil
- }
- }
- r.err = r.err.SetMessage(message)
- return r
-}
-
-// ErrorObject sets the error struct for the rule.
-func (r absentRule) ErrorObject(err Error) absentRule {
- r.err = err
- return r
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/date.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/date.go
deleted file mode 100644
index 31da0e3..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/date.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "time"
-)
-
-var (
- // ErrDateInvalid is the error that returns in case of an invalid date.
- ErrDateInvalid = NewError("validation_date_invalid", "must be a valid date")
- // ErrDateOutOfRange is the error that returns in case of an invalid date.
- ErrDateOutOfRange = NewError("validation_date_out_of_range", "the date is out of range")
-)
-
-// DateRule is a validation rule that validates date/time string values.
-type DateRule struct {
- layout string
- min, max time.Time
- err, rangeErr Error
-}
-
-// Date returns a validation rule that checks if a string value is in a format that can be parsed into a date.
-// The format of the date should be specified as the layout parameter which accepts the same value as that for time.Parse.
-// For example,
-// validation.Date(time.ANSIC)
-// validation.Date("02 Jan 06 15:04 MST")
-// validation.Date("2006-01-02")
-//
-// By calling Min() and/or Max(), you can let the Date rule to check if a parsed date value is within
-// the specified date range.
-//
-// An empty value is considered valid. Use the Required rule to make sure a value is not empty.
-func Date(layout string) DateRule {
- return DateRule{
- layout: layout,
- err: ErrDateInvalid,
- rangeErr: ErrDateOutOfRange,
- }
-}
-
-// Error sets the error message that is used when the value being validated is not a valid date.
-func (r DateRule) Error(message string) DateRule {
- r.err = r.err.SetMessage(message)
- return r
-}
-
-// ErrorObject sets the error struct that is used when the value being validated is not a valid date..
-func (r DateRule) ErrorObject(err Error) DateRule {
- r.err = err
- return r
-}
-
-// RangeError sets the error message that is used when the value being validated is out of the specified Min/Max date range.
-func (r DateRule) RangeError(message string) DateRule {
- r.rangeErr = r.rangeErr.SetMessage(message)
- return r
-}
-
-// RangeErrorObject sets the error struct that is used when the value being validated is out of the specified Min/Max date range.
-func (r DateRule) RangeErrorObject(err Error) DateRule {
- r.rangeErr = err
- return r
-}
-
-// Min sets the minimum date range. A zero value means skipping the minimum range validation.
-func (r DateRule) Min(min time.Time) DateRule {
- r.min = min
- return r
-}
-
-// Max sets the maximum date range. A zero value means skipping the maximum range validation.
-func (r DateRule) Max(max time.Time) DateRule {
- r.max = max
- return r
-}
-
-// Validate checks if the given value is a valid date.
-func (r DateRule) Validate(value interface{}) error {
- value, isNil := Indirect(value)
- if isNil || IsEmpty(value) {
- return nil
- }
-
- str, err := EnsureString(value)
- if err != nil {
- return err
- }
-
- date, err := time.Parse(r.layout, str)
- if err != nil {
- return r.err
- }
-
- if !r.min.IsZero() && r.min.After(date) || !r.max.IsZero() && date.After(r.max) {
- return r.rangeErr
- }
-
- return nil
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/each.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/each.go
deleted file mode 100644
index 59b3593..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/each.go
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "context"
- "errors"
- "reflect"
- "strconv"
-)
-
-// Each returns a validation rule that loops through an iterable (map, slice or array)
-
-// and validates each value inside with the provided rules.
-
-// An empty iterable is considered valid. Use the Required rule to make sure the iterable is not empty.
-
-func Each(rules ...Rule) EachRule {
-
- return EachRule{
-
- rules: rules,
- }
-
-}
-
-// EachRule is a validation rule that validates elements in a map/slice/array using the specified list of rules.
-
-type EachRule struct {
- rules []Rule
-}
-
-// Validate loops through the given iterable and calls the Ozzo Validate() method for each value.
-
-func (r EachRule) Validate(value interface{}) error {
-
- return r.ValidateWithContext(nil, value)
-
-}
-
-// ValidateWithContext loops through the given iterable and calls the Ozzo ValidateWithContext() method for each value.
-
-func (r EachRule) ValidateWithContext(ctx context.Context, value interface{}) error {
-
- errs := Errors{}
-
- v := reflect.ValueOf(value)
-
- switch v.Kind() {
-
- case reflect.Map:
-
- for _, k := range v.MapKeys() {
-
- val := r.getInterface(v.MapIndex(k))
-
- var err error
-
- if ctx == nil {
-
- err = Validate(val, r.rules...)
-
- } else {
-
- err = ValidateWithContext(ctx, val, r.rules...)
-
- }
-
- if err != nil {
-
- errs[r.getString(k)] = err
-
- }
-
- }
-
- case reflect.Slice, reflect.Array:
-
- for i := 0; i < v.Len(); i++ {
-
- val := r.getInterface(v.Index(i))
-
- var err error
-
- if ctx == nil {
-
- err = Validate(val, r.rules...)
-
- } else {
-
- err = ValidateWithContext(ctx, val, r.rules...)
-
- }
-
- if err != nil {
-
- errs[strconv.Itoa(i)] = err
-
- }
-
- }
-
- default:
-
- return errors.New("must be an iterable (map, slice or array)")
-
- }
-
- if len(errs) > 0 {
-
- return errs
-
- }
-
- return nil
-
-}
-
-func (r EachRule) getInterface(value reflect.Value) interface{} {
-
- switch value.Kind() {
-
- case reflect.Ptr, reflect.Interface:
-
- if value.IsNil() {
-
- return nil
-
- }
-
- return value.Elem().Interface()
-
- default:
-
- return value.Interface()
-
- }
-
-}
-
-func (r EachRule) getString(value reflect.Value) string {
-
- switch value.Kind() {
-
- case reflect.Ptr, reflect.Interface:
-
- if value.IsNil() {
-
- return ""
-
- }
-
- return value.Elem().String()
-
- default:
-
- return value.String()
-
- }
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/error.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/error.go
deleted file mode 100644
index 3c0df66..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/error.go
+++ /dev/null
@@ -1,288 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "sort"
- "strings"
- "text/template"
-)
-
-type (
-
- // Error interface represents an validation error
-
- Error interface {
- Error() string
-
- Code() string
-
- Message() string
-
- SetMessage(string) Error
-
- Params() map[string]interface{}
-
- SetParams(map[string]interface{}) Error
- }
-
- // ErrorObject is the default validation error
-
- // that implements the Error interface.
-
- ErrorObject struct {
- code string
-
- message string
-
- params map[string]interface{}
- }
-
- // Errors represents the validation errors that are indexed by struct field names, map or slice keys.
-
- // values are Error or Errors (for map, slice and array error value is Errors).
-
- Errors map[string]error
-
- // InternalError represents an error that should NOT be treated as a validation error.
-
- InternalError interface {
- error
-
- InternalError() error
- }
-
- internalError struct {
- error
- }
-)
-
-// NewInternalError wraps a given error into an InternalError.
-
-func NewInternalError(err error) InternalError {
-
- return internalError{error: err}
-
-}
-
-// InternalError returns the actual error that it wraps around.
-
-func (e internalError) InternalError() error {
-
- return e.error
-
-}
-
-// SetCode set the error's translation code.
-
-func (e ErrorObject) SetCode(code string) Error {
-
- e.code = code
-
- return e
-
-}
-
-// Code get the error's translation code.
-
-func (e ErrorObject) Code() string {
-
- return e.code
-
-}
-
-// SetParams set the error's params.
-
-func (e ErrorObject) SetParams(params map[string]interface{}) Error {
-
- e.params = params
-
- return e
-
-}
-
-// AddParam add parameter to the error's parameters.
-
-func (e ErrorObject) AddParam(name string, value interface{}) Error {
-
- if e.params == nil {
-
- e.params = make(map[string]interface{})
-
- }
-
- e.params[name] = value
-
- return e
-
-}
-
-// Params returns the error's params.
-
-func (e ErrorObject) Params() map[string]interface{} {
-
- return e.params
-
-}
-
-// SetMessage set the error's message.
-
-func (e ErrorObject) SetMessage(message string) Error {
-
- e.message = message
-
- return e
-
-}
-
-// Message return the error's message.
-
-func (e ErrorObject) Message() string {
-
- return e.message
-
-}
-
-// Error returns the error message.
-
-func (e ErrorObject) Error() string {
-
- if len(e.params) == 0 {
-
- return e.message
-
- }
-
- res := bytes.Buffer{}
-
- _ = template.Must(template.New("err").Parse(e.message)).Execute(&res, e.params)
-
- return res.String()
-
-}
-
-// Error returns the error string of Errors.
-
-func (es Errors) Error() string {
-
- if len(es) == 0 {
-
- return ""
-
- }
-
- keys := make([]string, len(es))
-
- i := 0
-
- for key := range es {
-
- keys[i] = key
-
- i++
-
- }
-
- sort.Strings(keys)
-
- var s strings.Builder
-
- for i, key := range keys {
-
- if i > 0 {
-
- s.WriteString("; ")
-
- }
-
- if errs, ok := es[key].(Errors); ok {
-
- _, _ = fmt.Fprintf(&s, "%v: (%v)", key, errs)
-
- } else {
-
- _, _ = fmt.Fprintf(&s, "%v: %v", key, es[key].Error())
-
- }
-
- }
-
- s.WriteString(".")
-
- return s.String()
-
-}
-
-// MarshalJSON converts the Errors into a valid JSON.
-
-func (es Errors) MarshalJSON() ([]byte, error) {
-
- errs := map[string]interface{}{}
-
- for key, err := range es {
-
- if ms, ok := err.(json.Marshaler); ok {
-
- errs[key] = ms
-
- } else {
-
- errs[key] = err.Error()
-
- }
-
- }
-
- return json.Marshal(errs)
-
-}
-
-// Filter removes all nils from Errors and returns back the updated Errors as an error.
-
-// If the length of Errors becomes 0, it will return nil.
-
-func (es Errors) Filter() error {
-
- for key, value := range es {
-
- if value == nil {
-
- delete(es, key)
-
- }
-
- }
-
- if len(es) == 0 {
-
- return nil
-
- }
-
- return es
-
-}
-
-// NewError create new validation error.
-
-func NewError(code, message string) Error {
-
- return ErrorObject{
-
- code: code,
-
- message: message,
- }
-
-}
-
-// Assert that our ErrorObject implements the Error interface.
-
-var _ Error = ErrorObject{}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/in.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/in.go
deleted file mode 100644
index 97e17ff..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/in.go
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "reflect"
-)
-
-// ErrInInvalid is the error that returns in case of an invalid value for "in" rule.
-var ErrInInvalid = NewError("validation_in_invalid", "must be a valid value")
-
-// In returns a validation rule that checks if a value can be found in the given list of values.
-// reflect.DeepEqual() will be used to determine if two values are equal.
-// For more details please refer to https://golang.org/pkg/reflect/#DeepEqual
-// An empty value is considered valid. Use the Required rule to make sure a value is not empty.
-func In(values ...interface{}) InRule {
- return InRule{
- elements: values,
- err: ErrInInvalid,
- }
-}
-
-// InRule is a validation rule that validates if a value can be found in the given list of values.
-type InRule struct {
- elements []interface{}
- err Error
-}
-
-// Validate checks if the given value is valid or not.
-func (r InRule) Validate(value interface{}) error {
- value, isNil := Indirect(value)
- if isNil || IsEmpty(value) {
- return nil
- }
-
- for _, e := range r.elements {
- if reflect.DeepEqual(e, value) {
- return nil
- }
- }
-
- return r.err
-}
-
-// Error sets the error message for the rule.
-func (r InRule) Error(message string) InRule {
- r.err = r.err.SetMessage(message)
- return r
-}
-
-// ErrorObject sets the error struct for the rule.
-func (r InRule) ErrorObject(err Error) InRule {
- r.err = err
- return r
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/length.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/length.go
deleted file mode 100644
index b26e1fa..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/length.go
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "unicode/utf8"
-)
-
-var (
- // ErrLengthTooLong is the error that returns in case of too long length.
- ErrLengthTooLong = NewError("validation_length_too_long", "the length must be no more than {{.max}}")
- // ErrLengthTooShort is the error that returns in case of too short length.
- ErrLengthTooShort = NewError("validation_length_too_short", "the length must be no less than {{.min}}")
- // ErrLengthInvalid is the error that returns in case of an invalid length.
- ErrLengthInvalid = NewError("validation_length_invalid", "the length must be exactly {{.min}}")
- // ErrLengthOutOfRange is the error that returns in case of out of range length.
- ErrLengthOutOfRange = NewError("validation_length_out_of_range", "the length must be between {{.min}} and {{.max}}")
- // ErrLengthEmptyRequired is the error that returns in case of non-empty value.
- ErrLengthEmptyRequired = NewError("validation_length_empty_required", "the value must be empty")
-)
-
-// Length returns a validation rule that checks if a value's length is within the specified range.
-// If max is 0, it means there is no upper bound for the length.
-// This rule should only be used for validating strings, slices, maps, and arrays.
-// An empty value is considered valid. Use the Required rule to make sure a value is not empty.
-func Length(min, max int) LengthRule {
- return LengthRule{min: min, max: max, err: buildLengthRuleError(min, max)}
-}
-
-// RuneLength returns a validation rule that checks if a string's rune length is within the specified range.
-// If max is 0, it means there is no upper bound for the length.
-// This rule should only be used for validating strings, slices, maps, and arrays.
-// An empty value is considered valid. Use the Required rule to make sure a value is not empty.
-// If the value being validated is not a string, the rule works the same as Length.
-func RuneLength(min, max int) LengthRule {
- r := Length(min, max)
- r.rune = true
-
- return r
-}
-
-// LengthRule is a validation rule that checks if a value's length is within the specified range.
-type LengthRule struct {
- err Error
-
- min, max int
- rune bool
-}
-
-// Validate checks if the given value is valid or not.
-func (r LengthRule) Validate(value interface{}) error {
- value, isNil := Indirect(value)
- if isNil || IsEmpty(value) {
- return nil
- }
-
- var (
- l int
- err error
- )
- if s, ok := value.(string); ok && r.rune {
- l = utf8.RuneCountInString(s)
- } else if l, err = LengthOfValue(value); err != nil {
- return err
- }
-
- if r.min > 0 && l < r.min || r.max > 0 && l > r.max || r.min == 0 && r.max == 0 && l > 0 {
- return r.err
- }
-
- return nil
-}
-
-// Error sets the error message for the rule.
-func (r LengthRule) Error(message string) LengthRule {
- r.err = r.err.SetMessage(message)
- return r
-}
-
-// ErrorObject sets the error struct for the rule.
-func (r LengthRule) ErrorObject(err Error) LengthRule {
- r.err = err
- return r
-}
-
-func buildLengthRuleError(min, max int) (err Error) {
- if min == 0 && max > 0 {
- err = ErrLengthTooLong
- } else if min > 0 && max == 0 {
- err = ErrLengthTooShort
- } else if min > 0 && max > 0 {
- if min == max {
- err = ErrLengthInvalid
- } else {
- err = ErrLengthOutOfRange
- }
- } else {
- err = ErrLengthEmptyRequired
- }
-
- return err.SetParams(map[string]interface{}{"min": min, "max": max})
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/map.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/map.go
deleted file mode 100644
index b983305..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/map.go
+++ /dev/null
@@ -1,239 +0,0 @@
-package validation
-
-import (
- "context"
- "errors"
- "fmt"
- "reflect"
-)
-
-var (
-
- // ErrNotMap is the error that the value being validated is not a map.
-
- ErrNotMap = errors.New("only a map can be validated")
-
- // ErrKeyWrongType is the error returned in case of an incorrect key type.
-
- ErrKeyWrongType = NewError("validation_key_wrong_type", "key not the correct type")
-
- // ErrKeyMissing is the error returned in case of a missing key.
-
- ErrKeyMissing = NewError("validation_key_missing", "required key is missing")
-
- // ErrKeyUnexpected is the error returned in case of an unexpected key.
-
- ErrKeyUnexpected = NewError("validation_key_unexpected", "key not expected")
-)
-
-type (
-
- // MapRule represents a rule set associated with a map.
-
- MapRule struct {
- keys []*KeyRules
-
- allowExtraKeys bool
- }
-
- // KeyRules represents a rule set associated with a map key.
-
- KeyRules struct {
- key interface{}
-
- optional bool
-
- rules []Rule
- }
-)
-
-// Map returns a validation rule that checks the keys and values of a map.
-
-// This rule should only be used for validating maps, or a validation error will be reported.
-
-// Use Key() to specify map keys that need to be validated. Each Key() call specifies a single key which can
-
-// be associated with multiple rules.
-
-// For example,
-
-//
-
-// validation.Map(
-
-// validation.Key("Name", validation.Required),
-
-// validation.Key("Value", validation.Required, validation.Length(5, 10)),
-
-// )
-
-//
-
-// A nil value is considered valid. Use the Required rule to make sure a map value is present.
-
-func Map(keys ...*KeyRules) MapRule {
-
- return MapRule{keys: keys}
-
-}
-
-// AllowExtraKeys configures the rule to ignore extra keys.
-
-func (r MapRule) AllowExtraKeys() MapRule {
-
- r.allowExtraKeys = true
-
- return r
-
-}
-
-// Validate checks if the given value is valid or not.
-
-func (r MapRule) Validate(m interface{}) error {
-
- return r.ValidateWithContext(nil, m)
-
-}
-
-// ValidateWithContext checks if the given value is valid or not.
-
-func (r MapRule) ValidateWithContext(ctx context.Context, m interface{}) error {
-
- value := reflect.ValueOf(m)
-
- if value.Kind() == reflect.Ptr {
-
- value = value.Elem()
-
- }
-
- if value.Kind() != reflect.Map {
-
- // must be a map
-
- return NewInternalError(ErrNotMap)
-
- }
-
- if value.IsNil() {
-
- // treat a nil map as valid
-
- return nil
-
- }
-
- errs := Errors{}
-
- kt := value.Type().Key()
-
- var extraKeys map[interface{}]bool
-
- if !r.allowExtraKeys {
-
- extraKeys = make(map[interface{}]bool, value.Len())
-
- for _, k := range value.MapKeys() {
-
- extraKeys[k.Interface()] = true
-
- }
-
- }
-
- for _, kr := range r.keys {
-
- var err error
-
- if kv := reflect.ValueOf(kr.key); !kt.AssignableTo(kv.Type()) {
-
- err = ErrKeyWrongType
-
- } else if vv := value.MapIndex(kv); !vv.IsValid() {
-
- if !kr.optional {
-
- err = ErrKeyMissing
-
- }
-
- } else if ctx == nil {
-
- err = Validate(vv.Interface(), kr.rules...)
-
- } else {
-
- err = ValidateWithContext(ctx, vv.Interface(), kr.rules...)
-
- }
-
- if err != nil {
-
- if ie, ok := err.(InternalError); ok && ie.InternalError() != nil {
-
- return err
-
- }
-
- errs[getErrorKeyName(kr.key)] = err
-
- }
-
- if !r.allowExtraKeys {
-
- delete(extraKeys, kr.key)
-
- }
-
- }
-
- if !r.allowExtraKeys {
-
- for key := range extraKeys {
-
- errs[getErrorKeyName(key)] = ErrKeyUnexpected
-
- }
-
- }
-
- if len(errs) > 0 {
-
- return errs
-
- }
-
- return nil
-
-}
-
-// Key specifies a map key and the corresponding validation rules.
-
-func Key(key interface{}, rules ...Rule) *KeyRules {
-
- return &KeyRules{
-
- key: key,
-
- rules: rules,
- }
-
-}
-
-// Optional configures the rule to ignore the key if missing.
-
-func (r *KeyRules) Optional() *KeyRules {
-
- r.optional = true
-
- return r
-
-}
-
-// getErrorKeyName returns the name that should be used to represent the validation error of a map key.
-
-func getErrorKeyName(key interface{}) string {
-
- return fmt.Sprintf("%v", key)
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/match.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/match.go
deleted file mode 100644
index e399bcc..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/match.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "regexp"
-)
-
-// ErrMatchInvalid is the error that returns in case of invalid format.
-var ErrMatchInvalid = NewError("validation_match_invalid", "must be in a valid format")
-
-// Match returns a validation rule that checks if a value matches the specified regular expression.
-// This rule should only be used for validating strings and byte slices, or a validation error will be reported.
-// An empty value is considered valid. Use the Required rule to make sure a value is not empty.
-func Match(re *regexp.Regexp) MatchRule {
- return MatchRule{
- re: re,
- err: ErrMatchInvalid,
- }
-}
-
-// MatchRule is a validation rule that checks if a value matches the specified regular expression.
-type MatchRule struct {
- re *regexp.Regexp
- err Error
-}
-
-// Validate checks if the given value is valid or not.
-func (r MatchRule) Validate(value interface{}) error {
- value, isNil := Indirect(value)
- if isNil {
- return nil
- }
-
- isString, str, isBytes, bs := StringOrBytes(value)
- if isString && (str == "" || r.re.MatchString(str)) {
- return nil
- } else if isBytes && (len(bs) == 0 || r.re.Match(bs)) {
- return nil
- }
- return r.err
-}
-
-// Error sets the error message for the rule.
-func (r MatchRule) Error(message string) MatchRule {
- r.err = r.err.SetMessage(message)
- return r
-}
-
-// ErrorObject sets the error struct for the rule.
-func (r MatchRule) ErrorObject(err Error) MatchRule {
- r.err = err
- return r
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/minmax.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/minmax.go
deleted file mode 100644
index b28ce3b..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/minmax.go
+++ /dev/null
@@ -1,334 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "fmt"
- "reflect"
- "time"
-)
-
-var (
-
- // ErrMinGreaterEqualThanRequired is the error that returns when a value is less than a specified threshold.
-
- ErrMinGreaterEqualThanRequired = NewError("validation_min_greater_equal_than_required", "must be no less than {{.threshold}}")
-
- // ErrMaxLessEqualThanRequired is the error that returns when a value is greater than a specified threshold.
-
- ErrMaxLessEqualThanRequired = NewError("validation_max_less_equal_than_required", "must be no greater than {{.threshold}}")
-
- // ErrMinGreaterThanRequired is the error that returns when a value is less than or equal to a specified threshold.
-
- ErrMinGreaterThanRequired = NewError("validation_min_greater_than_required", "must be greater than {{.threshold}}")
-
- // ErrMaxLessThanRequired is the error that returns when a value is greater than or equal to a specified threshold.
-
- ErrMaxLessThanRequired = NewError("validation_max_less_than_required", "must be less than {{.threshold}}")
-)
-
-// ThresholdRule is a validation rule that checks if a value satisfies the specified threshold requirement.
-
-type ThresholdRule struct {
- threshold interface{}
-
- operator int
-
- err Error
-}
-
-const (
- greaterThan = iota
-
- greaterEqualThan
-
- lessThan
-
- lessEqualThan
-)
-
-// Min returns a validation rule that checks if a value is greater or equal than the specified value.
-
-// By calling Exclusive, the rule will check if the value is strictly greater than the specified value.
-
-// Note that the value being checked and the threshold value must be of the same type.
-
-// Only int, uint, float and time.Time types are supported.
-
-// An empty value is considered valid. Please use the Required rule to make sure a value is not empty.
-
-func Min(min interface{}) ThresholdRule {
-
- return ThresholdRule{
-
- threshold: min,
-
- operator: greaterEqualThan,
-
- err: ErrMinGreaterEqualThanRequired,
- }
-
-}
-
-// Max returns a validation rule that checks if a value is less or equal than the specified value.
-
-// By calling Exclusive, the rule will check if the value is strictly less than the specified value.
-
-// Note that the value being checked and the threshold value must be of the same type.
-
-// Only int, uint, float and time.Time types are supported.
-
-// An empty value is considered valid. Please use the Required rule to make sure a value is not empty.
-
-func Max(max interface{}) ThresholdRule {
-
- return ThresholdRule{
-
- threshold: max,
-
- operator: lessEqualThan,
-
- err: ErrMaxLessEqualThanRequired,
- }
-
-}
-
-// Exclusive sets the comparison to exclude the boundary value.
-
-func (r ThresholdRule) Exclusive() ThresholdRule {
-
- if r.operator == greaterEqualThan {
-
- r.operator = greaterThan
-
- r.err = ErrMinGreaterThanRequired
-
- } else if r.operator == lessEqualThan {
-
- r.operator = lessThan
-
- r.err = ErrMaxLessThanRequired
-
- }
-
- return r
-
-}
-
-// Validate checks if the given value is valid or not.
-
-func (r ThresholdRule) Validate(value interface{}) error {
-
- value, isNil := Indirect(value)
-
- if isNil || IsEmpty(value) {
-
- return nil
-
- }
-
- rv := reflect.ValueOf(r.threshold)
-
- switch rv.Kind() {
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-
- v, err := ToInt(value)
-
- if err != nil {
-
- return err
-
- }
-
- if r.compareInt(rv.Int(), v) {
-
- return nil
-
- }
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
-
- v, err := ToUint(value)
-
- if err != nil {
-
- return err
-
- }
-
- if r.compareUint(rv.Uint(), v) {
-
- return nil
-
- }
-
- case reflect.Float32, reflect.Float64:
-
- v, err := ToFloat(value)
-
- if err != nil {
-
- return err
-
- }
-
- if r.compareFloat(rv.Float(), v) {
-
- return nil
-
- }
-
- case reflect.Struct:
-
- t, ok := r.threshold.(time.Time)
-
- if !ok {
-
- return fmt.Errorf("type not supported: %v", rv.Type())
-
- }
-
- v, ok := value.(time.Time)
-
- if !ok {
-
- return fmt.Errorf("cannot convert %v to time.Time", reflect.TypeOf(value))
-
- }
-
- if v.IsZero() || r.compareTime(t, v) {
-
- return nil
-
- }
-
- default:
-
- return fmt.Errorf("type not supported: %v", rv.Type())
-
- }
-
- return r.err.SetParams(map[string]interface{}{"threshold": r.threshold})
-
-}
-
-// Error sets the error message for the rule.
-
-func (r ThresholdRule) Error(message string) ThresholdRule {
-
- r.err = r.err.SetMessage(message)
-
- return r
-
-}
-
-// ErrorObject sets the error struct for the rule.
-
-func (r ThresholdRule) ErrorObject(err Error) ThresholdRule {
-
- r.err = err
-
- return r
-
-}
-
-func (r ThresholdRule) compareInt(threshold, value int64) bool {
-
- switch r.operator {
-
- case greaterThan:
-
- return value > threshold
-
- case greaterEqualThan:
-
- return value >= threshold
-
- case lessThan:
-
- return value < threshold
-
- default:
-
- return value <= threshold
-
- }
-
-}
-
-func (r ThresholdRule) compareUint(threshold, value uint64) bool {
-
- switch r.operator {
-
- case greaterThan:
-
- return value > threshold
-
- case greaterEqualThan:
-
- return value >= threshold
-
- case lessThan:
-
- return value < threshold
-
- default:
-
- return value <= threshold
-
- }
-
-}
-
-func (r ThresholdRule) compareFloat(threshold, value float64) bool {
-
- switch r.operator {
-
- case greaterThan:
-
- return value > threshold
-
- case greaterEqualThan:
-
- return value >= threshold
-
- case lessThan:
-
- return value < threshold
-
- default:
-
- return value <= threshold
-
- }
-
-}
-
-func (r ThresholdRule) compareTime(threshold, value time.Time) bool {
-
- switch r.operator {
-
- case greaterThan:
-
- return value.After(threshold)
-
- case greaterEqualThan:
-
- return value.After(threshold) || value.Equal(threshold)
-
- case lessThan:
-
- return value.Before(threshold)
-
- default:
-
- return value.Before(threshold) || value.Equal(threshold)
-
- }
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/multipleof.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/multipleof.go
deleted file mode 100644
index e6714f5..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/multipleof.go
+++ /dev/null
@@ -1,103 +0,0 @@
-package validation
-
-import (
- "fmt"
- "reflect"
-)
-
-// ErrMultipleOfInvalid is the error that returns when a value is not multiple of a base.
-
-var ErrMultipleOfInvalid = NewError("validation_multiple_of_invalid", "must be multiple of {{.base}}")
-
-// MultipleOf returns a validation rule that checks if a value is a multiple of the "base" value.
-
-// Note that "base" should be of integer type.
-
-func MultipleOf(base interface{}) MultipleOfRule {
-
- return MultipleOfRule{
-
- base: base,
-
- err: ErrMultipleOfInvalid,
- }
-
-}
-
-// MultipleOfRule is a validation rule that checks if a value is a multiple of the "base" value.
-
-type MultipleOfRule struct {
- base interface{}
-
- err Error
-}
-
-// Error sets the error message for the rule.
-
-func (r MultipleOfRule) Error(message string) MultipleOfRule {
-
- r.err = r.err.SetMessage(message)
-
- return r
-
-}
-
-// ErrorObject sets the error struct for the rule.
-
-func (r MultipleOfRule) ErrorObject(err Error) MultipleOfRule {
-
- r.err = err
-
- return r
-
-}
-
-// Validate checks if the value is a multiple of the "base" value.
-
-func (r MultipleOfRule) Validate(value interface{}) error {
-
- rv := reflect.ValueOf(r.base)
-
- switch rv.Kind() {
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-
- v, err := ToInt(value)
-
- if err != nil {
-
- return err
-
- }
-
- if v%rv.Int() == 0 {
-
- return nil
-
- }
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
-
- v, err := ToUint(value)
-
- if err != nil {
-
- return err
-
- }
-
- if v%rv.Uint() == 0 {
-
- return nil
-
- }
-
- default:
-
- return fmt.Errorf("type not supported: %v", rv.Type())
-
- }
-
- return r.err.SetParams(map[string]interface{}{"base": r.base})
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/not_in.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/not_in.go
deleted file mode 100644
index 6e35d75..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/not_in.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2018 Qiang Xue, Google LLC. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package validation
-
-// ErrNotInInvalid is the error that returns when a value is in a list.
-var ErrNotInInvalid = NewError("validation_not_in_invalid", "must not be in list")
-
-// NotIn returns a validation rule that checks if a value is absent from the given list of values.
-// Note that the value being checked and the possible range of values must be of the same type.
-// An empty value is considered valid. Use the Required rule to make sure a value is not empty.
-func NotIn(values ...interface{}) NotInRule {
- return NotInRule{
- elements: values,
- err: ErrNotInInvalid,
- }
-}
-
-// NotInRule is a validation rule that checks if a value is absent from the given list of values.
-type NotInRule struct {
- elements []interface{}
- err Error
-}
-
-// Validate checks if the given value is valid or not.
-func (r NotInRule) Validate(value interface{}) error {
- value, isNil := Indirect(value)
- if isNil || IsEmpty(value) {
- return nil
- }
-
- for _, e := range r.elements {
- if e == value {
- return r.err
- }
- }
- return nil
-}
-
-// Error sets the error message for the rule.
-func (r NotInRule) Error(message string) NotInRule {
- r.err = r.err.SetMessage(message)
- return r
-}
-
-// ErrorObject sets the error struct for the rule.
-func (r NotInRule) ErrorObject(err Error) NotInRule {
- r.err = err
- return r
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/not_nil.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/not_nil.go
deleted file mode 100644
index aaeb067..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/not_nil.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package validation
-
-// ErrNotNilRequired is the error that returns when a value is Nil.
-var ErrNotNilRequired = NewError("validation_not_nil_required", "is required")
-
-// NotNil is a validation rule that checks if a value is not nil.
-// NotNil only handles types including interface, pointer, slice, and map.
-// All other types are considered valid.
-var NotNil = notNilRule{}
-
-type notNilRule struct {
- err Error
-}
-
-// Validate checks if the given value is valid or not.
-func (r notNilRule) Validate(value interface{}) error {
- _, isNil := Indirect(value)
- if isNil {
- if r.err != nil {
- return r.err
- }
- return ErrNotNilRequired
- }
- return nil
-}
-
-// Error sets the error message for the rule.
-func (r notNilRule) Error(message string) notNilRule {
- if r.err == nil {
- r.err = ErrNotNilRequired
- }
- r.err = r.err.SetMessage(message)
- return r
-}
-
-// ErrorObject sets the error struct for the rule.
-func (r notNilRule) ErrorObject(err Error) notNilRule {
- r.err = err
- return r
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/required.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/required.go
deleted file mode 100644
index 61b888b..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/required.go
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package validation
-
-var (
- // ErrRequired is the error that returns when a value is required.
- ErrRequired = NewError("validation_required", "cannot be blank")
- // ErrNilOrNotEmpty is the error that returns when a value is not nil and is empty.
- ErrNilOrNotEmpty = NewError("validation_nil_or_not_empty_required", "cannot be blank")
-)
-
-// Required is a validation rule that checks if a value is not empty.
-// A value is considered not empty if
-// - integer, float: not zero
-// - bool: true
-// - string, array, slice, map: len() > 0
-// - interface, pointer: not nil and the referenced value is not empty
-// - any other types
-var Required = RequiredRule{skipNil: false, condition: true}
-
-// NilOrNotEmpty checks if a value is a nil pointer or a value that is not empty.
-// NilOrNotEmpty differs from Required in that it treats a nil pointer as valid.
-var NilOrNotEmpty = RequiredRule{skipNil: true, condition: true}
-
-// RequiredRule is a rule that checks if a value is not empty.
-type RequiredRule struct {
- condition bool
- skipNil bool
- err Error
-}
-
-// Validate checks if the given value is valid or not.
-func (r RequiredRule) Validate(value interface{}) error {
- if r.condition {
- value, isNil := Indirect(value)
- if r.skipNil && !isNil && IsEmpty(value) || !r.skipNil && (isNil || IsEmpty(value)) {
- if r.err != nil {
- return r.err
- }
- if r.skipNil {
- return ErrNilOrNotEmpty
- }
- return ErrRequired
- }
- }
- return nil
-}
-
-// When sets the condition that determines if the validation should be performed.
-func (r RequiredRule) When(condition bool) RequiredRule {
- r.condition = condition
- return r
-}
-
-// Error sets the error message for the rule.
-func (r RequiredRule) Error(message string) RequiredRule {
- if r.err == nil {
- if r.skipNil {
- r.err = ErrNilOrNotEmpty
- } else {
- r.err = ErrRequired
- }
- }
- r.err = r.err.SetMessage(message)
- return r
-}
-
-// ErrorObject sets the error struct for the rule.
-func (r RequiredRule) ErrorObject(err Error) RequiredRule {
- r.err = err
- return r
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/string.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/string.go
deleted file mode 100644
index d6d45d8..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/string.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package validation
-
-type stringValidator func(string) bool
-
-// StringRule is a rule that checks a string variable using a specified stringValidator.
-type StringRule struct {
- validate stringValidator
- err Error
-}
-
-// NewStringRule creates a new validation rule using a function that takes a string value and returns a bool.
-// The rule returned will use the function to check if a given string or byte slice is valid or not.
-// An empty value is considered to be valid. Please use the Required rule to make sure a value is not empty.
-func NewStringRule(validator stringValidator, message string) StringRule {
- return StringRule{
- validate: validator,
- err: NewError("", message),
- }
-}
-
-// NewStringRuleWithError creates a new validation rule using a function that takes a string value and returns a bool.
-// The rule returned will use the function to check if a given string or byte slice is valid or not.
-// An empty value is considered to be valid. Please use the Required rule to make sure a value is not empty.
-func NewStringRuleWithError(validator stringValidator, err Error) StringRule {
- return StringRule{
- validate: validator,
- err: err,
- }
-}
-
-// Error sets the error message for the rule.
-func (r StringRule) Error(message string) StringRule {
- r.err = r.err.SetMessage(message)
- return r
-}
-
-// ErrorObject sets the error struct for the rule.
-func (r StringRule) ErrorObject(err Error) StringRule {
- r.err = err
- return r
-}
-
-// Validate checks if the given value is valid or not.
-func (r StringRule) Validate(value interface{}) error {
- value, isNil := Indirect(value)
- if isNil || IsEmpty(value) {
- return nil
- }
-
- str, err := EnsureString(value)
- if err != nil {
- return err
- }
-
- if r.validate(str) {
- return nil
- }
-
- return r.err
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/struct.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/struct.go
deleted file mode 100644
index c4bd630..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/struct.go
+++ /dev/null
@@ -1,294 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "context"
- "errors"
- "fmt"
- "reflect"
- "strings"
-)
-
-var (
-
- // ErrStructPointer is the error that a struct being validated is not specified as a pointer.
-
- ErrStructPointer = errors.New("only a pointer to a struct can be validated")
-)
-
-type (
-
- // ErrFieldPointer is the error that a field is not specified as a pointer.
-
- ErrFieldPointer int
-
- // ErrFieldNotFound is the error that a field cannot be found in the struct.
-
- ErrFieldNotFound int
-
- // FieldRules represents a rule set associated with a struct field.
-
- FieldRules struct {
- fieldPtr interface{}
-
- rules []Rule
- }
-)
-
-// Error returns the error string of ErrFieldPointer.
-
-func (e ErrFieldPointer) Error() string {
-
- return fmt.Sprintf("field #%v must be specified as a pointer", int(e))
-
-}
-
-// Error returns the error string of ErrFieldNotFound.
-
-func (e ErrFieldNotFound) Error() string {
-
- return fmt.Sprintf("field #%v cannot be found in the struct", int(e))
-
-}
-
-// ValidateStruct validates a struct by checking the specified struct fields against the corresponding validation rules.
-
-// Note that the struct being validated must be specified as a pointer to it. If the pointer is nil, it is considered valid.
-
-// Use Field() to specify struct fields that need to be validated. Each Field() call specifies a single field which
-
-// should be specified as a pointer to the field. A field can be associated with multiple rules.
-
-// For example,
-
-//
-
-// value := struct {
-
-// Name string
-
-// Value string
-
-// }{"name", "demo"}
-
-// err := validation.ValidateStruct(&value,
-
-// validation.Field(&a.Name, validation.Required),
-
-// validation.Field(&a.Value, validation.Required, validation.Length(5, 10)),
-
-// )
-
-// fmt.Println(err)
-
-// // Value: the length must be between 5 and 10.
-
-//
-
-// An error will be returned if validation fails.
-
-func ValidateStruct(structPtr interface{}, fields ...*FieldRules) error {
-
- return ValidateStructWithContext(nil, structPtr, fields...)
-
-}
-
-// ValidateStructWithContext validates a struct with the given context.
-
-// The only difference between ValidateStructWithContext and ValidateStruct is that the former will
-
-// validate struct fields with the provided context.
-
-// Please refer to ValidateStruct for the detailed instructions on how to use this function.
-
-func ValidateStructWithContext(ctx context.Context, structPtr interface{}, fields ...*FieldRules) error {
-
- value := reflect.ValueOf(structPtr)
-
- if value.Kind() != reflect.Ptr || !value.IsNil() && value.Elem().Kind() != reflect.Struct {
-
- // must be a pointer to a struct
-
- return NewInternalError(ErrStructPointer)
-
- }
-
- if value.IsNil() {
-
- // treat a nil struct pointer as valid
-
- return nil
-
- }
-
- value = value.Elem()
-
- errs := Errors{}
-
- for i, fr := range fields {
-
- fv := reflect.ValueOf(fr.fieldPtr)
-
- if fv.Kind() != reflect.Ptr {
-
- return NewInternalError(ErrFieldPointer(i))
-
- }
-
- ft := findStructField(value, fv)
-
- if ft == nil {
-
- return NewInternalError(ErrFieldNotFound(i))
-
- }
-
- var err error
-
- if ctx == nil {
-
- err = Validate(fv.Elem().Interface(), fr.rules...)
-
- } else {
-
- err = ValidateWithContext(ctx, fv.Elem().Interface(), fr.rules...)
-
- }
-
- if err != nil {
-
- if ie, ok := err.(InternalError); ok && ie.InternalError() != nil {
-
- return err
-
- }
-
- if ft.Anonymous {
-
- // merge errors from anonymous struct field
-
- if es, ok := err.(Errors); ok {
-
- for name, value := range es {
-
- errs[name] = value
-
- }
-
- continue
-
- }
-
- }
-
- errs[getErrorFieldName(ft)] = err
-
- }
-
- }
-
- if len(errs) > 0 {
-
- return errs
-
- }
-
- return nil
-
-}
-
-// Field specifies a struct field and the corresponding validation rules.
-
-// The struct field must be specified as a pointer to it.
-
-func Field(fieldPtr interface{}, rules ...Rule) *FieldRules {
-
- return &FieldRules{
-
- fieldPtr: fieldPtr,
-
- rules: rules,
- }
-
-}
-
-// findStructField looks for a field in the given struct.
-
-// The field being looked for should be a pointer to the actual struct field.
-
-// If found, the field info will be returned. Otherwise, nil will be returned.
-
-func findStructField(structValue reflect.Value, fieldValue reflect.Value) *reflect.StructField {
-
- ptr := fieldValue.Pointer()
-
- for i := structValue.NumField() - 1; i >= 0; i-- {
-
- sf := structValue.Type().Field(i)
-
- if ptr == structValue.Field(i).UnsafeAddr() {
-
- // do additional type comparison because it's possible that the address of
-
- // an embedded struct is the same as the first field of the embedded struct
-
- if sf.Type == fieldValue.Elem().Type() {
-
- return &sf
-
- }
-
- }
-
- if sf.Anonymous {
-
- // delve into anonymous struct to look for the field
-
- fi := structValue.Field(i)
-
- if sf.Type.Kind() == reflect.Ptr {
-
- fi = fi.Elem()
-
- }
-
- if fi.Kind() == reflect.Struct {
-
- if f := findStructField(fi, fieldValue); f != nil {
-
- return f
-
- }
-
- }
-
- }
-
- }
-
- return nil
-
-}
-
-// getErrorFieldName returns the name that should be used to represent the validation error of a struct field.
-
-func getErrorFieldName(f *reflect.StructField) string {
-
- if tag := f.Tag.Get(ErrorTag); tag != "" && tag != "-" {
-
- if cps := strings.SplitN(tag, ",", 2); cps[0] != "" {
-
- return cps[0]
-
- }
-
- }
-
- return f.Name
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/util.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/util.go
deleted file mode 100644
index 8db818b..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/util.go
+++ /dev/null
@@ -1,287 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-package validation
-
-import (
- "database/sql/driver"
- "errors"
- "fmt"
- "reflect"
- "time"
-)
-
-var (
- bytesType = reflect.TypeOf([]byte(nil))
-
- valuerType = reflect.TypeOf((*driver.Valuer)(nil)).Elem()
-)
-
-// EnsureString ensures the given value is a string.
-
-// If the value is a byte slice, it will be typecast into a string.
-
-// An error is returned otherwise.
-
-func EnsureString(value interface{}) (string, error) {
-
- v := reflect.ValueOf(value)
-
- if v.Kind() == reflect.String {
-
- return v.String(), nil
-
- }
-
- if v.Type() == bytesType {
-
- return string(v.Interface().([]byte)), nil
-
- }
-
- return "", errors.New("must be either a string or byte slice")
-
-}
-
-// StringOrBytes typecasts a value into a string or byte slice.
-
-// Boolean flags are returned to indicate if the typecasting succeeds or not.
-
-func StringOrBytes(value interface{}) (isString bool, str string, isBytes bool, bs []byte) {
-
- v := reflect.ValueOf(value)
-
- if v.Kind() == reflect.String {
-
- str = v.String()
-
- isString = true
-
- } else if v.Kind() == reflect.Slice && v.Type() == bytesType {
-
- bs = v.Interface().([]byte)
-
- isBytes = true
-
- }
-
- return
-
-}
-
-// LengthOfValue returns the length of a value that is a string, slice, map, or array.
-
-// An error is returned for all other types.
-
-func LengthOfValue(value interface{}) (int, error) {
-
- v := reflect.ValueOf(value)
-
- switch v.Kind() {
-
- case reflect.String, reflect.Slice, reflect.Map, reflect.Array:
-
- return v.Len(), nil
-
- }
-
- return 0, fmt.Errorf("cannot get the length of %v", v.Kind())
-
-}
-
-// ToInt converts the given value to an int64.
-
-// An error is returned for all incompatible types.
-
-func ToInt(value interface{}) (int64, error) {
-
- v := reflect.ValueOf(value)
-
- switch v.Kind() {
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-
- return v.Int(), nil
-
- }
-
- return 0, fmt.Errorf("cannot convert %v to int64", v.Kind())
-
-}
-
-// ToUint converts the given value to an uint64.
-
-// An error is returned for all incompatible types.
-
-func ToUint(value interface{}) (uint64, error) {
-
- v := reflect.ValueOf(value)
-
- switch v.Kind() {
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
-
- return v.Uint(), nil
-
- }
-
- return 0, fmt.Errorf("cannot convert %v to uint64", v.Kind())
-
-}
-
-// ToFloat converts the given value to a float64.
-
-// An error is returned for all incompatible types.
-
-func ToFloat(value interface{}) (float64, error) {
-
- v := reflect.ValueOf(value)
-
- switch v.Kind() {
-
- case reflect.Float32, reflect.Float64:
-
- return v.Float(), nil
-
- }
-
- return 0, fmt.Errorf("cannot convert %v to float64", v.Kind())
-
-}
-
-// IsEmpty checks if a value is empty or not.
-
-// A value is considered empty if
-
-// - integer, float: zero
-
-// - bool: false
-
-// - string, array: len() == 0
-
-// - slice, map: nil or len() == 0
-
-// - interface, pointer: nil or the referenced value is empty
-
-func IsEmpty(value interface{}) bool {
-
- v := reflect.ValueOf(value)
-
- switch v.Kind() {
-
- case reflect.String, reflect.Array, reflect.Map, reflect.Slice:
-
- return v.Len() == 0
-
- case reflect.Bool:
-
- return !v.Bool()
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-
- return v.Int() == 0
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
-
- return v.Uint() == 0
-
- case reflect.Float32, reflect.Float64:
-
- return v.Float() == 0
-
- case reflect.Invalid:
-
- return true
-
- case reflect.Interface, reflect.Ptr:
-
- if v.IsNil() {
-
- return true
-
- }
-
- return IsEmpty(v.Elem().Interface())
-
- case reflect.Struct:
-
- v, ok := value.(time.Time)
-
- if ok && v.IsZero() {
-
- return true
-
- }
-
- }
-
- return false
-
-}
-
-// Indirect returns the value that the given interface or pointer references to.
-
-// If the value implements driver.Valuer, it will deal with the value returned by
-
-// the Value() method instead. A boolean value is also returned to indicate if
-
-// the value is nil or not (only applicable to interface, pointer, map, and slice).
-
-// If the value is neither an interface nor a pointer, it will be returned back.
-
-func Indirect(value interface{}) (interface{}, bool) {
-
- rv := reflect.ValueOf(value)
-
- kind := rv.Kind()
-
- switch kind {
-
- case reflect.Invalid:
-
- return nil, true
-
- case reflect.Ptr, reflect.Interface:
-
- if rv.IsNil() {
-
- return nil, true
-
- }
-
- return Indirect(rv.Elem().Interface())
-
- case reflect.Slice, reflect.Map, reflect.Func, reflect.Chan:
-
- if rv.IsNil() {
-
- return nil, true
-
- }
-
- }
-
- if rv.Type().Implements(valuerType) {
-
- return indirectValuer(value.(driver.Valuer))
-
- }
-
- return value, false
-
-}
-
-func indirectValuer(valuer driver.Valuer) (interface{}, bool) {
-
- if value, err := valuer.Value(); value != nil && err == nil {
-
- return Indirect(value)
-
- }
-
- return nil, true
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/validation.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/validation.go
deleted file mode 100644
index 837c0da..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/validation.go
+++ /dev/null
@@ -1,460 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-// Package validation provides configurable and extensible rules for validating data of various types.
-
-package validation
-
-import (
- "context"
- "fmt"
- "reflect"
- "strconv"
-)
-
-type (
-
- // Validatable is the interface indicating the type implementing it supports data validation.
-
- Validatable interface {
-
- // Validate validates the data and returns an error if validation fails.
-
- Validate() error
- }
-
- // ValidatableWithContext is the interface indicating the type implementing it supports context-aware data validation.
-
- ValidatableWithContext interface {
-
- // ValidateWithContext validates the data with the given context and returns an error if validation fails.
-
- ValidateWithContext(ctx context.Context) error
- }
-
- // Rule represents a validation rule.
-
- Rule interface {
-
- // Validate validates a value and returns a value if validation fails.
-
- Validate(value interface{}) error
- }
-
- // RuleWithContext represents a context-aware validation rule.
-
- RuleWithContext interface {
-
- // ValidateWithContext validates a value and returns a value if validation fails.
-
- ValidateWithContext(ctx context.Context, value interface{}) error
- }
-
- // RuleFunc represents a validator function.
-
- // You may wrap it as a Rule by calling By().
-
- RuleFunc func(value interface{}) error
-
- // RuleWithContextFunc represents a validator function that is context-aware.
-
- // You may wrap it as a Rule by calling WithContext().
-
- RuleWithContextFunc func(ctx context.Context, value interface{}) error
-)
-
-var (
-
- // ErrorTag is the struct tag name used to customize the error field name for a struct field.
-
- ErrorTag = "json"
-
- // Skip is a special validation rule that indicates all rules following it should be skipped.
-
- Skip = skipRule{skip: true}
-
- validatableType = reflect.TypeOf((*Validatable)(nil)).Elem()
-
- validatableWithContextType = reflect.TypeOf((*ValidatableWithContext)(nil)).Elem()
-)
-
-// Validate validates the given value and returns the validation error, if any.
-
-//
-
-// Validate performs validation using the following steps:
-
-// 1. For each rule, call its `Validate()` to validate the value. Return if any error is found.
-
-// 2. If the value being validated implements `Validatable`, call the value's `Validate()`.
-
-// Return with the validation result.
-
-// 3. If the value being validated is a map/slice/array, and the element type implements `Validatable`,
-
-// for each element call the element value's `Validate()`. Return with the validation result.
-
-func Validate(value interface{}, rules ...Rule) error {
-
- for _, rule := range rules {
-
- if s, ok := rule.(skipRule); ok && s.skip {
-
- return nil
-
- }
-
- if err := rule.Validate(value); err != nil {
-
- return err
-
- }
-
- }
-
- rv := reflect.ValueOf(value)
-
- if (rv.Kind() == reflect.Ptr || rv.Kind() == reflect.Interface) && rv.IsNil() {
-
- return nil
-
- }
-
- if v, ok := value.(Validatable); ok {
-
- return v.Validate()
-
- }
-
- switch rv.Kind() {
-
- case reflect.Map:
-
- if rv.Type().Elem().Implements(validatableType) {
-
- return validateMap(rv)
-
- }
-
- case reflect.Slice, reflect.Array:
-
- if rv.Type().Elem().Implements(validatableType) {
-
- return validateSlice(rv)
-
- }
-
- case reflect.Ptr, reflect.Interface:
-
- return Validate(rv.Elem().Interface())
-
- }
-
- return nil
-
-}
-
-// ValidateWithContext validates the given value with the given context and returns the validation error, if any.
-
-//
-
-// ValidateWithContext performs validation using the following steps:
-
-// 1. For each rule, call its `ValidateWithContext()` to validate the value if the rule implements `RuleWithContext`.
-
-// Otherwise call `Validate()` of the rule. Return if any error is found.
-
-// 2. If the value being validated implements `ValidatableWithContext`, call the value's `ValidateWithContext()`
-
-// and return with the validation result.
-
-// 3. If the value being validated implements `Validatable`, call the value's `Validate()`
-
-// and return with the validation result.
-
-// 4. If the value being validated is a map/slice/array, and the element type implements `ValidatableWithContext`,
-
-// for each element call the element value's `ValidateWithContext()`. Return with the validation result.
-
-// 5. If the value being validated is a map/slice/array, and the element type implements `Validatable`,
-
-// for each element call the element value's `Validate()`. Return with the validation result.
-
-func ValidateWithContext(ctx context.Context, value interface{}, rules ...Rule) error {
-
- for _, rule := range rules {
-
- if s, ok := rule.(skipRule); ok && s.skip {
-
- return nil
-
- }
-
- if rc, ok := rule.(RuleWithContext); ok {
-
- if err := rc.ValidateWithContext(ctx, value); err != nil {
-
- return err
-
- }
-
- } else if err := rule.Validate(value); err != nil {
-
- return err
-
- }
-
- }
-
- rv := reflect.ValueOf(value)
-
- if (rv.Kind() == reflect.Ptr || rv.Kind() == reflect.Interface) && rv.IsNil() {
-
- return nil
-
- }
-
- if v, ok := value.(ValidatableWithContext); ok {
-
- return v.ValidateWithContext(ctx)
-
- }
-
- if v, ok := value.(Validatable); ok {
-
- return v.Validate()
-
- }
-
- switch rv.Kind() {
-
- case reflect.Map:
-
- if rv.Type().Elem().Implements(validatableWithContextType) {
-
- return validateMapWithContext(ctx, rv)
-
- }
-
- if rv.Type().Elem().Implements(validatableType) {
-
- return validateMap(rv)
-
- }
-
- case reflect.Slice, reflect.Array:
-
- if rv.Type().Elem().Implements(validatableWithContextType) {
-
- return validateSliceWithContext(ctx, rv)
-
- }
-
- if rv.Type().Elem().Implements(validatableType) {
-
- return validateSlice(rv)
-
- }
-
- case reflect.Ptr, reflect.Interface:
-
- return ValidateWithContext(ctx, rv.Elem().Interface())
-
- }
-
- return nil
-
-}
-
-// validateMap validates a map of validatable elements
-
-func validateMap(rv reflect.Value) error {
-
- errs := Errors{}
-
- for _, key := range rv.MapKeys() {
-
- if mv := rv.MapIndex(key).Interface(); mv != nil {
-
- if err := mv.(Validatable).Validate(); err != nil {
-
- errs[fmt.Sprintf("%v", key.Interface())] = err
-
- }
-
- }
-
- }
-
- if len(errs) > 0 {
-
- return errs
-
- }
-
- return nil
-
-}
-
-// validateMapWithContext validates a map of validatable elements with the given context.
-
-func validateMapWithContext(ctx context.Context, rv reflect.Value) error {
-
- errs := Errors{}
-
- for _, key := range rv.MapKeys() {
-
- if mv := rv.MapIndex(key).Interface(); mv != nil {
-
- if err := mv.(ValidatableWithContext).ValidateWithContext(ctx); err != nil {
-
- errs[fmt.Sprintf("%v", key.Interface())] = err
-
- }
-
- }
-
- }
-
- if len(errs) > 0 {
-
- return errs
-
- }
-
- return nil
-
-}
-
-// validateSlice validates a slice/array of validatable elements
-
-func validateSlice(rv reflect.Value) error {
-
- errs := Errors{}
-
- l := rv.Len()
-
- for i := 0; i < l; i++ {
-
- if ev := rv.Index(i).Interface(); ev != nil {
-
- if err := ev.(Validatable).Validate(); err != nil {
-
- errs[strconv.Itoa(i)] = err
-
- }
-
- }
-
- }
-
- if len(errs) > 0 {
-
- return errs
-
- }
-
- return nil
-
-}
-
-// validateSliceWithContext validates a slice/array of validatable elements with the given context.
-
-func validateSliceWithContext(ctx context.Context, rv reflect.Value) error {
-
- errs := Errors{}
-
- l := rv.Len()
-
- for i := 0; i < l; i++ {
-
- if ev := rv.Index(i).Interface(); ev != nil {
-
- if err := ev.(ValidatableWithContext).ValidateWithContext(ctx); err != nil {
-
- errs[strconv.Itoa(i)] = err
-
- }
-
- }
-
- }
-
- if len(errs) > 0 {
-
- return errs
-
- }
-
- return nil
-
-}
-
-type skipRule struct {
- skip bool
-}
-
-func (r skipRule) Validate(interface{}) error {
-
- return nil
-
-}
-
-// When determines if all rules following it should be skipped.
-
-func (r skipRule) When(condition bool) skipRule {
-
- r.skip = condition
-
- return r
-
-}
-
-type inlineRule struct {
- f RuleFunc
-
- fc RuleWithContextFunc
-}
-
-func (r *inlineRule) Validate(value interface{}) error {
-
- if r.f == nil {
-
- return r.fc(context.Background(), value)
-
- }
-
- return r.f(value)
-
-}
-
-func (r *inlineRule) ValidateWithContext(ctx context.Context, value interface{}) error {
-
- if r.fc == nil {
-
- return r.f(value)
-
- }
-
- return r.fc(ctx, value)
-
-}
-
-// By wraps a RuleFunc into a Rule.
-
-func By(f RuleFunc) Rule {
-
- return &inlineRule{f: f}
-
-}
-
-// WithContext wraps a RuleWithContextFunc into a context-aware Rule.
-
-func WithContext(f RuleWithContextFunc) Rule {
-
- return &inlineRule{fc: f}
-
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/when.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/when.go
deleted file mode 100644
index 7bcdff5..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/v4/when.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package validation
-
-import "context"
-
-// When returns a validation rule that executes the given list of rules when the condition is true.
-func When(condition bool, rules ...Rule) WhenRule {
- return WhenRule{
- condition: condition,
- rules: rules,
- elseRules: []Rule{},
- }
-}
-
-// WhenRule is a validation rule that executes the given list of rules when the condition is true.
-type WhenRule struct {
- condition bool
- rules []Rule
- elseRules []Rule
-}
-
-// Validate checks if the condition is true and if so, it validates the value using the specified rules.
-func (r WhenRule) Validate(value interface{}) error {
- return r.ValidateWithContext(nil, value)
-}
-
-// ValidateWithContext checks if the condition is true and if so, it validates the value using the specified rules.
-func (r WhenRule) ValidateWithContext(ctx context.Context, value interface{}) error {
- if r.condition {
- if ctx == nil {
- return Validate(value, r.rules...)
- } else {
- return ValidateWithContext(ctx, value, r.rules...)
- }
- }
-
- if ctx == nil {
- return Validate(value, r.elseRules...)
- } else {
- return ValidateWithContext(ctx, value, r.elseRules...)
- }
-}
-
-// Else returns a validation rule that executes the given list of rules when the condition is false.
-func (r WhenRule) Else(rules ...Rule) WhenRule {
- r.elseRules = rules
- return r
-}
diff --git a/vendor/github.com/go-ozzo/ozzo-validation/validation.go b/vendor/github.com/go-ozzo/ozzo-validation/validation.go
deleted file mode 100644
index c3f31c2..0000000
--- a/vendor/github.com/go-ozzo/ozzo-validation/validation.go
+++ /dev/null
@@ -1,215 +0,0 @@
-// Copyright 2016 Qiang Xue. All rights reserved.
-
-// Use of this source code is governed by a MIT-style
-
-// license that can be found in the LICENSE file.
-
-// Package validation provides configurable and extensible rules for validating data of various types.
-
-package validation
-
-import (
- "fmt"
- "reflect"
- "strconv"
-)
-
-type (
-
- // Validatable is the interface indicating the type implementing it supports data validation.
-
- Validatable interface {
-
- // Validate validates the data and returns an error if validation fails.
-
- Validate() error
- }
-
- // Rule represents a validation rule.
-
- Rule interface {
-
- // Validate validates a value and returns a value if validation fails.
-
- Validate(value interface{}) error
- }
-
- // RuleFunc represents a validator function.
-
- // You may wrap it as a Rule by calling By().
-
- RuleFunc func(value interface{}) error
-)
-
-var (
-
- // ErrorTag is the struct tag name used to customize the error field name for a struct field.
-
- ErrorTag = "json"
-
- // Skip is a special validation rule that indicates all rules following it should be skipped.
-
- Skip = &skipRule{}
-
- validatableType = reflect.TypeOf((*Validatable)(nil)).Elem()
-)
-
-// Validate validates the given value and returns the validation error, if any.
-
-//
-
-// Validate performs validation using the following steps:
-
-// - validate the value against the rules passed in as parameters
-
-// - if the value is a map and the map values implement `Validatable`, call `Validate` of every map value
-
-// - if the value is a slice or array whose values implement `Validatable`, call `Validate` of every element
-
-func Validate(value interface{}, rules ...Rule) error {
-
- for _, rule := range rules {
-
- if _, ok := rule.(*skipRule); ok {
-
- return nil
-
- }
-
- if err := rule.Validate(value); err != nil {
-
- return err
-
- }
-
- }
-
- rv := reflect.ValueOf(value)
-
- if (rv.Kind() == reflect.Ptr || rv.Kind() == reflect.Interface) && rv.IsNil() {
-
- return nil
-
- }
-
- if v, ok := value.(Validatable); ok {
-
- return v.Validate()
-
- }
-
- switch rv.Kind() {
-
- case reflect.Map:
-
- if rv.Type().Elem().Implements(validatableType) {
-
- return validateMap(rv)
-
- }
-
- case reflect.Slice, reflect.Array:
-
- if rv.Type().Elem().Implements(validatableType) {
-
- return validateSlice(rv)
-
- }
-
- case reflect.Ptr, reflect.Interface:
-
- return Validate(rv.Elem().Interface())
-
- }
-
- return nil
-
-}
-
-// validateMap validates a map of validatable elements
-
-func validateMap(rv reflect.Value) error {
-
- errs := Errors{}
-
- for _, key := range rv.MapKeys() {
-
- if mv := rv.MapIndex(key).Interface(); mv != nil {
-
- if err := mv.(Validatable).Validate(); err != nil {
-
- errs[fmt.Sprintf("%v", key.Interface())] = err
-
- }
-
- }
-
- }
-
- if len(errs) > 0 {
-
- return errs
-
- }
-
- return nil
-
-}
-
-// validateMap validates a slice/array of validatable elements
-
-func validateSlice(rv reflect.Value) error {
-
- errs := Errors{}
-
- l := rv.Len()
-
- for i := 0; i < l; i++ {
-
- if ev := rv.Index(i).Interface(); ev != nil {
-
- if err := ev.(Validatable).Validate(); err != nil {
-
- errs[strconv.Itoa(i)] = err
-
- }
-
- }
-
- }
-
- if len(errs) > 0 {
-
- return errs
-
- }
-
- return nil
-
-}
-
-type skipRule struct{}
-
-func (r *skipRule) Validate(interface{}) error {
-
- return nil
-
-}
-
-type inlineRule struct {
- f RuleFunc
-}
-
-func (r *inlineRule) Validate(value interface{}) error {
-
- return r.f(value)
-
-}
-
-// By wraps a RuleFunc into a Rule.
-
-func By(f RuleFunc) Rule {
-
- return &inlineRule{f}
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/.gitignore b/vendor/github.com/go-sql-driver/mysql/.gitignore
deleted file mode 100644
index 2de28da..0000000
--- a/vendor/github.com/go-sql-driver/mysql/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-.DS_Store
-.DS_Store?
-._*
-.Spotlight-V100
-.Trashes
-Icon?
-ehthumbs.db
-Thumbs.db
-.idea
diff --git a/vendor/github.com/go-sql-driver/mysql/AUTHORS b/vendor/github.com/go-sql-driver/mysql/AUTHORS
deleted file mode 100644
index 50afa2c..0000000
--- a/vendor/github.com/go-sql-driver/mysql/AUTHORS
+++ /dev/null
@@ -1,117 +0,0 @@
-# This is the official list of Go-MySQL-Driver authors for copyright purposes.
-
-# If you are submitting a patch, please add your name or the name of the
-# organization which holds the copyright to this list in alphabetical order.
-
-# Names should be added to this file as
-# Name
-# The email address is not required for organizations.
-# Please keep the list sorted.
-
-
-# Individual Persons
-
-Aaron Hopkins
-Achille Roussel
-Alex Snast
-Alexey Palazhchenko
-Andrew Reid
-Animesh Ray
-Arne Hormann
-Ariel Mashraki
-Asta Xie
-Bulat Gaifullin
-Caine Jette
-Carlos Nieto
-Chris Moos
-Craig Wilson
-Daniel Montoya
-Daniel Nichter
-Daniël van Eeden
-Dave Protasowski
-DisposaBoy
-Egor Smolyakov
-Erwan Martin
-Evan Shaw
-Frederick Mayle
-Gustavo Kristic
-Hajime Nakagami
-Hanno Braun
-Henri Yandell
-Hirotaka Yamamoto
-Huyiguang
-ICHINOSE Shogo
-Ilia Cimpoes
-INADA Naoki
-Jacek Szwec
-James Harr
-Jeff Hodges
-Jeffrey Charles
-Jerome Meyer
-Jiajia Zhong
-Jian Zhen
-Joshua Prunier
-Julien Lefevre
-Julien Schmidt
-Justin Li
-Justin Nuß
-Kamil Dziedzic
-Kei Kamikawa
-Kevin Malachowski
-Kieron Woodhouse
-Lennart Rudolph
-Leonardo YongUk Kim
-Linh Tran Tuan
-Lion Yang
-Luca Looz
-Lucas Liu
-Luke Scott
-Maciej Zimnoch
-Michael Woolnough
-Nathanial Murphy
-Nicola Peduzzi
-Olivier Mengué
-oscarzhao
-Paul Bonser
-Peter Schultz
-Rebecca Chin
-Reed Allman
-Richard Wilkes
-Robert Russell
-Runrioter Wung
-Sho Iizuka
-Sho Ikeda
-Shuode Li
-Simon J Mudd
-Soroush Pour
-Stan Putrya
-Stanley Gunawan
-Steven Hartland
-Tan Jinhua <312841925 at qq.com>
-Thomas Wodarek
-Tim Ruffles
-Tom Jenkinson
-Vladimir Kovpak
-Vladyslav Zhelezniak
-Xiangyu Hu
-Xiaobing Jiang
-Xiuming Chen
-Xuehong Chan
-Zhenye Xie
-Zhixin Wen
-
-# Organizations
-
-Barracuda Networks, Inc.
-Counting Ltd.
-DigitalOcean Inc.
-Facebook Inc.
-GitHub Inc.
-Google Inc.
-InfoSum Ltd.
-Keybase Inc.
-Multiplay Ltd.
-Percona LLC
-Pivotal Inc.
-Stripe Inc.
-Zendesk Inc.
diff --git a/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md b/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md
deleted file mode 100644
index 72a738e..0000000
--- a/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md
+++ /dev/null
@@ -1,232 +0,0 @@
-## Version 1.6 (2021-04-01)
-
-Changes:
-
- - Migrate the CI service from travis-ci to GitHub Actions (#1176, #1183, #1190)
- - `NullTime` is deprecated (#960, #1144)
- - Reduce allocations when building SET command (#1111)
- - Performance improvement for time formatting (#1118)
- - Performance improvement for time parsing (#1098, #1113)
-
-New Features:
-
- - Implement `driver.Validator` interface (#1106, #1174)
- - Support returning `uint64` from `Valuer` in `ConvertValue` (#1143)
- - Add `json.RawMessage` for converter and prepared statement (#1059)
- - Interpolate `json.RawMessage` as `string` (#1058)
- - Implements `CheckNamedValue` (#1090)
-
-Bugfixes:
-
- - Stop rounding times (#1121, #1172)
- - Put zero filler into the SSL handshake packet (#1066)
- - Fix checking cancelled connections back into the connection pool (#1095)
- - Fix remove last 0 byte for mysql_old_password when password is empty (#1133)
-
-
-## Version 1.5 (2020-01-07)
-
-Changes:
-
- - Dropped support Go 1.9 and lower (#823, #829, #886, #1016, #1017)
- - Improve buffer handling (#890)
- - Document potentially insecure TLS configs (#901)
- - Use a double-buffering scheme to prevent data races (#943)
- - Pass uint64 values without converting them to string (#838, #955)
- - Update collations and make utf8mb4 default (#877, #1054)
- - Make NullTime compatible with sql.NullTime in Go 1.13+ (#995)
- - Removed CloudSQL support (#993, #1007)
- - Add Go Module support (#1003)
-
-New Features:
-
- - Implement support of optional TLS (#900)
- - Check connection liveness (#934, #964, #997, #1048, #1051, #1052)
- - Implement Connector Interface (#941, #958, #1020, #1035)
-
-Bugfixes:
-
- - Mark connections as bad on error during ping (#875)
- - Mark connections as bad on error during dial (#867)
- - Fix connection leak caused by rapid context cancellation (#1024)
- - Mark connections as bad on error during Conn.Prepare (#1030)
-
-
-## Version 1.4.1 (2018-11-14)
-
-Bugfixes:
-
- - Fix TIME format for binary columns (#818)
- - Fix handling of empty auth plugin names (#835)
- - Fix caching_sha2_password with empty password (#826)
- - Fix canceled context broke mysqlConn (#862)
- - Fix OldAuthSwitchRequest support (#870)
- - Fix Auth Response packet for cleartext password (#887)
-
-## Version 1.4 (2018-06-03)
-
-Changes:
-
- - Documentation fixes (#530, #535, #567)
- - Refactoring (#575, #579, #580, #581, #603, #615, #704)
- - Cache column names (#444)
- - Sort the DSN parameters in DSNs generated from a config (#637)
- - Allow native password authentication by default (#644)
- - Use the default port if it is missing in the DSN (#668)
- - Removed the `strict` mode (#676)
- - Do not query `max_allowed_packet` by default (#680)
- - Dropped support Go 1.6 and lower (#696)
- - Updated `ConvertValue()` to match the database/sql/driver implementation (#760)
- - Document the usage of `0000-00-00T00:00:00` as the time.Time zero value (#783)
- - Improved the compatibility of the authentication system (#807)
-
-New Features:
-
- - Multi-Results support (#537)
- - `rejectReadOnly` DSN option (#604)
- - `context.Context` support (#608, #612, #627, #761)
- - Transaction isolation level support (#619, #744)
- - Read-Only transactions support (#618, #634)
- - `NewConfig` function which initializes a config with default values (#679)
- - Implemented the `ColumnType` interfaces (#667, #724)
- - Support for custom string types in `ConvertValue` (#623)
- - Implemented `NamedValueChecker`, improving support for uint64 with high bit set (#690, #709, #710)
- - `caching_sha2_password` authentication plugin support (#794, #800, #801, #802)
- - Implemented `driver.SessionResetter` (#779)
- - `sha256_password` authentication plugin support (#808)
-
-Bugfixes:
-
- - Use the DSN hostname as TLS default ServerName if `tls=true` (#564, #718)
- - Fixed LOAD LOCAL DATA INFILE for empty files (#590)
- - Removed columns definition cache since it sometimes cached invalid data (#592)
- - Don't mutate registered TLS configs (#600)
- - Make RegisterTLSConfig concurrency-safe (#613)
- - Handle missing auth data in the handshake packet correctly (#646)
- - Do not retry queries when data was written to avoid data corruption (#302, #736)
- - Cache the connection pointer for error handling before invalidating it (#678)
- - Fixed imports for appengine/cloudsql (#700)
- - Fix sending STMT_LONG_DATA for 0 byte data (#734)
- - Set correct capacity for []bytes read from length-encoded strings (#766)
- - Make RegisterDial concurrency-safe (#773)
-
-
-## Version 1.3 (2016-12-01)
-
-Changes:
-
- - Go 1.1 is no longer supported
- - Use decimals fields in MySQL to format time types (#249)
- - Buffer optimizations (#269)
- - TLS ServerName defaults to the host (#283)
- - Refactoring (#400, #410, #437)
- - Adjusted documentation for second generation CloudSQL (#485)
- - Documented DSN system var quoting rules (#502)
- - Made statement.Close() calls idempotent to avoid errors in Go 1.6+ (#512)
-
-New Features:
-
- - Enable microsecond resolution on TIME, DATETIME and TIMESTAMP (#249)
- - Support for returning table alias on Columns() (#289, #359, #382)
- - Placeholder interpolation, can be actived with the DSN parameter `interpolateParams=true` (#309, #318, #490)
- - Support for uint64 parameters with high bit set (#332, #345)
- - Cleartext authentication plugin support (#327)
- - Exported ParseDSN function and the Config struct (#403, #419, #429)
- - Read / Write timeouts (#401)
- - Support for JSON field type (#414)
- - Support for multi-statements and multi-results (#411, #431)
- - DSN parameter to set the driver-side max_allowed_packet value manually (#489)
- - Native password authentication plugin support (#494, #524)
-
-Bugfixes:
-
- - Fixed handling of queries without columns and rows (#255)
- - Fixed a panic when SetKeepAlive() failed (#298)
- - Handle ERR packets while reading rows (#321)
- - Fixed reading NULL length-encoded integers in MySQL 5.6+ (#349)
- - Fixed absolute paths support in LOAD LOCAL DATA INFILE (#356)
- - Actually zero out bytes in handshake response (#378)
- - Fixed race condition in registering LOAD DATA INFILE handler (#383)
- - Fixed tests with MySQL 5.7.9+ (#380)
- - QueryUnescape TLS config names (#397)
- - Fixed "broken pipe" error by writing to closed socket (#390)
- - Fixed LOAD LOCAL DATA INFILE buffering (#424)
- - Fixed parsing of floats into float64 when placeholders are used (#434)
- - Fixed DSN tests with Go 1.7+ (#459)
- - Handle ERR packets while waiting for EOF (#473)
- - Invalidate connection on error while discarding additional results (#513)
- - Allow terminating packets of length 0 (#516)
-
-
-## Version 1.2 (2014-06-03)
-
-Changes:
-
- - We switched back to a "rolling release". `go get` installs the current master branch again
- - Version v1 of the driver will not be maintained anymore. Go 1.0 is no longer supported by this driver
- - Exported errors to allow easy checking from application code
- - Enabled TCP Keepalives on TCP connections
- - Optimized INFILE handling (better buffer size calculation, lazy init, ...)
- - The DSN parser also checks for a missing separating slash
- - Faster binary date / datetime to string formatting
- - Also exported the MySQLWarning type
- - mysqlConn.Close returns the first error encountered instead of ignoring all errors
- - writePacket() automatically writes the packet size to the header
- - readPacket() uses an iterative approach instead of the recursive approach to merge splitted packets
-
-New Features:
-
- - `RegisterDial` allows the usage of a custom dial function to establish the network connection
- - Setting the connection collation is possible with the `collation` DSN parameter. This parameter should be preferred over the `charset` parameter
- - Logging of critical errors is configurable with `SetLogger`
- - Google CloudSQL support
-
-Bugfixes:
-
- - Allow more than 32 parameters in prepared statements
- - Various old_password fixes
- - Fixed TestConcurrent test to pass Go's race detection
- - Fixed appendLengthEncodedInteger for large numbers
- - Renamed readLengthEnodedString to readLengthEncodedString and skipLengthEnodedString to skipLengthEncodedString (fixed typo)
-
-
-## Version 1.1 (2013-11-02)
-
-Changes:
-
- - Go-MySQL-Driver now requires Go 1.1
- - Connections now use the collation `utf8_general_ci` by default. Adding `&charset=UTF8` to the DSN should not be necessary anymore
- - Made closing rows and connections error tolerant. This allows for example deferring rows.Close() without checking for errors
- - `[]byte(nil)` is now treated as a NULL value. Before, it was treated like an empty string / `[]byte("")`
- - DSN parameter values must now be url.QueryEscape'ed. This allows text values to contain special characters, such as '&'.
- - Use the IO buffer also for writing. This results in zero allocations (by the driver) for most queries
- - Optimized the buffer for reading
- - stmt.Query now caches column metadata
- - New Logo
- - Changed the copyright header to include all contributors
- - Improved the LOAD INFILE documentation
- - The driver struct is now exported to make the driver directly accessible
- - Refactored the driver tests
- - Added more benchmarks and moved all to a separate file
- - Other small refactoring
-
-New Features:
-
- - Added *old_passwords* support: Required in some cases, but must be enabled by adding `allowOldPasswords=true` to the DSN since it is insecure
- - Added a `clientFoundRows` parameter: Return the number of matching rows instead of the number of rows changed on UPDATEs
- - Added TLS/SSL support: Use a TLS/SSL encrypted connection to the server. Custom TLS configs can be registered and used
-
-Bugfixes:
-
- - Fixed MySQL 4.1 support: MySQL 4.1 sends packets with lengths which differ from the specification
- - Convert to DB timezone when inserting `time.Time`
- - Splitted packets (more than 16MB) are now merged correctly
- - Fixed false positive `io.EOF` errors when the data was fully read
- - Avoid panics on reuse of closed connections
- - Fixed empty string producing false nil values
- - Fixed sign byte for positive TIME fields
-
-
-## Version 1.0 (2013-05-14)
-
-Initial Release
diff --git a/vendor/github.com/go-sql-driver/mysql/LICENSE b/vendor/github.com/go-sql-driver/mysql/LICENSE
deleted file mode 100644
index 14e2f77..0000000
--- a/vendor/github.com/go-sql-driver/mysql/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/vendor/github.com/go-sql-driver/mysql/README.md b/vendor/github.com/go-sql-driver/mysql/README.md
deleted file mode 100644
index 0b13154..0000000
--- a/vendor/github.com/go-sql-driver/mysql/README.md
+++ /dev/null
@@ -1,520 +0,0 @@
-# Go-MySQL-Driver
-
-A MySQL-Driver for Go's [database/sql](https://golang.org/pkg/database/sql/) package
-
-![Go-MySQL-Driver logo](https://raw.github.com/wiki/go-sql-driver/mysql/gomysql_m.png "Golang Gopher holding the MySQL Dolphin")
-
----------------------------------------
- * [Features](#features)
- * [Requirements](#requirements)
- * [Installation](#installation)
- * [Usage](#usage)
- * [DSN (Data Source Name)](#dsn-data-source-name)
- * [Password](#password)
- * [Protocol](#protocol)
- * [Address](#address)
- * [Parameters](#parameters)
- * [Examples](#examples)
- * [Connection pool and timeouts](#connection-pool-and-timeouts)
- * [context.Context Support](#contextcontext-support)
- * [ColumnType Support](#columntype-support)
- * [LOAD DATA LOCAL INFILE support](#load-data-local-infile-support)
- * [time.Time support](#timetime-support)
- * [Unicode support](#unicode-support)
- * [Testing / Development](#testing--development)
- * [License](#license)
-
----------------------------------------
-
-## Features
- * Lightweight and [fast](https://github.com/go-sql-driver/sql-benchmark "golang MySQL-Driver performance")
- * Native Go implementation. No C-bindings, just pure Go
- * Connections over TCP/IPv4, TCP/IPv6, Unix domain sockets or [custom protocols](https://godoc.org/github.com/go-sql-driver/mysql#DialFunc)
- * Automatic handling of broken connections
- * Automatic Connection Pooling *(by database/sql package)*
- * Supports queries larger than 16MB
- * Full [`sql.RawBytes`](https://golang.org/pkg/database/sql/#RawBytes) support.
- * Intelligent `LONG DATA` handling in prepared statements
- * Secure `LOAD DATA LOCAL INFILE` support with file allowlisting and `io.Reader` support
- * Optional `time.Time` parsing
- * Optional placeholder interpolation
-
-## Requirements
- * Go 1.10 or higher. We aim to support the 3 latest versions of Go.
- * MySQL (4.1+), MariaDB, Percona Server, Google CloudSQL or Sphinx (2.2.3+)
-
----------------------------------------
-
-## Installation
-Simple install the package to your [$GOPATH](https://github.com/golang/go/wiki/GOPATH "GOPATH") with the [go tool](https://golang.org/cmd/go/ "go command") from shell:
-```bash
-$ go get -u github.com/go-sql-driver/mysql
-```
-Make sure [Git is installed](https://git-scm.com/downloads) on your machine and in your system's `PATH`.
-
-## Usage
-_Go MySQL Driver_ is an implementation of Go's `database/sql/driver` interface. You only need to import the driver and can use the full [`database/sql`](https://golang.org/pkg/database/sql/) API then.
-
-Use `mysql` as `driverName` and a valid [DSN](#dsn-data-source-name) as `dataSourceName`:
-
-```go
-import (
- "database/sql"
- "time"
-
- _ "github.com/go-sql-driver/mysql"
-)
-
-// ...
-
-db, err := sql.Open("mysql", "user:password@/dbname")
-if err != nil {
- panic(err)
-}
-// See "Important settings" section.
-db.SetConnMaxLifetime(time.Minute * 3)
-db.SetMaxOpenConns(10)
-db.SetMaxIdleConns(10)
-```
-
-[Examples are available in our Wiki](https://github.com/go-sql-driver/mysql/wiki/Examples "Go-MySQL-Driver Examples").
-
-### Important settings
-
-`db.SetConnMaxLifetime()` is required to ensure connections are closed by the driver safely before connection is closed by MySQL server, OS, or other middlewares. Since some middlewares close idle connections by 5 minutes, we recommend timeout shorter than 5 minutes. This setting helps load balancing and changing system variables too.
-
-`db.SetMaxOpenConns()` is highly recommended to limit the number of connection used by the application. There is no recommended limit number because it depends on application and MySQL server.
-
-`db.SetMaxIdleConns()` is recommended to be set same to (or greater than) `db.SetMaxOpenConns()`. When it is smaller than `SetMaxOpenConns()`, connections can be opened and closed very frequently than you expect. Idle connections can be closed by the `db.SetConnMaxLifetime()`. If you want to close idle connections more rapidly, you can use `db.SetConnMaxIdleTime()` since Go 1.15.
-
-
-### DSN (Data Source Name)
-
-The Data Source Name has a common format, like e.g. [PEAR DB](http://pear.php.net/manual/en/package.database.db.intro-dsn.php) uses it, but without type-prefix (optional parts marked by squared brackets):
-```
-[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...¶mN=valueN]
-```
-
-A DSN in its fullest form:
-```
-username:password@protocol(address)/dbname?param=value
-```
-
-Except for the databasename, all values are optional. So the minimal DSN is:
-```
-/dbname
-```
-
-If you do not want to preselect a database, leave `dbname` empty:
-```
-/
-```
-This has the same effect as an empty DSN string:
-```
-
-```
-
-Alternatively, [Config.FormatDSN](https://godoc.org/github.com/go-sql-driver/mysql#Config.FormatDSN) can be used to create a DSN string by filling a struct.
-
-#### Password
-Passwords can consist of any character. Escaping is **not** necessary.
-
-#### Protocol
-See [net.Dial](https://golang.org/pkg/net/#Dial) for more information which networks are available.
-In general you should use an Unix domain socket if available and TCP otherwise for best performance.
-
-#### Address
-For TCP and UDP networks, addresses have the form `host[:port]`.
-If `port` is omitted, the default port will be used.
-If `host` is a literal IPv6 address, it must be enclosed in square brackets.
-The functions [net.JoinHostPort](https://golang.org/pkg/net/#JoinHostPort) and [net.SplitHostPort](https://golang.org/pkg/net/#SplitHostPort) manipulate addresses in this form.
-
-For Unix domain sockets the address is the absolute path to the MySQL-Server-socket, e.g. `/var/run/mysqld/mysqld.sock` or `/tmp/mysql.sock`.
-
-#### Parameters
-*Parameters are case-sensitive!*
-
-Notice that any of `true`, `TRUE`, `True` or `1` is accepted to stand for a true boolean value. Not surprisingly, false can be specified as any of: `false`, `FALSE`, `False` or `0`.
-
-##### `allowAllFiles`
-
-```
-Type: bool
-Valid Values: true, false
-Default: false
-```
-
-`allowAllFiles=true` disables the file allowlist for `LOAD DATA LOCAL INFILE` and allows *all* files.
-[*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)
-
-##### `allowCleartextPasswords`
-
-```
-Type: bool
-Valid Values: true, false
-Default: false
-```
-
-`allowCleartextPasswords=true` allows using the [cleartext client side plugin](https://dev.mysql.com/doc/en/cleartext-pluggable-authentication.html) if required by an account, such as one defined with the [PAM authentication plugin](http://dev.mysql.com/doc/en/pam-authentication-plugin.html). Sending passwords in clear text may be a security problem in some configurations. To avoid problems if there is any possibility that the password would be intercepted, clients should connect to MySQL Server using a method that protects the password. Possibilities include [TLS / SSL](#tls), IPsec, or a private network.
-
-##### `allowNativePasswords`
-
-```
-Type: bool
-Valid Values: true, false
-Default: true
-```
-`allowNativePasswords=false` disallows the usage of MySQL native password method.
-
-##### `allowOldPasswords`
-
-```
-Type: bool
-Valid Values: true, false
-Default: false
-```
-`allowOldPasswords=true` allows the usage of the insecure old password method. This should be avoided, but is necessary in some cases. See also [the old_passwords wiki page](https://github.com/go-sql-driver/mysql/wiki/old_passwords).
-
-##### `charset`
-
-```
-Type: string
-Valid Values:
-Default: none
-```
-
-Sets the charset used for client-server interaction (`"SET NAMES "`). If multiple charsets are set (separated by a comma), the following charset is used if setting the charset failes. This enables for example support for `utf8mb4` ([introduced in MySQL 5.5.3](http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html)) with fallback to `utf8` for older servers (`charset=utf8mb4,utf8`).
-
-Usage of the `charset` parameter is discouraged because it issues additional queries to the server.
-Unless you need the fallback behavior, please use `collation` instead.
-
-##### `checkConnLiveness`
-
-```
-Type: bool
-Valid Values: true, false
-Default: true
-```
-
-On supported platforms connections retrieved from the connection pool are checked for liveness before using them. If the check fails, the respective connection is marked as bad and the query retried with another connection.
-`checkConnLiveness=false` disables this liveness check of connections.
-
-##### `collation`
-
-```
-Type: string
-Valid Values:
-Default: utf8mb4_general_ci
-```
-
-Sets the collation used for client-server interaction on connection. In contrast to `charset`, `collation` does not issue additional queries. If the specified collation is unavailable on the target server, the connection will fail.
-
-A list of valid charsets for a server is retrievable with `SHOW COLLATION`.
-
-The default collation (`utf8mb4_general_ci`) is supported from MySQL 5.5. You should use an older collation (e.g. `utf8_general_ci`) for older MySQL.
-
-Collations for charset "ucs2", "utf16", "utf16le", and "utf32" can not be used ([ref](https://dev.mysql.com/doc/refman/5.7/en/charset-connection.html#charset-connection-impermissible-client-charset)).
-
-
-##### `clientFoundRows`
-
-```
-Type: bool
-Valid Values: true, false
-Default: false
-```
-
-`clientFoundRows=true` causes an UPDATE to return the number of matching rows instead of the number of rows changed.
-
-##### `columnsWithAlias`
-
-```
-Type: bool
-Valid Values: true, false
-Default: false
-```
-
-When `columnsWithAlias` is true, calls to `sql.Rows.Columns()` will return the table alias and the column name separated by a dot. For example:
-
-```
-SELECT u.id FROM users as u
-```
-
-will return `u.id` instead of just `id` if `columnsWithAlias=true`.
-
-##### `interpolateParams`
-
-```
-Type: bool
-Valid Values: true, false
-Default: false
-```
-
-If `interpolateParams` is true, placeholders (`?`) in calls to `db.Query()` and `db.Exec()` are interpolated into a single query string with given parameters. This reduces the number of roundtrips, since the driver has to prepare a statement, execute it with given parameters and close the statement again with `interpolateParams=false`.
-
-*This can not be used together with the multibyte encodings BIG5, CP932, GB2312, GBK or SJIS. These are rejected as they may [introduce a SQL injection vulnerability](http://stackoverflow.com/a/12118602/3430118)!*
-
-##### `loc`
-
-```
-Type: string
-Valid Values:
-Default: UTC
-```
-
-Sets the location for time.Time values (when using `parseTime=true`). *"Local"* sets the system's location. See [time.LoadLocation](https://golang.org/pkg/time/#LoadLocation) for details.
-
-Note that this sets the location for time.Time values but does not change MySQL's [time_zone setting](https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html). For that see the [time_zone system variable](#system-variables), which can also be set as a DSN parameter.
-
-Please keep in mind, that param values must be [url.QueryEscape](https://golang.org/pkg/net/url/#QueryEscape)'ed. Alternatively you can manually replace the `/` with `%2F`. For example `US/Pacific` would be `loc=US%2FPacific`.
-
-##### `maxAllowedPacket`
-```
-Type: decimal number
-Default: 4194304
-```
-
-Max packet size allowed in bytes. The default value is 4 MiB and should be adjusted to match the server settings. `maxAllowedPacket=0` can be used to automatically fetch the `max_allowed_packet` variable from server *on every connection*.
-
-##### `multiStatements`
-
-```
-Type: bool
-Valid Values: true, false
-Default: false
-```
-
-Allow multiple statements in one query. While this allows batch queries, it also greatly increases the risk of SQL injections. Only the result of the first query is returned, all other results are silently discarded.
-
-When `multiStatements` is used, `?` parameters must only be used in the first statement.
-
-##### `parseTime`
-
-```
-Type: bool
-Valid Values: true, false
-Default: false
-```
-
-`parseTime=true` changes the output type of `DATE` and `DATETIME` values to `time.Time` instead of `[]byte` / `string`
-The date or datetime like `0000-00-00 00:00:00` is converted into zero value of `time.Time`.
-
-
-##### `readTimeout`
-
-```
-Type: duration
-Default: 0
-```
-
-I/O read timeout. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.
-
-##### `rejectReadOnly`
-
-```
-Type: bool
-Valid Values: true, false
-Default: false
-```
-
-
-`rejectReadOnly=true` causes the driver to reject read-only connections. This
-is for a possible race condition during an automatic failover, where the mysql
-client gets connected to a read-only replica after the failover.
-
-Note that this should be a fairly rare case, as an automatic failover normally
-happens when the primary is down, and the race condition shouldn't happen
-unless it comes back up online as soon as the failover is kicked off. On the
-other hand, when this happens, a MySQL application can get stuck on a
-read-only connection until restarted. It is however fairly easy to reproduce,
-for example, using a manual failover on AWS Aurora's MySQL-compatible cluster.
-
-If you are not relying on read-only transactions to reject writes that aren't
-supposed to happen, setting this on some MySQL providers (such as AWS Aurora)
-is safer for failovers.
-
-Note that ERROR 1290 can be returned for a `read-only` server and this option will
-cause a retry for that error. However the same error number is used for some
-other cases. You should ensure your application will never cause an ERROR 1290
-except for `read-only` mode when enabling this option.
-
-
-##### `serverPubKey`
-
-```
-Type: string
-Valid Values:
-Default: none
-```
-
-Server public keys can be registered with [`mysql.RegisterServerPubKey`](https://godoc.org/github.com/go-sql-driver/mysql#RegisterServerPubKey), which can then be used by the assigned name in the DSN.
-Public keys are used to transmit encrypted data, e.g. for authentication.
-If the server's public key is known, it should be set manually to avoid expensive and potentially insecure transmissions of the public key from the server to the client each time it is required.
-
-
-##### `timeout`
-
-```
-Type: duration
-Default: OS default
-```
-
-Timeout for establishing connections, aka dial timeout. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.
-
-
-##### `tls`
-
-```
-Type: bool / string
-Valid Values: true, false, skip-verify, preferred,
-Default: false
-```
-
-`tls=true` enables TLS / SSL encrypted connection to the server. Use `skip-verify` if you want to use a self-signed or invalid certificate (server side) or use `preferred` to use TLS only when advertised by the server. This is similar to `skip-verify`, but additionally allows a fallback to a connection which is not encrypted. Neither `skip-verify` nor `preferred` add any reliable security. You can use a custom TLS config after registering it with [`mysql.RegisterTLSConfig`](https://godoc.org/github.com/go-sql-driver/mysql#RegisterTLSConfig).
-
-
-##### `writeTimeout`
-
-```
-Type: duration
-Default: 0
-```
-
-I/O write timeout. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.
-
-
-##### System Variables
-
-Any other parameters are interpreted as system variables:
- * `=`: `SET =`
- * `=`: `SET =`
- * `=%27%27`: `SET =''`
-
-Rules:
-* The values for string variables must be quoted with `'`.
-* The values must also be [url.QueryEscape](http://golang.org/pkg/net/url/#QueryEscape)'ed!
- (which implies values of string variables must be wrapped with `%27`).
-
-Examples:
- * `autocommit=1`: `SET autocommit=1`
- * [`time_zone=%27Europe%2FParis%27`](https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html): `SET time_zone='Europe/Paris'`
- * [`transaction_isolation=%27REPEATABLE-READ%27`](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_transaction_isolation): `SET transaction_isolation='REPEATABLE-READ'`
-
-
-#### Examples
-```
-user@unix(/path/to/socket)/dbname
-```
-
-```
-root:pw@unix(/tmp/mysql.sock)/myDatabase?loc=Local
-```
-
-```
-user:password@tcp(localhost:5555)/dbname?tls=skip-verify&autocommit=true
-```
-
-Treat warnings as errors by setting the system variable [`sql_mode`](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html):
-```
-user:password@/dbname?sql_mode=TRADITIONAL
-```
-
-TCP via IPv6:
-```
-user:password@tcp([de:ad:be:ef::ca:fe]:80)/dbname?timeout=90s&collation=utf8mb4_unicode_ci
-```
-
-TCP on a remote host, e.g. Amazon RDS:
-```
-id:password@tcp(your-amazonaws-uri.com:3306)/dbname
-```
-
-Google Cloud SQL on App Engine:
-```
-user:password@unix(/cloudsql/project-id:region-name:instance-name)/dbname
-```
-
-TCP using default port (3306) on localhost:
-```
-user:password@tcp/dbname?charset=utf8mb4,utf8&sys_var=esc%40ped
-```
-
-Use the default protocol (tcp) and host (localhost:3306):
-```
-user:password@/dbname
-```
-
-No Database preselected:
-```
-user:password@/
-```
-
-
-### Connection pool and timeouts
-The connection pool is managed by Go's database/sql package. For details on how to configure the size of the pool and how long connections stay in the pool see `*DB.SetMaxOpenConns`, `*DB.SetMaxIdleConns`, and `*DB.SetConnMaxLifetime` in the [database/sql documentation](https://golang.org/pkg/database/sql/). The read, write, and dial timeouts for each individual connection are configured with the DSN parameters [`readTimeout`](#readtimeout), [`writeTimeout`](#writetimeout), and [`timeout`](#timeout), respectively.
-
-## `ColumnType` Support
-This driver supports the [`ColumnType` interface](https://golang.org/pkg/database/sql/#ColumnType) introduced in Go 1.8, with the exception of [`ColumnType.Length()`](https://golang.org/pkg/database/sql/#ColumnType.Length), which is currently not supported.
-
-## `context.Context` Support
-Go 1.8 added `database/sql` support for `context.Context`. This driver supports query timeouts and cancellation via contexts.
-See [context support in the database/sql package](https://golang.org/doc/go1.8#database_sql) for more details.
-
-
-### `LOAD DATA LOCAL INFILE` support
-For this feature you need direct access to the package. Therefore you must change the import path (no `_`):
-```go
-import "github.com/go-sql-driver/mysql"
-```
-
-Files must be explicitly allowed by registering them with `mysql.RegisterLocalFile(filepath)` (recommended) or the allowlist check must be deactivated by using the DSN parameter `allowAllFiles=true` ([*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)).
-
-To use a `io.Reader` a handler function must be registered with `mysql.RegisterReaderHandler(name, handler)` which returns a `io.Reader` or `io.ReadCloser`. The Reader is available with the filepath `Reader::` then. Choose different names for different handlers and `DeregisterReaderHandler` when you don't need it anymore.
-
-See the [godoc of Go-MySQL-Driver](https://godoc.org/github.com/go-sql-driver/mysql "golang mysql driver documentation") for details.
-
-
-### `time.Time` support
-The default internal output type of MySQL `DATE` and `DATETIME` values is `[]byte` which allows you to scan the value into a `[]byte`, `string` or `sql.RawBytes` variable in your program.
-
-However, many want to scan MySQL `DATE` and `DATETIME` values into `time.Time` variables, which is the logical equivalent in Go to `DATE` and `DATETIME` in MySQL. You can do that by changing the internal output type from `[]byte` to `time.Time` with the DSN parameter `parseTime=true`. You can set the default [`time.Time` location](https://golang.org/pkg/time/#Location) with the `loc` DSN parameter.
-
-**Caution:** As of Go 1.1, this makes `time.Time` the only variable type you can scan `DATE` and `DATETIME` values into. This breaks for example [`sql.RawBytes` support](https://github.com/go-sql-driver/mysql/wiki/Examples#rawbytes).
-
-
-### Unicode support
-Since version 1.5 Go-MySQL-Driver automatically uses the collation ` utf8mb4_general_ci` by default.
-
-Other collations / charsets can be set using the [`collation`](#collation) DSN parameter.
-
-Version 1.0 of the driver recommended adding `&charset=utf8` (alias for `SET NAMES utf8`) to the DSN to enable proper UTF-8 support. This is not necessary anymore. The [`collation`](#collation) parameter should be preferred to set another collation / charset than the default.
-
-See http://dev.mysql.com/doc/refman/8.0/en/charset-unicode.html for more details on MySQL's Unicode support.
-
-## Testing / Development
-To run the driver tests you may need to adjust the configuration. See the [Testing Wiki-Page](https://github.com/go-sql-driver/mysql/wiki/Testing "Testing") for details.
-
-Go-MySQL-Driver is not feature-complete yet. Your help is very appreciated.
-If you want to contribute, you can work on an [open issue](https://github.com/go-sql-driver/mysql/issues?state=open) or review a [pull request](https://github.com/go-sql-driver/mysql/pulls).
-
-See the [Contribution Guidelines](https://github.com/go-sql-driver/mysql/blob/master/.github/CONTRIBUTING.md) for details.
-
----------------------------------------
-
-## License
-Go-MySQL-Driver is licensed under the [Mozilla Public License Version 2.0](https://raw.github.com/go-sql-driver/mysql/master/LICENSE)
-
-Mozilla summarizes the license scope as follows:
-> MPL: The copyleft applies to any files containing MPLed code.
-
-
-That means:
- * You can **use** the **unchanged** source code both in private and commercially.
- * When distributing, you **must publish** the source code of any **changed files** licensed under the MPL 2.0 under a) the MPL 2.0 itself or b) a compatible license (e.g. GPL 3.0 or Apache License 2.0).
- * You **needn't publish** the source code of your library as long as the files licensed under the MPL 2.0 are **unchanged**.
-
-Please read the [MPL 2.0 FAQ](https://www.mozilla.org/en-US/MPL/2.0/FAQ/) if you have further questions regarding the license.
-
-You can read the full terms here: [LICENSE](https://raw.github.com/go-sql-driver/mysql/master/LICENSE).
-
-![Go Gopher and MySQL Dolphin](https://raw.github.com/wiki/go-sql-driver/mysql/go-mysql-driver_m.jpg "Golang Gopher transporting the MySQL Dolphin in a wheelbarrow")
diff --git a/vendor/github.com/go-sql-driver/mysql/auth.go b/vendor/github.com/go-sql-driver/mysql/auth.go
deleted file mode 100644
index dc020e7..0000000
--- a/vendor/github.com/go-sql-driver/mysql/auth.go
+++ /dev/null
@@ -1,707 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-
-//
-
-// Copyright 2018 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-import (
- "crypto/rand"
- "crypto/rsa"
- "crypto/sha1"
- "crypto/sha256"
- "crypto/x509"
- "encoding/pem"
- "fmt"
- "sync"
-)
-
-// server pub keys registry
-
-var (
- serverPubKeyLock sync.RWMutex
-
- serverPubKeyRegistry map[string]*rsa.PublicKey
-)
-
-// RegisterServerPubKey registers a server RSA public key which can be used to
-
-// send data in a secure manner to the server without receiving the public key
-
-// in a potentially insecure way from the server first.
-
-// Registered keys can afterwards be used adding serverPubKey= to the DSN.
-
-//
-
-// Note: The provided rsa.PublicKey instance is exclusively owned by the driver
-
-// after registering it and may not be modified.
-
-//
-
-// data, err := ioutil.ReadFile("mykey.pem")
-
-// if err != nil {
-
-// log.Fatal(err)
-
-// }
-
-//
-
-// block, _ := pem.Decode(data)
-
-// if block == nil || block.Type != "PUBLIC KEY" {
-
-// log.Fatal("failed to decode PEM block containing public key")
-
-// }
-
-//
-
-// pub, err := x509.ParsePKIXPublicKey(block.Bytes)
-
-// if err != nil {
-
-// log.Fatal(err)
-
-// }
-
-//
-
-// if rsaPubKey, ok := pub.(*rsa.PublicKey); ok {
-
-// mysql.RegisterServerPubKey("mykey", rsaPubKey)
-
-// } else {
-
-// log.Fatal("not a RSA public key")
-
-// }
-
-func RegisterServerPubKey(name string, pubKey *rsa.PublicKey) {
-
- serverPubKeyLock.Lock()
-
- if serverPubKeyRegistry == nil {
-
- serverPubKeyRegistry = make(map[string]*rsa.PublicKey)
-
- }
-
- serverPubKeyRegistry[name] = pubKey
-
- serverPubKeyLock.Unlock()
-
-}
-
-// DeregisterServerPubKey removes the public key registered with the given name.
-
-func DeregisterServerPubKey(name string) {
-
- serverPubKeyLock.Lock()
-
- if serverPubKeyRegistry != nil {
-
- delete(serverPubKeyRegistry, name)
-
- }
-
- serverPubKeyLock.Unlock()
-
-}
-
-func getServerPubKey(name string) (pubKey *rsa.PublicKey) {
-
- serverPubKeyLock.RLock()
-
- if v, ok := serverPubKeyRegistry[name]; ok {
-
- pubKey = v
-
- }
-
- serverPubKeyLock.RUnlock()
-
- return
-
-}
-
-// Hash password using pre 4.1 (old password) method
-
-// https://github.com/atcurtis/mariadb/blob/master/mysys/my_rnd.c
-
-type myRnd struct {
- seed1, seed2 uint32
-}
-
-const myRndMaxVal = 0x3FFFFFFF
-
-// Pseudo random number generator
-
-func newMyRnd(seed1, seed2 uint32) *myRnd {
-
- return &myRnd{
-
- seed1: seed1 % myRndMaxVal,
-
- seed2: seed2 % myRndMaxVal,
- }
-
-}
-
-// Tested to be equivalent to MariaDB's floating point variant
-
-// http://play.golang.org/p/QHvhd4qved
-
-// http://play.golang.org/p/RG0q4ElWDx
-
-func (r *myRnd) NextByte() byte {
-
- r.seed1 = (r.seed1*3 + r.seed2) % myRndMaxVal
-
- r.seed2 = (r.seed1 + r.seed2 + 33) % myRndMaxVal
-
- return byte(uint64(r.seed1) * 31 / myRndMaxVal)
-
-}
-
-// Generate binary hash from byte string using insecure pre 4.1 method
-
-func pwHash(password []byte) (result [2]uint32) {
-
- var add uint32 = 7
-
- var tmp uint32
-
- result[0] = 1345345333
-
- result[1] = 0x12345671
-
- for _, c := range password {
-
- // skip spaces and tabs in password
-
- if c == ' ' || c == '\t' {
-
- continue
-
- }
-
- tmp = uint32(c)
-
- result[0] ^= (((result[0] & 63) + add) * tmp) + (result[0] << 8)
-
- result[1] += (result[1] << 8) ^ result[0]
-
- add += tmp
-
- }
-
- // Remove sign bit (1<<31)-1)
-
- result[0] &= 0x7FFFFFFF
-
- result[1] &= 0x7FFFFFFF
-
- return
-
-}
-
-// Hash password using insecure pre 4.1 method
-
-func scrambleOldPassword(scramble []byte, password string) []byte {
-
- scramble = scramble[:8]
-
- hashPw := pwHash([]byte(password))
-
- hashSc := pwHash(scramble)
-
- r := newMyRnd(hashPw[0]^hashSc[0], hashPw[1]^hashSc[1])
-
- var out [8]byte
-
- for i := range out {
-
- out[i] = r.NextByte() + 64
-
- }
-
- mask := r.NextByte()
-
- for i := range out {
-
- out[i] ^= mask
-
- }
-
- return out[:]
-
-}
-
-// Hash password using 4.1+ method (SHA1)
-
-func scramblePassword(scramble []byte, password string) []byte {
-
- if len(password) == 0 {
-
- return nil
-
- }
-
- // stage1Hash = SHA1(password)
-
- crypt := sha1.New()
-
- crypt.Write([]byte(password))
-
- stage1 := crypt.Sum(nil)
-
- // scrambleHash = SHA1(scramble + SHA1(stage1Hash))
-
- // inner Hash
-
- crypt.Reset()
-
- crypt.Write(stage1)
-
- hash := crypt.Sum(nil)
-
- // outer Hash
-
- crypt.Reset()
-
- crypt.Write(scramble)
-
- crypt.Write(hash)
-
- scramble = crypt.Sum(nil)
-
- // token = scrambleHash XOR stage1Hash
-
- for i := range scramble {
-
- scramble[i] ^= stage1[i]
-
- }
-
- return scramble
-
-}
-
-// Hash password using MySQL 8+ method (SHA256)
-
-func scrambleSHA256Password(scramble []byte, password string) []byte {
-
- if len(password) == 0 {
-
- return nil
-
- }
-
- // XOR(SHA256(password), SHA256(SHA256(SHA256(password)), scramble))
-
- crypt := sha256.New()
-
- crypt.Write([]byte(password))
-
- message1 := crypt.Sum(nil)
-
- crypt.Reset()
-
- crypt.Write(message1)
-
- message1Hash := crypt.Sum(nil)
-
- crypt.Reset()
-
- crypt.Write(message1Hash)
-
- crypt.Write(scramble)
-
- message2 := crypt.Sum(nil)
-
- for i := range message1 {
-
- message1[i] ^= message2[i]
-
- }
-
- return message1
-
-}
-
-func encryptPassword(password string, seed []byte, pub *rsa.PublicKey) ([]byte, error) {
-
- plain := make([]byte, len(password)+1)
-
- copy(plain, password)
-
- for i := range plain {
-
- j := i % len(seed)
-
- plain[i] ^= seed[j]
-
- }
-
- sha1 := sha1.New()
-
- return rsa.EncryptOAEP(sha1, rand.Reader, pub, plain, nil)
-
-}
-
-func (mc *mysqlConn) sendEncryptedPassword(seed []byte, pub *rsa.PublicKey) error {
-
- enc, err := encryptPassword(mc.cfg.Passwd, seed, pub)
-
- if err != nil {
-
- return err
-
- }
-
- return mc.writeAuthSwitchPacket(enc)
-
-}
-
-func (mc *mysqlConn) auth(authData []byte, plugin string) ([]byte, error) {
-
- switch plugin {
-
- case "caching_sha2_password":
-
- authResp := scrambleSHA256Password(authData, mc.cfg.Passwd)
-
- return authResp, nil
-
- case "mysql_old_password":
-
- if !mc.cfg.AllowOldPasswords {
-
- return nil, ErrOldPassword
-
- }
-
- if len(mc.cfg.Passwd) == 0 {
-
- return nil, nil
-
- }
-
- // Note: there are edge cases where this should work but doesn't;
-
- // this is currently "wontfix":
-
- // https://github.com/go-sql-driver/mysql/issues/184
-
- authResp := append(scrambleOldPassword(authData[:8], mc.cfg.Passwd), 0)
-
- return authResp, nil
-
- case "mysql_clear_password":
-
- if !mc.cfg.AllowCleartextPasswords {
-
- return nil, ErrCleartextPassword
-
- }
-
- // http://dev.mysql.com/doc/refman/5.7/en/cleartext-authentication-plugin.html
-
- // http://dev.mysql.com/doc/refman/5.7/en/pam-authentication-plugin.html
-
- return append([]byte(mc.cfg.Passwd), 0), nil
-
- case "mysql_native_password":
-
- if !mc.cfg.AllowNativePasswords {
-
- return nil, ErrNativePassword
-
- }
-
- // https://dev.mysql.com/doc/internals/en/secure-password-authentication.html
-
- // Native password authentication only need and will need 20-byte challenge.
-
- authResp := scramblePassword(authData[:20], mc.cfg.Passwd)
-
- return authResp, nil
-
- case "sha256_password":
-
- if len(mc.cfg.Passwd) == 0 {
-
- return []byte{0}, nil
-
- }
-
- if mc.cfg.tls != nil || mc.cfg.Net == "unix" {
-
- // write cleartext auth packet
-
- return append([]byte(mc.cfg.Passwd), 0), nil
-
- }
-
- pubKey := mc.cfg.pubKey
-
- if pubKey == nil {
-
- // request public key from server
-
- return []byte{1}, nil
-
- }
-
- // encrypted password
-
- enc, err := encryptPassword(mc.cfg.Passwd, authData, pubKey)
-
- return enc, err
-
- default:
-
- errLog.Print("unknown auth plugin:", plugin)
-
- return nil, ErrUnknownPlugin
-
- }
-
-}
-
-func (mc *mysqlConn) handleAuthResult(oldAuthData []byte, plugin string) error {
-
- // Read Result Packet
-
- authData, newPlugin, err := mc.readAuthResult()
-
- if err != nil {
-
- return err
-
- }
-
- // handle auth plugin switch, if requested
-
- if newPlugin != "" {
-
- // If CLIENT_PLUGIN_AUTH capability is not supported, no new cipher is
-
- // sent and we have to keep using the cipher sent in the init packet.
-
- if authData == nil {
-
- authData = oldAuthData
-
- } else {
-
- // copy data from read buffer to owned slice
-
- copy(oldAuthData, authData)
-
- }
-
- plugin = newPlugin
-
- authResp, err := mc.auth(authData, plugin)
-
- if err != nil {
-
- return err
-
- }
-
- if err = mc.writeAuthSwitchPacket(authResp); err != nil {
-
- return err
-
- }
-
- // Read Result Packet
-
- authData, newPlugin, err = mc.readAuthResult()
-
- if err != nil {
-
- return err
-
- }
-
- // Do not allow to change the auth plugin more than once
-
- if newPlugin != "" {
-
- return ErrMalformPkt
-
- }
-
- }
-
- switch plugin {
-
- // https://insidemysql.com/preparing-your-community-connector-for-mysql-8-part-2-sha256/
-
- case "caching_sha2_password":
-
- switch len(authData) {
-
- case 0:
-
- return nil // auth successful
-
- case 1:
-
- switch authData[0] {
-
- case cachingSha2PasswordFastAuthSuccess:
-
- if err = mc.readResultOK(); err == nil {
-
- return nil // auth successful
-
- }
-
- case cachingSha2PasswordPerformFullAuthentication:
-
- if mc.cfg.tls != nil || mc.cfg.Net == "unix" {
-
- // write cleartext auth packet
-
- err = mc.writeAuthSwitchPacket(append([]byte(mc.cfg.Passwd), 0))
-
- if err != nil {
-
- return err
-
- }
-
- } else {
-
- pubKey := mc.cfg.pubKey
-
- if pubKey == nil {
-
- // request public key from server
-
- data, err := mc.buf.takeSmallBuffer(4 + 1)
-
- if err != nil {
-
- return err
-
- }
-
- data[4] = cachingSha2PasswordRequestPublicKey
-
- mc.writePacket(data)
-
- // parse public key
-
- if data, err = mc.readPacket(); err != nil {
-
- return err
-
- }
-
- block, rest := pem.Decode(data[1:])
-
- if block == nil {
-
- return fmt.Errorf("No Pem data found, data: %s", rest)
-
- }
-
- pkix, err := x509.ParsePKIXPublicKey(block.Bytes)
-
- if err != nil {
-
- return err
-
- }
-
- pubKey = pkix.(*rsa.PublicKey)
-
- }
-
- // send encrypted password
-
- err = mc.sendEncryptedPassword(oldAuthData, pubKey)
-
- if err != nil {
-
- return err
-
- }
-
- }
-
- return mc.readResultOK()
-
- default:
-
- return ErrMalformPkt
-
- }
-
- default:
-
- return ErrMalformPkt
-
- }
-
- case "sha256_password":
-
- switch len(authData) {
-
- case 0:
-
- return nil // auth successful
-
- default:
-
- block, _ := pem.Decode(authData)
-
- pub, err := x509.ParsePKIXPublicKey(block.Bytes)
-
- if err != nil {
-
- return err
-
- }
-
- // send encrypted password
-
- err = mc.sendEncryptedPassword(oldAuthData, pub.(*rsa.PublicKey))
-
- if err != nil {
-
- return err
-
- }
-
- return mc.readResultOK()
-
- }
-
- default:
-
- return nil // auth successful
-
- }
-
- return err
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/buffer.go b/vendor/github.com/go-sql-driver/mysql/buffer.go
deleted file mode 100644
index cf63aae..0000000
--- a/vendor/github.com/go-sql-driver/mysql/buffer.go
+++ /dev/null
@@ -1,307 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-
-//
-
-// Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-import (
- "io"
- "net"
- "time"
-)
-
-const defaultBufSize = 4096
-
-const maxCachedBufSize = 256 * 1024
-
-// A buffer which is used for both reading and writing.
-
-// This is possible since communication on each connection is synchronous.
-
-// In other words, we can't write and read simultaneously on the same connection.
-
-// The buffer is similar to bufio.Reader / Writer but zero-copy-ish
-
-// Also highly optimized for this particular use case.
-
-// This buffer is backed by two byte slices in a double-buffering scheme
-
-type buffer struct {
- buf []byte // buf is a byte buffer who's length and capacity are equal.
-
- nc net.Conn
-
- idx int
-
- length int
-
- timeout time.Duration
-
- dbuf [2][]byte // dbuf is an array with the two byte slices that back this buffer
-
- flipcnt uint // flipccnt is the current buffer counter for double-buffering
-
-}
-
-// newBuffer allocates and returns a new buffer.
-
-func newBuffer(nc net.Conn) buffer {
-
- fg := make([]byte, defaultBufSize)
-
- return buffer{
-
- buf: fg,
-
- nc: nc,
-
- dbuf: [2][]byte{fg, nil},
- }
-
-}
-
-// flip replaces the active buffer with the background buffer
-
-// this is a delayed flip that simply increases the buffer counter;
-
-// the actual flip will be performed the next time we call `buffer.fill`
-
-func (b *buffer) flip() {
-
- b.flipcnt += 1
-
-}
-
-// fill reads into the buffer until at least _need_ bytes are in it
-
-func (b *buffer) fill(need int) error {
-
- n := b.length
-
- // fill data into its double-buffering target: if we've called
-
- // flip on this buffer, we'll be copying to the background buffer,
-
- // and then filling it with network data; otherwise we'll just move
-
- // the contents of the current buffer to the front before filling it
-
- dest := b.dbuf[b.flipcnt&1]
-
- // grow buffer if necessary to fit the whole packet.
-
- if need > len(dest) {
-
- // Round up to the next multiple of the default size
-
- dest = make([]byte, ((need/defaultBufSize)+1)*defaultBufSize)
-
- // if the allocated buffer is not too large, move it to backing storage
-
- // to prevent extra allocations on applications that perform large reads
-
- if len(dest) <= maxCachedBufSize {
-
- b.dbuf[b.flipcnt&1] = dest
-
- }
-
- }
-
- // if we're filling the fg buffer, move the existing data to the start of it.
-
- // if we're filling the bg buffer, copy over the data
-
- if n > 0 {
-
- copy(dest[:n], b.buf[b.idx:])
-
- }
-
- b.buf = dest
-
- b.idx = 0
-
- for {
-
- if b.timeout > 0 {
-
- if err := b.nc.SetReadDeadline(time.Now().Add(b.timeout)); err != nil {
-
- return err
-
- }
-
- }
-
- nn, err := b.nc.Read(b.buf[n:])
-
- n += nn
-
- switch err {
-
- case nil:
-
- if n < need {
-
- continue
-
- }
-
- b.length = n
-
- return nil
-
- case io.EOF:
-
- if n >= need {
-
- b.length = n
-
- return nil
-
- }
-
- return io.ErrUnexpectedEOF
-
- default:
-
- return err
-
- }
-
- }
-
-}
-
-// returns next N bytes from buffer.
-
-// The returned slice is only guaranteed to be valid until the next read
-
-func (b *buffer) readNext(need int) ([]byte, error) {
-
- if b.length < need {
-
- // refill
-
- if err := b.fill(need); err != nil {
-
- return nil, err
-
- }
-
- }
-
- offset := b.idx
-
- b.idx += need
-
- b.length -= need
-
- return b.buf[offset:b.idx], nil
-
-}
-
-// takeBuffer returns a buffer with the requested size.
-
-// If possible, a slice from the existing buffer is returned.
-
-// Otherwise a bigger buffer is made.
-
-// Only one buffer (total) can be used at a time.
-
-func (b *buffer) takeBuffer(length int) ([]byte, error) {
-
- if b.length > 0 {
-
- return nil, ErrBusyBuffer
-
- }
-
- // test (cheap) general case first
-
- if length <= cap(b.buf) {
-
- return b.buf[:length], nil
-
- }
-
- if length < maxPacketSize {
-
- b.buf = make([]byte, length)
-
- return b.buf, nil
-
- }
-
- // buffer is larger than we want to store.
-
- return make([]byte, length), nil
-
-}
-
-// takeSmallBuffer is shortcut which can be used if length is
-
-// known to be smaller than defaultBufSize.
-
-// Only one buffer (total) can be used at a time.
-
-func (b *buffer) takeSmallBuffer(length int) ([]byte, error) {
-
- if b.length > 0 {
-
- return nil, ErrBusyBuffer
-
- }
-
- return b.buf[:length], nil
-
-}
-
-// takeCompleteBuffer returns the complete existing buffer.
-
-// This can be used if the necessary buffer size is unknown.
-
-// cap and len of the returned buffer will be equal.
-
-// Only one buffer (total) can be used at a time.
-
-func (b *buffer) takeCompleteBuffer() ([]byte, error) {
-
- if b.length > 0 {
-
- return nil, ErrBusyBuffer
-
- }
-
- return b.buf, nil
-
-}
-
-// store stores buf, an updated buffer, if its suitable to do so.
-
-func (b *buffer) store(buf []byte) error {
-
- if b.length > 0 {
-
- return ErrBusyBuffer
-
- } else if cap(buf) <= maxPacketSize && cap(buf) > cap(b.buf) {
-
- b.buf = buf[:cap(buf)]
-
- }
-
- return nil
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/collations.go b/vendor/github.com/go-sql-driver/mysql/collations.go
deleted file mode 100644
index 326a9f7..0000000
--- a/vendor/github.com/go-sql-driver/mysql/collations.go
+++ /dev/null
@@ -1,265 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-//
-// Copyright 2014 The Go-MySQL-Driver Authors. All rights reserved.
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-const defaultCollation = "utf8mb4_general_ci"
-const binaryCollation = "binary"
-
-// A list of available collations mapped to the internal ID.
-// To update this map use the following MySQL query:
-// SELECT COLLATION_NAME, ID FROM information_schema.COLLATIONS WHERE ID<256 ORDER BY ID
-//
-// Handshake packet have only 1 byte for collation_id. So we can't use collations with ID > 255.
-//
-// ucs2, utf16, and utf32 can't be used for connection charset.
-// https://dev.mysql.com/doc/refman/5.7/en/charset-connection.html#charset-connection-impermissible-client-charset
-// They are commented out to reduce this map.
-var collations = map[string]byte{
- "big5_chinese_ci": 1,
- "latin2_czech_cs": 2,
- "dec8_swedish_ci": 3,
- "cp850_general_ci": 4,
- "latin1_german1_ci": 5,
- "hp8_english_ci": 6,
- "koi8r_general_ci": 7,
- "latin1_swedish_ci": 8,
- "latin2_general_ci": 9,
- "swe7_swedish_ci": 10,
- "ascii_general_ci": 11,
- "ujis_japanese_ci": 12,
- "sjis_japanese_ci": 13,
- "cp1251_bulgarian_ci": 14,
- "latin1_danish_ci": 15,
- "hebrew_general_ci": 16,
- "tis620_thai_ci": 18,
- "euckr_korean_ci": 19,
- "latin7_estonian_cs": 20,
- "latin2_hungarian_ci": 21,
- "koi8u_general_ci": 22,
- "cp1251_ukrainian_ci": 23,
- "gb2312_chinese_ci": 24,
- "greek_general_ci": 25,
- "cp1250_general_ci": 26,
- "latin2_croatian_ci": 27,
- "gbk_chinese_ci": 28,
- "cp1257_lithuanian_ci": 29,
- "latin5_turkish_ci": 30,
- "latin1_german2_ci": 31,
- "armscii8_general_ci": 32,
- "utf8_general_ci": 33,
- "cp1250_czech_cs": 34,
- //"ucs2_general_ci": 35,
- "cp866_general_ci": 36,
- "keybcs2_general_ci": 37,
- "macce_general_ci": 38,
- "macroman_general_ci": 39,
- "cp852_general_ci": 40,
- "latin7_general_ci": 41,
- "latin7_general_cs": 42,
- "macce_bin": 43,
- "cp1250_croatian_ci": 44,
- "utf8mb4_general_ci": 45,
- "utf8mb4_bin": 46,
- "latin1_bin": 47,
- "latin1_general_ci": 48,
- "latin1_general_cs": 49,
- "cp1251_bin": 50,
- "cp1251_general_ci": 51,
- "cp1251_general_cs": 52,
- "macroman_bin": 53,
- //"utf16_general_ci": 54,
- //"utf16_bin": 55,
- //"utf16le_general_ci": 56,
- "cp1256_general_ci": 57,
- "cp1257_bin": 58,
- "cp1257_general_ci": 59,
- //"utf32_general_ci": 60,
- //"utf32_bin": 61,
- //"utf16le_bin": 62,
- "binary": 63,
- "armscii8_bin": 64,
- "ascii_bin": 65,
- "cp1250_bin": 66,
- "cp1256_bin": 67,
- "cp866_bin": 68,
- "dec8_bin": 69,
- "greek_bin": 70,
- "hebrew_bin": 71,
- "hp8_bin": 72,
- "keybcs2_bin": 73,
- "koi8r_bin": 74,
- "koi8u_bin": 75,
- "utf8_tolower_ci": 76,
- "latin2_bin": 77,
- "latin5_bin": 78,
- "latin7_bin": 79,
- "cp850_bin": 80,
- "cp852_bin": 81,
- "swe7_bin": 82,
- "utf8_bin": 83,
- "big5_bin": 84,
- "euckr_bin": 85,
- "gb2312_bin": 86,
- "gbk_bin": 87,
- "sjis_bin": 88,
- "tis620_bin": 89,
- //"ucs2_bin": 90,
- "ujis_bin": 91,
- "geostd8_general_ci": 92,
- "geostd8_bin": 93,
- "latin1_spanish_ci": 94,
- "cp932_japanese_ci": 95,
- "cp932_bin": 96,
- "eucjpms_japanese_ci": 97,
- "eucjpms_bin": 98,
- "cp1250_polish_ci": 99,
- //"utf16_unicode_ci": 101,
- //"utf16_icelandic_ci": 102,
- //"utf16_latvian_ci": 103,
- //"utf16_romanian_ci": 104,
- //"utf16_slovenian_ci": 105,
- //"utf16_polish_ci": 106,
- //"utf16_estonian_ci": 107,
- //"utf16_spanish_ci": 108,
- //"utf16_swedish_ci": 109,
- //"utf16_turkish_ci": 110,
- //"utf16_czech_ci": 111,
- //"utf16_danish_ci": 112,
- //"utf16_lithuanian_ci": 113,
- //"utf16_slovak_ci": 114,
- //"utf16_spanish2_ci": 115,
- //"utf16_roman_ci": 116,
- //"utf16_persian_ci": 117,
- //"utf16_esperanto_ci": 118,
- //"utf16_hungarian_ci": 119,
- //"utf16_sinhala_ci": 120,
- //"utf16_german2_ci": 121,
- //"utf16_croatian_ci": 122,
- //"utf16_unicode_520_ci": 123,
- //"utf16_vietnamese_ci": 124,
- //"ucs2_unicode_ci": 128,
- //"ucs2_icelandic_ci": 129,
- //"ucs2_latvian_ci": 130,
- //"ucs2_romanian_ci": 131,
- //"ucs2_slovenian_ci": 132,
- //"ucs2_polish_ci": 133,
- //"ucs2_estonian_ci": 134,
- //"ucs2_spanish_ci": 135,
- //"ucs2_swedish_ci": 136,
- //"ucs2_turkish_ci": 137,
- //"ucs2_czech_ci": 138,
- //"ucs2_danish_ci": 139,
- //"ucs2_lithuanian_ci": 140,
- //"ucs2_slovak_ci": 141,
- //"ucs2_spanish2_ci": 142,
- //"ucs2_roman_ci": 143,
- //"ucs2_persian_ci": 144,
- //"ucs2_esperanto_ci": 145,
- //"ucs2_hungarian_ci": 146,
- //"ucs2_sinhala_ci": 147,
- //"ucs2_german2_ci": 148,
- //"ucs2_croatian_ci": 149,
- //"ucs2_unicode_520_ci": 150,
- //"ucs2_vietnamese_ci": 151,
- //"ucs2_general_mysql500_ci": 159,
- //"utf32_unicode_ci": 160,
- //"utf32_icelandic_ci": 161,
- //"utf32_latvian_ci": 162,
- //"utf32_romanian_ci": 163,
- //"utf32_slovenian_ci": 164,
- //"utf32_polish_ci": 165,
- //"utf32_estonian_ci": 166,
- //"utf32_spanish_ci": 167,
- //"utf32_swedish_ci": 168,
- //"utf32_turkish_ci": 169,
- //"utf32_czech_ci": 170,
- //"utf32_danish_ci": 171,
- //"utf32_lithuanian_ci": 172,
- //"utf32_slovak_ci": 173,
- //"utf32_spanish2_ci": 174,
- //"utf32_roman_ci": 175,
- //"utf32_persian_ci": 176,
- //"utf32_esperanto_ci": 177,
- //"utf32_hungarian_ci": 178,
- //"utf32_sinhala_ci": 179,
- //"utf32_german2_ci": 180,
- //"utf32_croatian_ci": 181,
- //"utf32_unicode_520_ci": 182,
- //"utf32_vietnamese_ci": 183,
- "utf8_unicode_ci": 192,
- "utf8_icelandic_ci": 193,
- "utf8_latvian_ci": 194,
- "utf8_romanian_ci": 195,
- "utf8_slovenian_ci": 196,
- "utf8_polish_ci": 197,
- "utf8_estonian_ci": 198,
- "utf8_spanish_ci": 199,
- "utf8_swedish_ci": 200,
- "utf8_turkish_ci": 201,
- "utf8_czech_ci": 202,
- "utf8_danish_ci": 203,
- "utf8_lithuanian_ci": 204,
- "utf8_slovak_ci": 205,
- "utf8_spanish2_ci": 206,
- "utf8_roman_ci": 207,
- "utf8_persian_ci": 208,
- "utf8_esperanto_ci": 209,
- "utf8_hungarian_ci": 210,
- "utf8_sinhala_ci": 211,
- "utf8_german2_ci": 212,
- "utf8_croatian_ci": 213,
- "utf8_unicode_520_ci": 214,
- "utf8_vietnamese_ci": 215,
- "utf8_general_mysql500_ci": 223,
- "utf8mb4_unicode_ci": 224,
- "utf8mb4_icelandic_ci": 225,
- "utf8mb4_latvian_ci": 226,
- "utf8mb4_romanian_ci": 227,
- "utf8mb4_slovenian_ci": 228,
- "utf8mb4_polish_ci": 229,
- "utf8mb4_estonian_ci": 230,
- "utf8mb4_spanish_ci": 231,
- "utf8mb4_swedish_ci": 232,
- "utf8mb4_turkish_ci": 233,
- "utf8mb4_czech_ci": 234,
- "utf8mb4_danish_ci": 235,
- "utf8mb4_lithuanian_ci": 236,
- "utf8mb4_slovak_ci": 237,
- "utf8mb4_spanish2_ci": 238,
- "utf8mb4_roman_ci": 239,
- "utf8mb4_persian_ci": 240,
- "utf8mb4_esperanto_ci": 241,
- "utf8mb4_hungarian_ci": 242,
- "utf8mb4_sinhala_ci": 243,
- "utf8mb4_german2_ci": 244,
- "utf8mb4_croatian_ci": 245,
- "utf8mb4_unicode_520_ci": 246,
- "utf8mb4_vietnamese_ci": 247,
- "gb18030_chinese_ci": 248,
- "gb18030_bin": 249,
- "gb18030_unicode_520_ci": 250,
- "utf8mb4_0900_ai_ci": 255,
-}
-
-// A denylist of collations which is unsafe to interpolate parameters.
-// These multibyte encodings may contains 0x5c (`\`) in their trailing bytes.
-var unsafeCollations = map[string]bool{
- "big5_chinese_ci": true,
- "sjis_japanese_ci": true,
- "gbk_chinese_ci": true,
- "big5_bin": true,
- "gb2312_bin": true,
- "gbk_bin": true,
- "sjis_bin": true,
- "cp932_japanese_ci": true,
- "cp932_bin": true,
- "gb18030_chinese_ci": true,
- "gb18030_bin": true,
- "gb18030_unicode_520_ci": true,
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/conncheck.go b/vendor/github.com/go-sql-driver/mysql/conncheck.go
deleted file mode 100644
index 0f8bd80..0000000
--- a/vendor/github.com/go-sql-driver/mysql/conncheck.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-
-//
-
-// Copyright 2019 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-//go:build linux || darwin || dragonfly || freebsd || netbsd || openbsd || solaris || illumos
-// +build linux darwin dragonfly freebsd netbsd openbsd solaris illumos
-
-package mysql
-
-import (
- "errors"
- "io"
- "net"
- "syscall"
-)
-
-var errUnexpectedRead = errors.New("unexpected read from socket")
-
-func connCheck(conn net.Conn) error {
-
- var sysErr error
-
- sysConn, ok := conn.(syscall.Conn)
-
- if !ok {
-
- return nil
-
- }
-
- rawConn, err := sysConn.SyscallConn()
-
- if err != nil {
-
- return err
-
- }
-
- err = rawConn.Read(func(fd uintptr) bool {
-
- var buf [1]byte
-
- n, err := syscall.Read(int(fd), buf[:])
-
- switch {
-
- case n == 0 && err == nil:
-
- sysErr = io.EOF
-
- case n > 0:
-
- sysErr = errUnexpectedRead
-
- case err == syscall.EAGAIN || err == syscall.EWOULDBLOCK:
-
- sysErr = nil
-
- default:
-
- sysErr = err
-
- }
-
- return true
-
- })
-
- if err != nil {
-
- return err
-
- }
-
- return sysErr
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/conncheck_dummy.go b/vendor/github.com/go-sql-driver/mysql/conncheck_dummy.go
deleted file mode 100644
index ea7fb60..0000000
--- a/vendor/github.com/go-sql-driver/mysql/conncheck_dummy.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-//
-// Copyright 2019 The Go-MySQL-Driver Authors. All rights reserved.
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-// +build !linux,!darwin,!dragonfly,!freebsd,!netbsd,!openbsd,!solaris,!illumos
-
-package mysql
-
-import "net"
-
-func connCheck(conn net.Conn) error {
- return nil
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/connection.go b/vendor/github.com/go-sql-driver/mysql/connection.go
deleted file mode 100644
index cebfd4f..0000000
--- a/vendor/github.com/go-sql-driver/mysql/connection.go
+++ /dev/null
@@ -1,1132 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-
-//
-
-// Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-import (
- "context"
- "database/sql"
- "database/sql/driver"
- "encoding/json"
- "io"
- "net"
- "strconv"
- "strings"
- "time"
-)
-
-type mysqlConn struct {
- buf buffer
-
- netConn net.Conn
-
- rawConn net.Conn // underlying connection when netConn is TLS connection.
-
- affectedRows uint64
-
- insertId uint64
-
- cfg *Config
-
- maxAllowedPacket int
-
- maxWriteSize int
-
- writeTimeout time.Duration
-
- flags clientFlag
-
- status statusFlag
-
- sequence uint8
-
- parseTime bool
-
- reset bool // set when the Go SQL package calls ResetSession
-
- // for context support (Go 1.8+)
-
- watching bool
-
- watcher chan<- context.Context
-
- closech chan struct{}
-
- finished chan<- struct{}
-
- canceled atomicError // set non-nil if conn is canceled
-
- closed atomicBool // set when conn is closed, before closech is closed
-
-}
-
-// Handles parameters set in DSN after the connection is established
-
-func (mc *mysqlConn) handleParams() (err error) {
-
- var cmdSet strings.Builder
-
- for param, val := range mc.cfg.Params {
-
- switch param {
-
- // Charset: character_set_connection, character_set_client, character_set_results
-
- case "charset":
-
- charsets := strings.Split(val, ",")
-
- for i := range charsets {
-
- // ignore errors here - a charset may not exist
-
- err = mc.exec("SET NAMES " + charsets[i])
-
- if err == nil {
-
- break
-
- }
-
- }
-
- if err != nil {
-
- return
-
- }
-
- // Other system vars accumulated in a single SET command
-
- default:
-
- if cmdSet.Len() == 0 {
-
- // Heuristic: 29 chars for each other key=value to reduce reallocations
-
- cmdSet.Grow(4 + len(param) + 1 + len(val) + 30*(len(mc.cfg.Params)-1))
-
- cmdSet.WriteString("SET ")
-
- } else {
-
- cmdSet.WriteByte(',')
-
- }
-
- cmdSet.WriteString(param)
-
- cmdSet.WriteByte('=')
-
- cmdSet.WriteString(val)
-
- }
-
- }
-
- if cmdSet.Len() > 0 {
-
- err = mc.exec(cmdSet.String())
-
- if err != nil {
-
- return
-
- }
-
- }
-
- return
-
-}
-
-func (mc *mysqlConn) markBadConn(err error) error {
-
- if mc == nil {
-
- return err
-
- }
-
- if err != errBadConnNoWrite {
-
- return err
-
- }
-
- return driver.ErrBadConn
-
-}
-
-func (mc *mysqlConn) Begin() (driver.Tx, error) {
-
- return mc.begin(false)
-
-}
-
-func (mc *mysqlConn) begin(readOnly bool) (driver.Tx, error) {
-
- if mc.closed.IsSet() {
-
- errLog.Print(ErrInvalidConn)
-
- return nil, driver.ErrBadConn
-
- }
-
- var q string
-
- if readOnly {
-
- q = "START TRANSACTION READ ONLY"
-
- } else {
-
- q = "START TRANSACTION"
-
- }
-
- err := mc.exec(q)
-
- if err == nil {
-
- return &mysqlTx{mc}, err
-
- }
-
- return nil, mc.markBadConn(err)
-
-}
-
-func (mc *mysqlConn) Close() (err error) {
-
- // Makes Close idempotent
-
- if !mc.closed.IsSet() {
-
- err = mc.writeCommandPacket(comQuit)
-
- }
-
- mc.cleanup()
-
- return
-
-}
-
-// Closes the network connection and unsets internal variables. Do not call this
-
-// function after successfully authentication, call Close instead. This function
-
-// is called before auth or on auth failure because MySQL will have already
-
-// closed the network connection.
-
-func (mc *mysqlConn) cleanup() {
-
- if !mc.closed.TrySet(true) {
-
- return
-
- }
-
- // Makes cleanup idempotent
-
- close(mc.closech)
-
- if mc.netConn == nil {
-
- return
-
- }
-
- if err := mc.netConn.Close(); err != nil {
-
- errLog.Print(err)
-
- }
-
-}
-
-func (mc *mysqlConn) error() error {
-
- if mc.closed.IsSet() {
-
- if err := mc.canceled.Value(); err != nil {
-
- return err
-
- }
-
- return ErrInvalidConn
-
- }
-
- return nil
-
-}
-
-func (mc *mysqlConn) Prepare(query string) (driver.Stmt, error) {
-
- if mc.closed.IsSet() {
-
- errLog.Print(ErrInvalidConn)
-
- return nil, driver.ErrBadConn
-
- }
-
- // Send command
-
- err := mc.writeCommandPacketStr(comStmtPrepare, query)
-
- if err != nil {
-
- // STMT_PREPARE is safe to retry. So we can return ErrBadConn here.
-
- errLog.Print(err)
-
- return nil, driver.ErrBadConn
-
- }
-
- stmt := &mysqlStmt{
-
- mc: mc,
- }
-
- // Read Result
-
- columnCount, err := stmt.readPrepareResultPacket()
-
- if err == nil {
-
- if stmt.paramCount > 0 {
-
- if err = mc.readUntilEOF(); err != nil {
-
- return nil, err
-
- }
-
- }
-
- if columnCount > 0 {
-
- err = mc.readUntilEOF()
-
- }
-
- }
-
- return stmt, err
-
-}
-
-func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (string, error) {
-
- // Number of ? should be same to len(args)
-
- if strings.Count(query, "?") != len(args) {
-
- return "", driver.ErrSkip
-
- }
-
- buf, err := mc.buf.takeCompleteBuffer()
-
- if err != nil {
-
- // can not take the buffer. Something must be wrong with the connection
-
- errLog.Print(err)
-
- return "", ErrInvalidConn
-
- }
-
- buf = buf[:0]
-
- argPos := 0
-
- for i := 0; i < len(query); i++ {
-
- q := strings.IndexByte(query[i:], '?')
-
- if q == -1 {
-
- buf = append(buf, query[i:]...)
-
- break
-
- }
-
- buf = append(buf, query[i:i+q]...)
-
- i += q
-
- arg := args[argPos]
-
- argPos++
-
- if arg == nil {
-
- buf = append(buf, "NULL"...)
-
- continue
-
- }
-
- switch v := arg.(type) {
-
- case int64:
-
- buf = strconv.AppendInt(buf, v, 10)
-
- case uint64:
-
- // Handle uint64 explicitly because our custom ConvertValue emits unsigned values
-
- buf = strconv.AppendUint(buf, v, 10)
-
- case float64:
-
- buf = strconv.AppendFloat(buf, v, 'g', -1, 64)
-
- case bool:
-
- if v {
-
- buf = append(buf, '1')
-
- } else {
-
- buf = append(buf, '0')
-
- }
-
- case time.Time:
-
- if v.IsZero() {
-
- buf = append(buf, "'0000-00-00'"...)
-
- } else {
-
- buf = append(buf, '\'')
-
- buf, err = appendDateTime(buf, v.In(mc.cfg.Loc))
-
- if err != nil {
-
- return "", err
-
- }
-
- buf = append(buf, '\'')
-
- }
-
- case json.RawMessage:
-
- buf = append(buf, '\'')
-
- if mc.status&statusNoBackslashEscapes == 0 {
-
- buf = escapeBytesBackslash(buf, v)
-
- } else {
-
- buf = escapeBytesQuotes(buf, v)
-
- }
-
- buf = append(buf, '\'')
-
- case []byte:
-
- if v == nil {
-
- buf = append(buf, "NULL"...)
-
- } else {
-
- buf = append(buf, "_binary'"...)
-
- if mc.status&statusNoBackslashEscapes == 0 {
-
- buf = escapeBytesBackslash(buf, v)
-
- } else {
-
- buf = escapeBytesQuotes(buf, v)
-
- }
-
- buf = append(buf, '\'')
-
- }
-
- case string:
-
- buf = append(buf, '\'')
-
- if mc.status&statusNoBackslashEscapes == 0 {
-
- buf = escapeStringBackslash(buf, v)
-
- } else {
-
- buf = escapeStringQuotes(buf, v)
-
- }
-
- buf = append(buf, '\'')
-
- default:
-
- return "", driver.ErrSkip
-
- }
-
- if len(buf)+4 > mc.maxAllowedPacket {
-
- return "", driver.ErrSkip
-
- }
-
- }
-
- if argPos != len(args) {
-
- return "", driver.ErrSkip
-
- }
-
- return string(buf), nil
-
-}
-
-func (mc *mysqlConn) Exec(query string, args []driver.Value) (driver.Result, error) {
-
- if mc.closed.IsSet() {
-
- errLog.Print(ErrInvalidConn)
-
- return nil, driver.ErrBadConn
-
- }
-
- if len(args) != 0 {
-
- if !mc.cfg.InterpolateParams {
-
- return nil, driver.ErrSkip
-
- }
-
- // try to interpolate the parameters to save extra roundtrips for preparing and closing a statement
-
- prepared, err := mc.interpolateParams(query, args)
-
- if err != nil {
-
- return nil, err
-
- }
-
- query = prepared
-
- }
-
- mc.affectedRows = 0
-
- mc.insertId = 0
-
- err := mc.exec(query)
-
- if err == nil {
-
- return &mysqlResult{
-
- affectedRows: int64(mc.affectedRows),
-
- insertId: int64(mc.insertId),
- }, err
-
- }
-
- return nil, mc.markBadConn(err)
-
-}
-
-// Internal function to execute commands
-
-func (mc *mysqlConn) exec(query string) error {
-
- // Send command
-
- if err := mc.writeCommandPacketStr(comQuery, query); err != nil {
-
- return mc.markBadConn(err)
-
- }
-
- // Read Result
-
- resLen, err := mc.readResultSetHeaderPacket()
-
- if err != nil {
-
- return err
-
- }
-
- if resLen > 0 {
-
- // columns
-
- if err := mc.readUntilEOF(); err != nil {
-
- return err
-
- }
-
- // rows
-
- if err := mc.readUntilEOF(); err != nil {
-
- return err
-
- }
-
- }
-
- return mc.discardResults()
-
-}
-
-func (mc *mysqlConn) Query(query string, args []driver.Value) (driver.Rows, error) {
-
- return mc.query(query, args)
-
-}
-
-func (mc *mysqlConn) query(query string, args []driver.Value) (*textRows, error) {
-
- if mc.closed.IsSet() {
-
- errLog.Print(ErrInvalidConn)
-
- return nil, driver.ErrBadConn
-
- }
-
- if len(args) != 0 {
-
- if !mc.cfg.InterpolateParams {
-
- return nil, driver.ErrSkip
-
- }
-
- // try client-side prepare to reduce roundtrip
-
- prepared, err := mc.interpolateParams(query, args)
-
- if err != nil {
-
- return nil, err
-
- }
-
- query = prepared
-
- }
-
- // Send command
-
- err := mc.writeCommandPacketStr(comQuery, query)
-
- if err == nil {
-
- // Read Result
-
- var resLen int
-
- resLen, err = mc.readResultSetHeaderPacket()
-
- if err == nil {
-
- rows := new(textRows)
-
- rows.mc = mc
-
- if resLen == 0 {
-
- rows.rs.done = true
-
- switch err := rows.NextResultSet(); err {
-
- case nil, io.EOF:
-
- return rows, nil
-
- default:
-
- return nil, err
-
- }
-
- }
-
- // Columns
-
- rows.rs.columns, err = mc.readColumns(resLen)
-
- return rows, err
-
- }
-
- }
-
- return nil, mc.markBadConn(err)
-
-}
-
-// Gets the value of the given MySQL System Variable
-
-// The returned byte slice is only valid until the next read
-
-func (mc *mysqlConn) getSystemVar(name string) ([]byte, error) {
-
- // Send command
-
- if err := mc.writeCommandPacketStr(comQuery, "SELECT @@"+name); err != nil {
-
- return nil, err
-
- }
-
- // Read Result
-
- resLen, err := mc.readResultSetHeaderPacket()
-
- if err == nil {
-
- rows := new(textRows)
-
- rows.mc = mc
-
- rows.rs.columns = []mysqlField{{fieldType: fieldTypeVarChar}}
-
- if resLen > 0 {
-
- // Columns
-
- if err := mc.readUntilEOF(); err != nil {
-
- return nil, err
-
- }
-
- }
-
- dest := make([]driver.Value, resLen)
-
- if err = rows.readRow(dest); err == nil {
-
- return dest[0].([]byte), mc.readUntilEOF()
-
- }
-
- }
-
- return nil, err
-
-}
-
-// finish is called when the query has canceled.
-
-func (mc *mysqlConn) cancel(err error) {
-
- mc.canceled.Set(err)
-
- mc.cleanup()
-
-}
-
-// finish is called when the query has succeeded.
-
-func (mc *mysqlConn) finish() {
-
- if !mc.watching || mc.finished == nil {
-
- return
-
- }
-
- select {
-
- case mc.finished <- struct{}{}:
-
- mc.watching = false
-
- case <-mc.closech:
-
- }
-
-}
-
-// Ping implements driver.Pinger interface
-
-func (mc *mysqlConn) Ping(ctx context.Context) (err error) {
-
- if mc.closed.IsSet() {
-
- errLog.Print(ErrInvalidConn)
-
- return driver.ErrBadConn
-
- }
-
- if err = mc.watchCancel(ctx); err != nil {
-
- return
-
- }
-
- defer mc.finish()
-
- if err = mc.writeCommandPacket(comPing); err != nil {
-
- return mc.markBadConn(err)
-
- }
-
- return mc.readResultOK()
-
-}
-
-// BeginTx implements driver.ConnBeginTx interface
-
-func (mc *mysqlConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {
-
- if mc.closed.IsSet() {
-
- return nil, driver.ErrBadConn
-
- }
-
- if err := mc.watchCancel(ctx); err != nil {
-
- return nil, err
-
- }
-
- defer mc.finish()
-
- if sql.IsolationLevel(opts.Isolation) != sql.LevelDefault {
-
- level, err := mapIsolationLevel(opts.Isolation)
-
- if err != nil {
-
- return nil, err
-
- }
-
- err = mc.exec("SET TRANSACTION ISOLATION LEVEL " + level)
-
- if err != nil {
-
- return nil, err
-
- }
-
- }
-
- return mc.begin(opts.ReadOnly)
-
-}
-
-func (mc *mysqlConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) {
-
- dargs, err := namedValueToValue(args)
-
- if err != nil {
-
- return nil, err
-
- }
-
- if err := mc.watchCancel(ctx); err != nil {
-
- return nil, err
-
- }
-
- rows, err := mc.query(query, dargs)
-
- if err != nil {
-
- mc.finish()
-
- return nil, err
-
- }
-
- rows.finish = mc.finish
-
- return rows, err
-
-}
-
-func (mc *mysqlConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) {
-
- dargs, err := namedValueToValue(args)
-
- if err != nil {
-
- return nil, err
-
- }
-
- if err := mc.watchCancel(ctx); err != nil {
-
- return nil, err
-
- }
-
- defer mc.finish()
-
- return mc.Exec(query, dargs)
-
-}
-
-func (mc *mysqlConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) {
-
- if err := mc.watchCancel(ctx); err != nil {
-
- return nil, err
-
- }
-
- stmt, err := mc.Prepare(query)
-
- mc.finish()
-
- if err != nil {
-
- return nil, err
-
- }
-
- select {
-
- default:
-
- case <-ctx.Done():
-
- stmt.Close()
-
- return nil, ctx.Err()
-
- }
-
- return stmt, nil
-
-}
-
-func (stmt *mysqlStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {
-
- dargs, err := namedValueToValue(args)
-
- if err != nil {
-
- return nil, err
-
- }
-
- if err := stmt.mc.watchCancel(ctx); err != nil {
-
- return nil, err
-
- }
-
- rows, err := stmt.query(dargs)
-
- if err != nil {
-
- stmt.mc.finish()
-
- return nil, err
-
- }
-
- rows.finish = stmt.mc.finish
-
- return rows, err
-
-}
-
-func (stmt *mysqlStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) {
-
- dargs, err := namedValueToValue(args)
-
- if err != nil {
-
- return nil, err
-
- }
-
- if err := stmt.mc.watchCancel(ctx); err != nil {
-
- return nil, err
-
- }
-
- defer stmt.mc.finish()
-
- return stmt.Exec(dargs)
-
-}
-
-func (mc *mysqlConn) watchCancel(ctx context.Context) error {
-
- if mc.watching {
-
- // Reach here if canceled,
-
- // so the connection is already invalid
-
- mc.cleanup()
-
- return nil
-
- }
-
- // When ctx is already cancelled, don't watch it.
-
- if err := ctx.Err(); err != nil {
-
- return err
-
- }
-
- // When ctx is not cancellable, don't watch it.
-
- if ctx.Done() == nil {
-
- return nil
-
- }
-
- // When watcher is not alive, can't watch it.
-
- if mc.watcher == nil {
-
- return nil
-
- }
-
- mc.watching = true
-
- mc.watcher <- ctx
-
- return nil
-
-}
-
-func (mc *mysqlConn) startWatcher() {
-
- watcher := make(chan context.Context, 1)
-
- mc.watcher = watcher
-
- finished := make(chan struct{})
-
- mc.finished = finished
-
- go func() {
-
- for {
-
- var ctx context.Context
-
- select {
-
- case ctx = <-watcher:
-
- case <-mc.closech:
-
- return
-
- }
-
- select {
-
- case <-ctx.Done():
-
- mc.cancel(ctx.Err())
-
- case <-finished:
-
- case <-mc.closech:
-
- return
-
- }
-
- }
-
- }()
-
-}
-
-func (mc *mysqlConn) CheckNamedValue(nv *driver.NamedValue) (err error) {
-
- nv.Value, err = converter{}.ConvertValue(nv.Value)
-
- return
-
-}
-
-// ResetSession implements driver.SessionResetter.
-
-// (From Go 1.10)
-
-func (mc *mysqlConn) ResetSession(ctx context.Context) error {
-
- if mc.closed.IsSet() {
-
- return driver.ErrBadConn
-
- }
-
- mc.reset = true
-
- return nil
-
-}
-
-// IsValid implements driver.Validator interface
-
-// (From Go 1.15)
-
-func (mc *mysqlConn) IsValid() bool {
-
- return !mc.closed.IsSet()
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/connector.go b/vendor/github.com/go-sql-driver/mysql/connector.go
deleted file mode 100644
index 89d023b..0000000
--- a/vendor/github.com/go-sql-driver/mysql/connector.go
+++ /dev/null
@@ -1,247 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-
-//
-
-// Copyright 2018 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-import (
- "context"
- "database/sql/driver"
- "net"
-)
-
-type connector struct {
- cfg *Config // immutable private copy.
-
-}
-
-// Connect implements driver.Connector interface.
-
-// Connect returns a connection to the database.
-
-func (c *connector) Connect(ctx context.Context) (driver.Conn, error) {
-
- var err error
-
- // New mysqlConn
-
- mc := &mysqlConn{
-
- maxAllowedPacket: maxPacketSize,
-
- maxWriteSize: maxPacketSize - 1,
-
- closech: make(chan struct{}),
-
- cfg: c.cfg,
- }
-
- mc.parseTime = mc.cfg.ParseTime
-
- // Connect to Server
-
- dialsLock.RLock()
-
- dial, ok := dials[mc.cfg.Net]
-
- dialsLock.RUnlock()
-
- if ok {
-
- dctx := ctx
-
- if mc.cfg.Timeout > 0 {
-
- var cancel context.CancelFunc
-
- dctx, cancel = context.WithTimeout(ctx, c.cfg.Timeout)
-
- defer cancel()
-
- }
-
- mc.netConn, err = dial(dctx, mc.cfg.Addr)
-
- } else {
-
- nd := net.Dialer{Timeout: mc.cfg.Timeout}
-
- mc.netConn, err = nd.DialContext(ctx, mc.cfg.Net, mc.cfg.Addr)
-
- }
-
- if err != nil {
-
- return nil, err
-
- }
-
- // Enable TCP Keepalives on TCP connections
-
- if tc, ok := mc.netConn.(*net.TCPConn); ok {
-
- if err := tc.SetKeepAlive(true); err != nil {
-
- // Don't send COM_QUIT before handshake.
-
- mc.netConn.Close()
-
- mc.netConn = nil
-
- return nil, err
-
- }
-
- }
-
- // Call startWatcher for context support (From Go 1.8)
-
- mc.startWatcher()
-
- if err := mc.watchCancel(ctx); err != nil {
-
- mc.cleanup()
-
- return nil, err
-
- }
-
- defer mc.finish()
-
- mc.buf = newBuffer(mc.netConn)
-
- // Set I/O timeouts
-
- mc.buf.timeout = mc.cfg.ReadTimeout
-
- mc.writeTimeout = mc.cfg.WriteTimeout
-
- // Reading Handshake Initialization Packet
-
- authData, plugin, err := mc.readHandshakePacket()
-
- if err != nil {
-
- mc.cleanup()
-
- return nil, err
-
- }
-
- if plugin == "" {
-
- plugin = defaultAuthPlugin
-
- }
-
- // Send Client Authentication Packet
-
- authResp, err := mc.auth(authData, plugin)
-
- if err != nil {
-
- // try the default auth plugin, if using the requested plugin failed
-
- errLog.Print("could not use requested auth plugin '"+plugin+"': ", err.Error())
-
- plugin = defaultAuthPlugin
-
- authResp, err = mc.auth(authData, plugin)
-
- if err != nil {
-
- mc.cleanup()
-
- return nil, err
-
- }
-
- }
-
- if err = mc.writeHandshakeResponsePacket(authResp, plugin); err != nil {
-
- mc.cleanup()
-
- return nil, err
-
- }
-
- // Handle response to auth packet, switch methods if possible
-
- if err = mc.handleAuthResult(authData, plugin); err != nil {
-
- // Authentication failed and MySQL has already closed the connection
-
- // (https://dev.mysql.com/doc/internals/en/authentication-fails.html).
-
- // Do not send COM_QUIT, just cleanup and return the error.
-
- mc.cleanup()
-
- return nil, err
-
- }
-
- if mc.cfg.MaxAllowedPacket > 0 {
-
- mc.maxAllowedPacket = mc.cfg.MaxAllowedPacket
-
- } else {
-
- // Get max allowed packet size
-
- maxap, err := mc.getSystemVar("max_allowed_packet")
-
- if err != nil {
-
- mc.Close()
-
- return nil, err
-
- }
-
- mc.maxAllowedPacket = stringToInt(maxap) - 1
-
- }
-
- if mc.maxAllowedPacket < maxPacketSize {
-
- mc.maxWriteSize = mc.maxAllowedPacket
-
- }
-
- // Handle DSN Params
-
- err = mc.handleParams()
-
- if err != nil {
-
- mc.Close()
-
- return nil, err
-
- }
-
- return mc, nil
-
-}
-
-// Driver implements driver.Connector interface.
-
-// Driver returns &MySQLDriver{}.
-
-func (c *connector) Driver() driver.Driver {
-
- return &MySQLDriver{}
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/const.go b/vendor/github.com/go-sql-driver/mysql/const.go
deleted file mode 100644
index b1e6b85..0000000
--- a/vendor/github.com/go-sql-driver/mysql/const.go
+++ /dev/null
@@ -1,174 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-//
-// Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-const (
- defaultAuthPlugin = "mysql_native_password"
- defaultMaxAllowedPacket = 4 << 20 // 4 MiB
- minProtocolVersion = 10
- maxPacketSize = 1<<24 - 1
- timeFormat = "2006-01-02 15:04:05.999999"
-)
-
-// MySQL constants documentation:
-// http://dev.mysql.com/doc/internals/en/client-server-protocol.html
-
-const (
- iOK byte = 0x00
- iAuthMoreData byte = 0x01
- iLocalInFile byte = 0xfb
- iEOF byte = 0xfe
- iERR byte = 0xff
-)
-
-// https://dev.mysql.com/doc/internals/en/capability-flags.html#packet-Protocol::CapabilityFlags
-type clientFlag uint32
-
-const (
- clientLongPassword clientFlag = 1 << iota
- clientFoundRows
- clientLongFlag
- clientConnectWithDB
- clientNoSchema
- clientCompress
- clientODBC
- clientLocalFiles
- clientIgnoreSpace
- clientProtocol41
- clientInteractive
- clientSSL
- clientIgnoreSIGPIPE
- clientTransactions
- clientReserved
- clientSecureConn
- clientMultiStatements
- clientMultiResults
- clientPSMultiResults
- clientPluginAuth
- clientConnectAttrs
- clientPluginAuthLenEncClientData
- clientCanHandleExpiredPasswords
- clientSessionTrack
- clientDeprecateEOF
-)
-
-const (
- comQuit byte = iota + 1
- comInitDB
- comQuery
- comFieldList
- comCreateDB
- comDropDB
- comRefresh
- comShutdown
- comStatistics
- comProcessInfo
- comConnect
- comProcessKill
- comDebug
- comPing
- comTime
- comDelayedInsert
- comChangeUser
- comBinlogDump
- comTableDump
- comConnectOut
- comRegisterSlave
- comStmtPrepare
- comStmtExecute
- comStmtSendLongData
- comStmtClose
- comStmtReset
- comSetOption
- comStmtFetch
-)
-
-// https://dev.mysql.com/doc/internals/en/com-query-response.html#packet-Protocol::ColumnType
-type fieldType byte
-
-const (
- fieldTypeDecimal fieldType = iota
- fieldTypeTiny
- fieldTypeShort
- fieldTypeLong
- fieldTypeFloat
- fieldTypeDouble
- fieldTypeNULL
- fieldTypeTimestamp
- fieldTypeLongLong
- fieldTypeInt24
- fieldTypeDate
- fieldTypeTime
- fieldTypeDateTime
- fieldTypeYear
- fieldTypeNewDate
- fieldTypeVarChar
- fieldTypeBit
-)
-const (
- fieldTypeJSON fieldType = iota + 0xf5
- fieldTypeNewDecimal
- fieldTypeEnum
- fieldTypeSet
- fieldTypeTinyBLOB
- fieldTypeMediumBLOB
- fieldTypeLongBLOB
- fieldTypeBLOB
- fieldTypeVarString
- fieldTypeString
- fieldTypeGeometry
-)
-
-type fieldFlag uint16
-
-const (
- flagNotNULL fieldFlag = 1 << iota
- flagPriKey
- flagUniqueKey
- flagMultipleKey
- flagBLOB
- flagUnsigned
- flagZeroFill
- flagBinary
- flagEnum
- flagAutoIncrement
- flagTimestamp
- flagSet
- flagUnknown1
- flagUnknown2
- flagUnknown3
- flagUnknown4
-)
-
-// http://dev.mysql.com/doc/internals/en/status-flags.html
-type statusFlag uint16
-
-const (
- statusInTrans statusFlag = 1 << iota
- statusInAutocommit
- statusReserved // Not in documentation
- statusMoreResultsExists
- statusNoGoodIndexUsed
- statusNoIndexUsed
- statusCursorExists
- statusLastRowSent
- statusDbDropped
- statusNoBackslashEscapes
- statusMetadataChanged
- statusQueryWasSlow
- statusPsOutParams
- statusInTransReadonly
- statusSessionStateChanged
-)
-
-const (
- cachingSha2PasswordRequestPublicKey = 2
- cachingSha2PasswordFastAuthSuccess = 3
- cachingSha2PasswordPerformFullAuthentication = 4
-)
diff --git a/vendor/github.com/go-sql-driver/mysql/driver.go b/vendor/github.com/go-sql-driver/mysql/driver.go
deleted file mode 100644
index 365a697..0000000
--- a/vendor/github.com/go-sql-driver/mysql/driver.go
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-// Package mysql provides a MySQL driver for Go's database/sql package.
-
-//
-
-// The driver should be used via the database/sql package:
-
-//
-
-// import "database/sql"
-
-// import _ "github.com/go-sql-driver/mysql"
-
-//
-
-// db, err := sql.Open("mysql", "user:password@/dbname")
-
-//
-
-// See https://github.com/go-sql-driver/mysql#usage for details
-
-package mysql
-
-import (
- "context"
- "database/sql"
- "database/sql/driver"
- "net"
- "sync"
-)
-
-// MySQLDriver is exported to make the driver directly accessible.
-
-// In general the driver is used via the database/sql package.
-
-type MySQLDriver struct{}
-
-// DialFunc is a function which can be used to establish the network connection.
-
-// Custom dial functions must be registered with RegisterDial
-
-//
-
-// Deprecated: users should register a DialContextFunc instead
-
-type DialFunc func(addr string) (net.Conn, error)
-
-// DialContextFunc is a function which can be used to establish the network connection.
-
-// Custom dial functions must be registered with RegisterDialContext
-
-type DialContextFunc func(ctx context.Context, addr string) (net.Conn, error)
-
-var (
- dialsLock sync.RWMutex
-
- dials map[string]DialContextFunc
-)
-
-// RegisterDialContext registers a custom dial function. It can then be used by the
-
-// network address mynet(addr), where mynet is the registered new network.
-
-// The current context for the connection and its address is passed to the dial function.
-
-func RegisterDialContext(net string, dial DialContextFunc) {
-
- dialsLock.Lock()
-
- defer dialsLock.Unlock()
-
- if dials == nil {
-
- dials = make(map[string]DialContextFunc)
-
- }
-
- dials[net] = dial
-
-}
-
-// RegisterDial registers a custom dial function. It can then be used by the
-
-// network address mynet(addr), where mynet is the registered new network.
-
-// addr is passed as a parameter to the dial function.
-
-//
-
-// Deprecated: users should call RegisterDialContext instead
-
-func RegisterDial(network string, dial DialFunc) {
-
- RegisterDialContext(network, func(_ context.Context, addr string) (net.Conn, error) {
-
- return dial(addr)
-
- })
-
-}
-
-// Open new Connection.
-
-// See https://github.com/go-sql-driver/mysql#dsn-data-source-name for how
-
-// the DSN string is formatted
-
-func (d MySQLDriver) Open(dsn string) (driver.Conn, error) {
-
- cfg, err := ParseDSN(dsn)
-
- if err != nil {
-
- return nil, err
-
- }
-
- c := &connector{
-
- cfg: cfg,
- }
-
- return c.Connect(context.Background())
-
-}
-
-func init() {
-
- sql.Register("mysql", &MySQLDriver{})
-
-}
-
-// NewConnector returns new driver.Connector.
-
-func NewConnector(cfg *Config) (driver.Connector, error) {
-
- cfg = cfg.Clone()
-
- // normalize the contents of cfg so calls to NewConnector have the same
-
- // behavior as MySQLDriver.OpenConnector
-
- if err := cfg.normalize(); err != nil {
-
- return nil, err
-
- }
-
- return &connector{cfg: cfg}, nil
-
-}
-
-// OpenConnector implements driver.DriverContext.
-
-func (d MySQLDriver) OpenConnector(dsn string) (driver.Connector, error) {
-
- cfg, err := ParseDSN(dsn)
-
- if err != nil {
-
- return nil, err
-
- }
-
- return &connector{
-
- cfg: cfg,
- }, nil
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/dsn.go b/vendor/github.com/go-sql-driver/mysql/dsn.go
deleted file mode 100644
index 0e60064..0000000
--- a/vendor/github.com/go-sql-driver/mysql/dsn.go
+++ /dev/null
@@ -1,953 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-
-//
-
-// Copyright 2016 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-import (
- "bytes"
- "crypto/rsa"
- "crypto/tls"
- "errors"
- "fmt"
- "math/big"
- "net"
- "net/url"
- "sort"
- "strconv"
- "strings"
- "time"
-)
-
-var (
- errInvalidDSNUnescaped = errors.New("invalid DSN: did you forget to escape a param value?")
-
- errInvalidDSNAddr = errors.New("invalid DSN: network address not terminated (missing closing brace)")
-
- errInvalidDSNNoSlash = errors.New("invalid DSN: missing the slash separating the database name")
-
- errInvalidDSNUnsafeCollation = errors.New("invalid DSN: interpolateParams can not be used with unsafe collations")
-)
-
-// Config is a configuration parsed from a DSN string.
-
-// If a new Config is created instead of being parsed from a DSN string,
-
-// the NewConfig function should be used, which sets default values.
-
-type Config struct {
- User string // Username
-
- Passwd string // Password (requires User)
-
- Net string // Network type
-
- Addr string // Network address (requires Net)
-
- DBName string // Database name
-
- Params map[string]string // Connection parameters
-
- Collation string // Connection collation
-
- Loc *time.Location // Location for time.Time values
-
- MaxAllowedPacket int // Max packet size allowed
-
- ServerPubKey string // Server public key name
-
- pubKey *rsa.PublicKey // Server public key
-
- TLSConfig string // TLS configuration name
-
- tls *tls.Config // TLS configuration
-
- Timeout time.Duration // Dial timeout
-
- ReadTimeout time.Duration // I/O read timeout
-
- WriteTimeout time.Duration // I/O write timeout
-
- AllowAllFiles bool // Allow all files to be used with LOAD DATA LOCAL INFILE
-
- AllowCleartextPasswords bool // Allows the cleartext client side plugin
-
- AllowNativePasswords bool // Allows the native password authentication method
-
- AllowOldPasswords bool // Allows the old insecure password method
-
- CheckConnLiveness bool // Check connections for liveness before using them
-
- ClientFoundRows bool // Return number of matching rows instead of rows changed
-
- ColumnsWithAlias bool // Prepend table alias to column names
-
- InterpolateParams bool // Interpolate placeholders into query string
-
- MultiStatements bool // Allow multiple statements in one query
-
- ParseTime bool // Parse time values to time.Time
-
- RejectReadOnly bool // Reject read-only connections
-
-}
-
-// NewConfig creates a new Config and sets default values.
-
-func NewConfig() *Config {
-
- return &Config{
-
- Collation: defaultCollation,
-
- Loc: time.UTC,
-
- MaxAllowedPacket: defaultMaxAllowedPacket,
-
- AllowNativePasswords: true,
-
- CheckConnLiveness: true,
- }
-
-}
-
-func (cfg *Config) Clone() *Config {
-
- cp := *cfg
-
- if cp.tls != nil {
-
- cp.tls = cfg.tls.Clone()
-
- }
-
- if len(cp.Params) > 0 {
-
- cp.Params = make(map[string]string, len(cfg.Params))
-
- for k, v := range cfg.Params {
-
- cp.Params[k] = v
-
- }
-
- }
-
- if cfg.pubKey != nil {
-
- cp.pubKey = &rsa.PublicKey{
-
- N: new(big.Int).Set(cfg.pubKey.N),
-
- E: cfg.pubKey.E,
- }
-
- }
-
- return &cp
-
-}
-
-func (cfg *Config) normalize() error {
-
- if cfg.InterpolateParams && unsafeCollations[cfg.Collation] {
-
- return errInvalidDSNUnsafeCollation
-
- }
-
- // Set default network if empty
-
- if cfg.Net == "" {
-
- cfg.Net = "tcp"
-
- }
-
- // Set default address if empty
-
- if cfg.Addr == "" {
-
- switch cfg.Net {
-
- case "tcp":
-
- cfg.Addr = "127.0.0.1:3306"
-
- case "unix":
-
- cfg.Addr = "/tmp/mysql.sock"
-
- default:
-
- return errors.New("default addr for network '" + cfg.Net + "' unknown")
-
- }
-
- } else if cfg.Net == "tcp" {
-
- cfg.Addr = ensureHavePort(cfg.Addr)
-
- }
-
- switch cfg.TLSConfig {
-
- case "false", "":
-
- // don't set anything
-
- case "true":
-
- cfg.tls = &tls.Config{}
-
- case "skip-verify", "preferred":
-
- cfg.tls = &tls.Config{InsecureSkipVerify: true}
-
- default:
-
- cfg.tls = getTLSConfigClone(cfg.TLSConfig)
-
- if cfg.tls == nil {
-
- return errors.New("invalid value / unknown config name: " + cfg.TLSConfig)
-
- }
-
- }
-
- if cfg.tls != nil && cfg.tls.ServerName == "" && !cfg.tls.InsecureSkipVerify {
-
- host, _, err := net.SplitHostPort(cfg.Addr)
-
- if err == nil {
-
- cfg.tls.ServerName = host
-
- }
-
- }
-
- if cfg.ServerPubKey != "" {
-
- cfg.pubKey = getServerPubKey(cfg.ServerPubKey)
-
- if cfg.pubKey == nil {
-
- return errors.New("invalid value / unknown server pub key name: " + cfg.ServerPubKey)
-
- }
-
- }
-
- return nil
-
-}
-
-func writeDSNParam(buf *bytes.Buffer, hasParam *bool, name, value string) {
-
- buf.Grow(1 + len(name) + 1 + len(value))
-
- if !*hasParam {
-
- *hasParam = true
-
- buf.WriteByte('?')
-
- } else {
-
- buf.WriteByte('&')
-
- }
-
- buf.WriteString(name)
-
- buf.WriteByte('=')
-
- buf.WriteString(value)
-
-}
-
-// FormatDSN formats the given Config into a DSN string which can be passed to
-
-// the driver.
-
-func (cfg *Config) FormatDSN() string {
-
- var buf bytes.Buffer
-
- // [username[:password]@]
-
- if len(cfg.User) > 0 {
-
- buf.WriteString(cfg.User)
-
- if len(cfg.Passwd) > 0 {
-
- buf.WriteByte(':')
-
- buf.WriteString(cfg.Passwd)
-
- }
-
- buf.WriteByte('@')
-
- }
-
- // [protocol[(address)]]
-
- if len(cfg.Net) > 0 {
-
- buf.WriteString(cfg.Net)
-
- if len(cfg.Addr) > 0 {
-
- buf.WriteByte('(')
-
- buf.WriteString(cfg.Addr)
-
- buf.WriteByte(')')
-
- }
-
- }
-
- // /dbname
-
- buf.WriteByte('/')
-
- buf.WriteString(cfg.DBName)
-
- // [?param1=value1&...¶mN=valueN]
-
- hasParam := false
-
- if cfg.AllowAllFiles {
-
- hasParam = true
-
- buf.WriteString("?allowAllFiles=true")
-
- }
-
- if cfg.AllowCleartextPasswords {
-
- writeDSNParam(&buf, &hasParam, "allowCleartextPasswords", "true")
-
- }
-
- if !cfg.AllowNativePasswords {
-
- writeDSNParam(&buf, &hasParam, "allowNativePasswords", "false")
-
- }
-
- if cfg.AllowOldPasswords {
-
- writeDSNParam(&buf, &hasParam, "allowOldPasswords", "true")
-
- }
-
- if !cfg.CheckConnLiveness {
-
- writeDSNParam(&buf, &hasParam, "checkConnLiveness", "false")
-
- }
-
- if cfg.ClientFoundRows {
-
- writeDSNParam(&buf, &hasParam, "clientFoundRows", "true")
-
- }
-
- if col := cfg.Collation; col != defaultCollation && len(col) > 0 {
-
- writeDSNParam(&buf, &hasParam, "collation", col)
-
- }
-
- if cfg.ColumnsWithAlias {
-
- writeDSNParam(&buf, &hasParam, "columnsWithAlias", "true")
-
- }
-
- if cfg.InterpolateParams {
-
- writeDSNParam(&buf, &hasParam, "interpolateParams", "true")
-
- }
-
- if cfg.Loc != time.UTC && cfg.Loc != nil {
-
- writeDSNParam(&buf, &hasParam, "loc", url.QueryEscape(cfg.Loc.String()))
-
- }
-
- if cfg.MultiStatements {
-
- writeDSNParam(&buf, &hasParam, "multiStatements", "true")
-
- }
-
- if cfg.ParseTime {
-
- writeDSNParam(&buf, &hasParam, "parseTime", "true")
-
- }
-
- if cfg.ReadTimeout > 0 {
-
- writeDSNParam(&buf, &hasParam, "readTimeout", cfg.ReadTimeout.String())
-
- }
-
- if cfg.RejectReadOnly {
-
- writeDSNParam(&buf, &hasParam, "rejectReadOnly", "true")
-
- }
-
- if len(cfg.ServerPubKey) > 0 {
-
- writeDSNParam(&buf, &hasParam, "serverPubKey", url.QueryEscape(cfg.ServerPubKey))
-
- }
-
- if cfg.Timeout > 0 {
-
- writeDSNParam(&buf, &hasParam, "timeout", cfg.Timeout.String())
-
- }
-
- if len(cfg.TLSConfig) > 0 {
-
- writeDSNParam(&buf, &hasParam, "tls", url.QueryEscape(cfg.TLSConfig))
-
- }
-
- if cfg.WriteTimeout > 0 {
-
- writeDSNParam(&buf, &hasParam, "writeTimeout", cfg.WriteTimeout.String())
-
- }
-
- if cfg.MaxAllowedPacket != defaultMaxAllowedPacket {
-
- writeDSNParam(&buf, &hasParam, "maxAllowedPacket", strconv.Itoa(cfg.MaxAllowedPacket))
-
- }
-
- // other params
-
- if cfg.Params != nil {
-
- var params []string
-
- for param := range cfg.Params {
-
- params = append(params, param)
-
- }
-
- sort.Strings(params)
-
- for _, param := range params {
-
- writeDSNParam(&buf, &hasParam, param, url.QueryEscape(cfg.Params[param]))
-
- }
-
- }
-
- return buf.String()
-
-}
-
-// ParseDSN parses the DSN string to a Config
-
-func ParseDSN(dsn string) (cfg *Config, err error) {
-
- // New config with some default values
-
- cfg = NewConfig()
-
- // [user[:password]@][net[(addr)]]/dbname[?param1=value1¶mN=valueN]
-
- // Find the last '/' (since the password or the net addr might contain a '/')
-
- foundSlash := false
-
- for i := len(dsn) - 1; i >= 0; i-- {
-
- if dsn[i] == '/' {
-
- foundSlash = true
-
- var j, k int
-
- // left part is empty if i <= 0
-
- if i > 0 {
-
- // [username[:password]@][protocol[(address)]]
-
- // Find the last '@' in dsn[:i]
-
- for j = i; j >= 0; j-- {
-
- if dsn[j] == '@' {
-
- // username[:password]
-
- // Find the first ':' in dsn[:j]
-
- for k = 0; k < j; k++ {
-
- if dsn[k] == ':' {
-
- cfg.Passwd = dsn[k+1 : j]
-
- break
-
- }
-
- }
-
- cfg.User = dsn[:k]
-
- break
-
- }
-
- }
-
- // [protocol[(address)]]
-
- // Find the first '(' in dsn[j+1:i]
-
- for k = j + 1; k < i; k++ {
-
- if dsn[k] == '(' {
-
- // dsn[i-1] must be == ')' if an address is specified
-
- if dsn[i-1] != ')' {
-
- if strings.ContainsRune(dsn[k+1:i], ')') {
-
- return nil, errInvalidDSNUnescaped
-
- }
-
- return nil, errInvalidDSNAddr
-
- }
-
- cfg.Addr = dsn[k+1 : i-1]
-
- break
-
- }
-
- }
-
- cfg.Net = dsn[j+1 : k]
-
- }
-
- // dbname[?param1=value1&...¶mN=valueN]
-
- // Find the first '?' in dsn[i+1:]
-
- for j = i + 1; j < len(dsn); j++ {
-
- if dsn[j] == '?' {
-
- if err = parseDSNParams(cfg, dsn[j+1:]); err != nil {
-
- return
-
- }
-
- break
-
- }
-
- }
-
- cfg.DBName = dsn[i+1 : j]
-
- break
-
- }
-
- }
-
- if !foundSlash && len(dsn) > 0 {
-
- return nil, errInvalidDSNNoSlash
-
- }
-
- if err = cfg.normalize(); err != nil {
-
- return nil, err
-
- }
-
- return
-
-}
-
-// parseDSNParams parses the DSN "query string"
-
-// Values must be url.QueryEscape'ed
-
-func parseDSNParams(cfg *Config, params string) (err error) {
-
- for _, v := range strings.Split(params, "&") {
-
- param := strings.SplitN(v, "=", 2)
-
- if len(param) != 2 {
-
- continue
-
- }
-
- // cfg params
-
- switch value := param[1]; param[0] {
-
- // Disable INFILE allowlist / enable all files
-
- case "allowAllFiles":
-
- var isBool bool
-
- cfg.AllowAllFiles, isBool = readBool(value)
-
- if !isBool {
-
- return errors.New("invalid bool value: " + value)
-
- }
-
- // Use cleartext authentication mode (MySQL 5.5.10+)
-
- case "allowCleartextPasswords":
-
- var isBool bool
-
- cfg.AllowCleartextPasswords, isBool = readBool(value)
-
- if !isBool {
-
- return errors.New("invalid bool value: " + value)
-
- }
-
- // Use native password authentication
-
- case "allowNativePasswords":
-
- var isBool bool
-
- cfg.AllowNativePasswords, isBool = readBool(value)
-
- if !isBool {
-
- return errors.New("invalid bool value: " + value)
-
- }
-
- // Use old authentication mode (pre MySQL 4.1)
-
- case "allowOldPasswords":
-
- var isBool bool
-
- cfg.AllowOldPasswords, isBool = readBool(value)
-
- if !isBool {
-
- return errors.New("invalid bool value: " + value)
-
- }
-
- // Check connections for Liveness before using them
-
- case "checkConnLiveness":
-
- var isBool bool
-
- cfg.CheckConnLiveness, isBool = readBool(value)
-
- if !isBool {
-
- return errors.New("invalid bool value: " + value)
-
- }
-
- // Switch "rowsAffected" mode
-
- case "clientFoundRows":
-
- var isBool bool
-
- cfg.ClientFoundRows, isBool = readBool(value)
-
- if !isBool {
-
- return errors.New("invalid bool value: " + value)
-
- }
-
- // Collation
-
- case "collation":
-
- cfg.Collation = value
-
- break
-
- case "columnsWithAlias":
-
- var isBool bool
-
- cfg.ColumnsWithAlias, isBool = readBool(value)
-
- if !isBool {
-
- return errors.New("invalid bool value: " + value)
-
- }
-
- // Compression
-
- case "compress":
-
- return errors.New("compression not implemented yet")
-
- // Enable client side placeholder substitution
-
- case "interpolateParams":
-
- var isBool bool
-
- cfg.InterpolateParams, isBool = readBool(value)
-
- if !isBool {
-
- return errors.New("invalid bool value: " + value)
-
- }
-
- // Time Location
-
- case "loc":
-
- if value, err = url.QueryUnescape(value); err != nil {
-
- return
-
- }
-
- cfg.Loc, err = time.LoadLocation(value)
-
- if err != nil {
-
- return
-
- }
-
- // multiple statements in one query
-
- case "multiStatements":
-
- var isBool bool
-
- cfg.MultiStatements, isBool = readBool(value)
-
- if !isBool {
-
- return errors.New("invalid bool value: " + value)
-
- }
-
- // time.Time parsing
-
- case "parseTime":
-
- var isBool bool
-
- cfg.ParseTime, isBool = readBool(value)
-
- if !isBool {
-
- return errors.New("invalid bool value: " + value)
-
- }
-
- // I/O read Timeout
-
- case "readTimeout":
-
- cfg.ReadTimeout, err = time.ParseDuration(value)
-
- if err != nil {
-
- return
-
- }
-
- // Reject read-only connections
-
- case "rejectReadOnly":
-
- var isBool bool
-
- cfg.RejectReadOnly, isBool = readBool(value)
-
- if !isBool {
-
- return errors.New("invalid bool value: " + value)
-
- }
-
- // Server public key
-
- case "serverPubKey":
-
- name, err := url.QueryUnescape(value)
-
- if err != nil {
-
- return fmt.Errorf("invalid value for server pub key name: %v", err)
-
- }
-
- cfg.ServerPubKey = name
-
- // Strict mode
-
- case "strict":
-
- panic("strict mode has been removed. See https://github.com/go-sql-driver/mysql/wiki/strict-mode")
-
- // Dial Timeout
-
- case "timeout":
-
- cfg.Timeout, err = time.ParseDuration(value)
-
- if err != nil {
-
- return
-
- }
-
- // TLS-Encryption
-
- case "tls":
-
- boolValue, isBool := readBool(value)
-
- if isBool {
-
- if boolValue {
-
- cfg.TLSConfig = "true"
-
- } else {
-
- cfg.TLSConfig = "false"
-
- }
-
- } else if vl := strings.ToLower(value); vl == "skip-verify" || vl == "preferred" {
-
- cfg.TLSConfig = vl
-
- } else {
-
- name, err := url.QueryUnescape(value)
-
- if err != nil {
-
- return fmt.Errorf("invalid value for TLS config name: %v", err)
-
- }
-
- cfg.TLSConfig = name
-
- }
-
- // I/O write Timeout
-
- case "writeTimeout":
-
- cfg.WriteTimeout, err = time.ParseDuration(value)
-
- if err != nil {
-
- return
-
- }
-
- case "maxAllowedPacket":
-
- cfg.MaxAllowedPacket, err = strconv.Atoi(value)
-
- if err != nil {
-
- return
-
- }
-
- default:
-
- // lazy init
-
- if cfg.Params == nil {
-
- cfg.Params = make(map[string]string)
-
- }
-
- if cfg.Params[param[0]], err = url.QueryUnescape(value); err != nil {
-
- return
-
- }
-
- }
-
- }
-
- return
-
-}
-
-func ensureHavePort(addr string) string {
-
- if _, _, err := net.SplitHostPort(addr); err != nil {
-
- return net.JoinHostPort(addr, "3306")
-
- }
-
- return addr
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/errors.go b/vendor/github.com/go-sql-driver/mysql/errors.go
deleted file mode 100644
index b2b7ebc..0000000
--- a/vendor/github.com/go-sql-driver/mysql/errors.go
+++ /dev/null
@@ -1,100 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-
-//
-
-// Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-import (
- "errors"
- "fmt"
- "log"
- "os"
-)
-
-// Various errors the driver might return. Can change between driver versions.
-
-var (
- ErrInvalidConn = errors.New("invalid connection")
-
- ErrMalformPkt = errors.New("malformed packet")
-
- ErrNoTLS = errors.New("TLS requested but server does not support TLS")
-
- ErrCleartextPassword = errors.New("this user requires clear text authentication. If you still want to use it, please add 'allowCleartextPasswords=1' to your DSN")
-
- ErrNativePassword = errors.New("this user requires mysql native password authentication.")
-
- ErrOldPassword = errors.New("this user requires old password authentication. If you still want to use it, please add 'allowOldPasswords=1' to your DSN. See also https://github.com/go-sql-driver/mysql/wiki/old_passwords")
-
- ErrUnknownPlugin = errors.New("this authentication plugin is not supported")
-
- ErrOldProtocol = errors.New("MySQL server does not support required protocol 41+")
-
- ErrPktSync = errors.New("commands out of sync. You can't run this command now")
-
- ErrPktSyncMul = errors.New("commands out of sync. Did you run multiple statements at once?")
-
- ErrPktTooLarge = errors.New("packet for query is too large. Try adjusting the 'max_allowed_packet' variable on the server")
-
- ErrBusyBuffer = errors.New("busy buffer")
-
- // errBadConnNoWrite is used for connection errors where nothing was sent to the database yet.
-
- // If this happens first in a function starting a database interaction, it should be replaced by driver.ErrBadConn
-
- // to trigger a resend.
-
- // See https://github.com/go-sql-driver/mysql/pull/302
-
- errBadConnNoWrite = errors.New("bad connection")
-)
-
-var errLog = Logger(log.New(os.Stderr, "[mysql] ", log.Ldate|log.Ltime|log.Lshortfile))
-
-// Logger is used to log critical error messages.
-
-type Logger interface {
- Print(v ...interface{})
-}
-
-// SetLogger is used to set the logger for critical errors.
-
-// The initial logger is os.Stderr.
-
-func SetLogger(logger Logger) error {
-
- if logger == nil {
-
- return errors.New("logger is nil")
-
- }
-
- errLog = logger
-
- return nil
-
-}
-
-// MySQLError is an error type which represents a single MySQL error
-
-type MySQLError struct {
- Number uint16
-
- Message string
-}
-
-func (me *MySQLError) Error() string {
-
- return fmt.Sprintf("Error %d: %s", me.Number, me.Message)
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/fields.go b/vendor/github.com/go-sql-driver/mysql/fields.go
deleted file mode 100644
index 38610a3..0000000
--- a/vendor/github.com/go-sql-driver/mysql/fields.go
+++ /dev/null
@@ -1,352 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-
-//
-
-// Copyright 2017 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-import (
- "database/sql"
- "reflect"
-)
-
-func (mf *mysqlField) typeDatabaseName() string {
-
- switch mf.fieldType {
-
- case fieldTypeBit:
-
- return "BIT"
-
- case fieldTypeBLOB:
-
- if mf.charSet != collations[binaryCollation] {
-
- return "TEXT"
-
- }
-
- return "BLOB"
-
- case fieldTypeDate:
-
- return "DATE"
-
- case fieldTypeDateTime:
-
- return "DATETIME"
-
- case fieldTypeDecimal:
-
- return "DECIMAL"
-
- case fieldTypeDouble:
-
- return "DOUBLE"
-
- case fieldTypeEnum:
-
- return "ENUM"
-
- case fieldTypeFloat:
-
- return "FLOAT"
-
- case fieldTypeGeometry:
-
- return "GEOMETRY"
-
- case fieldTypeInt24:
-
- return "MEDIUMINT"
-
- case fieldTypeJSON:
-
- return "JSON"
-
- case fieldTypeLong:
-
- return "INT"
-
- case fieldTypeLongBLOB:
-
- if mf.charSet != collations[binaryCollation] {
-
- return "LONGTEXT"
-
- }
-
- return "LONGBLOB"
-
- case fieldTypeLongLong:
-
- return "BIGINT"
-
- case fieldTypeMediumBLOB:
-
- if mf.charSet != collations[binaryCollation] {
-
- return "MEDIUMTEXT"
-
- }
-
- return "MEDIUMBLOB"
-
- case fieldTypeNewDate:
-
- return "DATE"
-
- case fieldTypeNewDecimal:
-
- return "DECIMAL"
-
- case fieldTypeNULL:
-
- return "NULL"
-
- case fieldTypeSet:
-
- return "SET"
-
- case fieldTypeShort:
-
- return "SMALLINT"
-
- case fieldTypeString:
-
- if mf.charSet == collations[binaryCollation] {
-
- return "BINARY"
-
- }
-
- return "CHAR"
-
- case fieldTypeTime:
-
- return "TIME"
-
- case fieldTypeTimestamp:
-
- return "TIMESTAMP"
-
- case fieldTypeTiny:
-
- return "TINYINT"
-
- case fieldTypeTinyBLOB:
-
- if mf.charSet != collations[binaryCollation] {
-
- return "TINYTEXT"
-
- }
-
- return "TINYBLOB"
-
- case fieldTypeVarChar:
-
- if mf.charSet == collations[binaryCollation] {
-
- return "VARBINARY"
-
- }
-
- return "VARCHAR"
-
- case fieldTypeVarString:
-
- if mf.charSet == collations[binaryCollation] {
-
- return "VARBINARY"
-
- }
-
- return "VARCHAR"
-
- case fieldTypeYear:
-
- return "YEAR"
-
- default:
-
- return ""
-
- }
-
-}
-
-var (
- scanTypeFloat32 = reflect.TypeOf(float32(0))
-
- scanTypeFloat64 = reflect.TypeOf(float64(0))
-
- scanTypeInt8 = reflect.TypeOf(int8(0))
-
- scanTypeInt16 = reflect.TypeOf(int16(0))
-
- scanTypeInt32 = reflect.TypeOf(int32(0))
-
- scanTypeInt64 = reflect.TypeOf(int64(0))
-
- scanTypeNullFloat = reflect.TypeOf(sql.NullFloat64{})
-
- scanTypeNullInt = reflect.TypeOf(sql.NullInt64{})
-
- scanTypeNullTime = reflect.TypeOf(nullTime{})
-
- scanTypeUint8 = reflect.TypeOf(uint8(0))
-
- scanTypeUint16 = reflect.TypeOf(uint16(0))
-
- scanTypeUint32 = reflect.TypeOf(uint32(0))
-
- scanTypeUint64 = reflect.TypeOf(uint64(0))
-
- scanTypeRawBytes = reflect.TypeOf(sql.RawBytes{})
-
- scanTypeUnknown = reflect.TypeOf(new(interface{}))
-)
-
-type mysqlField struct {
- tableName string
-
- name string
-
- length uint32
-
- flags fieldFlag
-
- fieldType fieldType
-
- decimals byte
-
- charSet uint8
-}
-
-func (mf *mysqlField) scanType() reflect.Type {
-
- switch mf.fieldType {
-
- case fieldTypeTiny:
-
- if mf.flags&flagNotNULL != 0 {
-
- if mf.flags&flagUnsigned != 0 {
-
- return scanTypeUint8
-
- }
-
- return scanTypeInt8
-
- }
-
- return scanTypeNullInt
-
- case fieldTypeShort, fieldTypeYear:
-
- if mf.flags&flagNotNULL != 0 {
-
- if mf.flags&flagUnsigned != 0 {
-
- return scanTypeUint16
-
- }
-
- return scanTypeInt16
-
- }
-
- return scanTypeNullInt
-
- case fieldTypeInt24, fieldTypeLong:
-
- if mf.flags&flagNotNULL != 0 {
-
- if mf.flags&flagUnsigned != 0 {
-
- return scanTypeUint32
-
- }
-
- return scanTypeInt32
-
- }
-
- return scanTypeNullInt
-
- case fieldTypeLongLong:
-
- if mf.flags&flagNotNULL != 0 {
-
- if mf.flags&flagUnsigned != 0 {
-
- return scanTypeUint64
-
- }
-
- return scanTypeInt64
-
- }
-
- return scanTypeNullInt
-
- case fieldTypeFloat:
-
- if mf.flags&flagNotNULL != 0 {
-
- return scanTypeFloat32
-
- }
-
- return scanTypeNullFloat
-
- case fieldTypeDouble:
-
- if mf.flags&flagNotNULL != 0 {
-
- return scanTypeFloat64
-
- }
-
- return scanTypeNullFloat
-
- case fieldTypeDecimal, fieldTypeNewDecimal, fieldTypeVarChar,
-
- fieldTypeBit, fieldTypeEnum, fieldTypeSet, fieldTypeTinyBLOB,
-
- fieldTypeMediumBLOB, fieldTypeLongBLOB, fieldTypeBLOB,
-
- fieldTypeVarString, fieldTypeString, fieldTypeGeometry, fieldTypeJSON,
-
- fieldTypeTime:
-
- return scanTypeRawBytes
-
- case fieldTypeDate, fieldTypeNewDate,
-
- fieldTypeTimestamp, fieldTypeDateTime:
-
- // NullTime is always returned for more consistent behavior as it can
-
- // handle both cases of parseTime regardless if the field is nullable.
-
- return scanTypeNullTime
-
- default:
-
- return scanTypeUnknown
-
- }
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/fuzz.go b/vendor/github.com/go-sql-driver/mysql/fuzz.go
deleted file mode 100644
index fa75adf..0000000
--- a/vendor/github.com/go-sql-driver/mysql/fuzz.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package.
-//
-// Copyright 2020 The Go-MySQL-Driver Authors. All rights reserved.
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-// +build gofuzz
-
-package mysql
-
-import (
- "database/sql"
-)
-
-func Fuzz(data []byte) int {
- db, err := sql.Open("mysql", string(data))
- if err != nil {
- return 0
- }
- db.Close()
- return 1
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/infile.go b/vendor/github.com/go-sql-driver/mysql/infile.go
deleted file mode 100644
index 56f95fb..0000000
--- a/vendor/github.com/go-sql-driver/mysql/infile.go
+++ /dev/null
@@ -1,311 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-
-//
-
-// Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-import (
- "fmt"
- "io"
- "os"
- "strings"
- "sync"
-)
-
-var (
- fileRegister map[string]bool
-
- fileRegisterLock sync.RWMutex
-
- readerRegister map[string]func() io.Reader
-
- readerRegisterLock sync.RWMutex
-)
-
-// RegisterLocalFile adds the given file to the file allowlist,
-
-// so that it can be used by "LOAD DATA LOCAL INFILE ".
-
-// Alternatively you can allow the use of all local files with
-
-// the DSN parameter 'allowAllFiles=true'
-
-//
-
-// filePath := "/home/gopher/data.csv"
-
-// mysql.RegisterLocalFile(filePath)
-
-// err := db.Exec("LOAD DATA LOCAL INFILE '" + filePath + "' INTO TABLE foo")
-
-// if err != nil {
-
-// ...
-
-func RegisterLocalFile(filePath string) {
-
- fileRegisterLock.Lock()
-
- // lazy map init
-
- if fileRegister == nil {
-
- fileRegister = make(map[string]bool)
-
- }
-
- fileRegister[strings.Trim(filePath, `"`)] = true
-
- fileRegisterLock.Unlock()
-
-}
-
-// DeregisterLocalFile removes the given filepath from the allowlist.
-
-func DeregisterLocalFile(filePath string) {
-
- fileRegisterLock.Lock()
-
- delete(fileRegister, strings.Trim(filePath, `"`))
-
- fileRegisterLock.Unlock()
-
-}
-
-// RegisterReaderHandler registers a handler function which is used
-
-// to receive a io.Reader.
-
-// The Reader can be used by "LOAD DATA LOCAL INFILE Reader::".
-
-// If the handler returns a io.ReadCloser Close() is called when the
-
-// request is finished.
-
-//
-
-// mysql.RegisterReaderHandler("data", func() io.Reader {
-
-// var csvReader io.Reader // Some Reader that returns CSV data
-
-// ... // Open Reader here
-
-// return csvReader
-
-// })
-
-// err := db.Exec("LOAD DATA LOCAL INFILE 'Reader::data' INTO TABLE foo")
-
-// if err != nil {
-
-// ...
-
-func RegisterReaderHandler(name string, handler func() io.Reader) {
-
- readerRegisterLock.Lock()
-
- // lazy map init
-
- if readerRegister == nil {
-
- readerRegister = make(map[string]func() io.Reader)
-
- }
-
- readerRegister[name] = handler
-
- readerRegisterLock.Unlock()
-
-}
-
-// DeregisterReaderHandler removes the ReaderHandler function with
-
-// the given name from the registry.
-
-func DeregisterReaderHandler(name string) {
-
- readerRegisterLock.Lock()
-
- delete(readerRegister, name)
-
- readerRegisterLock.Unlock()
-
-}
-
-func deferredClose(err *error, closer io.Closer) {
-
- closeErr := closer.Close()
-
- if *err == nil {
-
- *err = closeErr
-
- }
-
-}
-
-func (mc *mysqlConn) handleInFileRequest(name string) (err error) {
-
- var rdr io.Reader
-
- var data []byte
-
- packetSize := 16 * 1024 // 16KB is small enough for disk readahead and large enough for TCP
-
- if mc.maxWriteSize < packetSize {
-
- packetSize = mc.maxWriteSize
-
- }
-
- if idx := strings.Index(name, "Reader::"); idx == 0 || (idx > 0 && name[idx-1] == '/') { // io.Reader
-
- // The server might return an an absolute path. See issue #355.
-
- name = name[idx+8:]
-
- readerRegisterLock.RLock()
-
- handler, inMap := readerRegister[name]
-
- readerRegisterLock.RUnlock()
-
- if inMap {
-
- rdr = handler()
-
- if rdr != nil {
-
- if cl, ok := rdr.(io.Closer); ok {
-
- defer deferredClose(&err, cl)
-
- }
-
- } else {
-
- err = fmt.Errorf("Reader '%s' is ", name)
-
- }
-
- } else {
-
- err = fmt.Errorf("Reader '%s' is not registered", name)
-
- }
-
- } else { // File
-
- name = strings.Trim(name, `"`)
-
- fileRegisterLock.RLock()
-
- fr := fileRegister[name]
-
- fileRegisterLock.RUnlock()
-
- if mc.cfg.AllowAllFiles || fr {
-
- var file *os.File
-
- var fi os.FileInfo
-
- if file, err = os.Open(name); err == nil {
-
- defer deferredClose(&err, file)
-
- // get file size
-
- if fi, err = file.Stat(); err == nil {
-
- rdr = file
-
- if fileSize := int(fi.Size()); fileSize < packetSize {
-
- packetSize = fileSize
-
- }
-
- }
-
- }
-
- } else {
-
- err = fmt.Errorf("local file '%s' is not registered", name)
-
- }
-
- }
-
- // send content packets
-
- // if packetSize == 0, the Reader contains no data
-
- if err == nil && packetSize > 0 {
-
- data := make([]byte, 4+packetSize)
-
- var n int
-
- for err == nil {
-
- n, err = rdr.Read(data[4:])
-
- if n > 0 {
-
- if ioErr := mc.writePacket(data[:4+n]); ioErr != nil {
-
- return ioErr
-
- }
-
- }
-
- }
-
- if err == io.EOF {
-
- err = nil
-
- }
-
- }
-
- // send empty packet (termination)
-
- if data == nil {
-
- data = make([]byte, 4)
-
- }
-
- if ioErr := mc.writePacket(data[:4]); ioErr != nil {
-
- return ioErr
-
- }
-
- // read OK packet
-
- if err == nil {
-
- return mc.readResultOK()
-
- }
-
- mc.readPacket()
-
- return err
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/nulltime.go b/vendor/github.com/go-sql-driver/mysql/nulltime.go
deleted file mode 100644
index ced862b..0000000
--- a/vendor/github.com/go-sql-driver/mysql/nulltime.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-
-//
-
-// Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-import (
- "database/sql/driver"
- "fmt"
- "time"
-)
-
-// Scan implements the Scanner interface.
-
-// The value type must be time.Time or string / []byte (formatted time-string),
-
-// otherwise Scan fails.
-
-func (nt *NullTime) Scan(value interface{}) (err error) {
-
- if value == nil {
-
- nt.Time, nt.Valid = time.Time{}, false
-
- return
-
- }
-
- switch v := value.(type) {
-
- case time.Time:
-
- nt.Time, nt.Valid = v, true
-
- return
-
- case []byte:
-
- nt.Time, err = parseDateTime(v, time.UTC)
-
- nt.Valid = (err == nil)
-
- return
-
- case string:
-
- nt.Time, err = parseDateTime([]byte(v), time.UTC)
-
- nt.Valid = (err == nil)
-
- return
-
- }
-
- nt.Valid = false
-
- return fmt.Errorf("Can't convert %T to time.Time", value)
-
-}
-
-// Value implements the driver Valuer interface.
-
-func (nt NullTime) Value() (driver.Value, error) {
-
- if !nt.Valid {
-
- return nil, nil
-
- }
-
- return nt.Time, nil
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/nulltime_go113.go b/vendor/github.com/go-sql-driver/mysql/nulltime_go113.go
deleted file mode 100644
index 453b4b3..0000000
--- a/vendor/github.com/go-sql-driver/mysql/nulltime_go113.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-//
-// Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved.
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-// +build go1.13
-
-package mysql
-
-import (
- "database/sql"
-)
-
-// NullTime represents a time.Time that may be NULL.
-// NullTime implements the Scanner interface so
-// it can be used as a scan destination:
-//
-// var nt NullTime
-// err := db.QueryRow("SELECT time FROM foo WHERE id=?", id).Scan(&nt)
-// ...
-// if nt.Valid {
-// // use nt.Time
-// } else {
-// // NULL value
-// }
-//
-// This NullTime implementation is not driver-specific
-//
-// Deprecated: NullTime doesn't honor the loc DSN parameter.
-// NullTime.Scan interprets a time as UTC, not the loc DSN parameter.
-// Use sql.NullTime instead.
-type NullTime sql.NullTime
-
-// for internal use.
-// the mysql package uses sql.NullTime if it is available.
-// if not, the package uses mysql.NullTime.
-type nullTime = sql.NullTime // sql.NullTime is available
diff --git a/vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go b/vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go
deleted file mode 100644
index 9f7ae27..0000000
--- a/vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-//
-// Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved.
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-// +build !go1.13
-
-package mysql
-
-import (
- "time"
-)
-
-// NullTime represents a time.Time that may be NULL.
-// NullTime implements the Scanner interface so
-// it can be used as a scan destination:
-//
-// var nt NullTime
-// err := db.QueryRow("SELECT time FROM foo WHERE id=?", id).Scan(&nt)
-// ...
-// if nt.Valid {
-// // use nt.Time
-// } else {
-// // NULL value
-// }
-//
-// This NullTime implementation is not driver-specific
-type NullTime struct {
- Time time.Time
- Valid bool // Valid is true if Time is not NULL
-}
-
-// for internal use.
-// the mysql package uses sql.NullTime if it is available.
-// if not, the package uses mysql.NullTime.
-type nullTime = NullTime // sql.NullTime is not available
diff --git a/vendor/github.com/go-sql-driver/mysql/packets.go b/vendor/github.com/go-sql-driver/mysql/packets.go
deleted file mode 100644
index ca071d7..0000000
--- a/vendor/github.com/go-sql-driver/mysql/packets.go
+++ /dev/null
@@ -1,2271 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-
-//
-
-// Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-import (
- "bytes"
- "crypto/tls"
- "database/sql/driver"
- "encoding/binary"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "math"
- "time"
-)
-
-// Packets documentation:
-
-// http://dev.mysql.com/doc/internals/en/client-server-protocol.html
-
-// Read packet to buffer 'data'
-
-func (mc *mysqlConn) readPacket() ([]byte, error) {
-
- var prevData []byte
-
- for {
-
- // read packet header
-
- data, err := mc.buf.readNext(4)
-
- if err != nil {
-
- if cerr := mc.canceled.Value(); cerr != nil {
-
- return nil, cerr
-
- }
-
- errLog.Print(err)
-
- mc.Close()
-
- return nil, ErrInvalidConn
-
- }
-
- // packet length [24 bit]
-
- pktLen := int(uint32(data[0]) | uint32(data[1])<<8 | uint32(data[2])<<16)
-
- // check packet sync [8 bit]
-
- if data[3] != mc.sequence {
-
- if data[3] > mc.sequence {
-
- return nil, ErrPktSyncMul
-
- }
-
- return nil, ErrPktSync
-
- }
-
- mc.sequence++
-
- // packets with length 0 terminate a previous packet which is a
-
- // multiple of (2^24)-1 bytes long
-
- if pktLen == 0 {
-
- // there was no previous packet
-
- if prevData == nil {
-
- errLog.Print(ErrMalformPkt)
-
- mc.Close()
-
- return nil, ErrInvalidConn
-
- }
-
- return prevData, nil
-
- }
-
- // read packet body [pktLen bytes]
-
- data, err = mc.buf.readNext(pktLen)
-
- if err != nil {
-
- if cerr := mc.canceled.Value(); cerr != nil {
-
- return nil, cerr
-
- }
-
- errLog.Print(err)
-
- mc.Close()
-
- return nil, ErrInvalidConn
-
- }
-
- // return data if this was the last packet
-
- if pktLen < maxPacketSize {
-
- // zero allocations for non-split packets
-
- if prevData == nil {
-
- return data, nil
-
- }
-
- return append(prevData, data...), nil
-
- }
-
- prevData = append(prevData, data...)
-
- }
-
-}
-
-// Write packet buffer 'data'
-
-func (mc *mysqlConn) writePacket(data []byte) error {
-
- pktLen := len(data) - 4
-
- if pktLen > mc.maxAllowedPacket {
-
- return ErrPktTooLarge
-
- }
-
- // Perform a stale connection check. We only perform this check for
-
- // the first query on a connection that has been checked out of the
-
- // connection pool: a fresh connection from the pool is more likely
-
- // to be stale, and it has not performed any previous writes that
-
- // could cause data corruption, so it's safe to return ErrBadConn
-
- // if the check fails.
-
- if mc.reset {
-
- mc.reset = false
-
- conn := mc.netConn
-
- if mc.rawConn != nil {
-
- conn = mc.rawConn
-
- }
-
- var err error
-
- // If this connection has a ReadTimeout which we've been setting on
-
- // reads, reset it to its default value before we attempt a non-blocking
-
- // read, otherwise the scheduler will just time us out before we can read
-
- if mc.cfg.ReadTimeout != 0 {
-
- err = conn.SetReadDeadline(time.Time{})
-
- }
-
- if err == nil && mc.cfg.CheckConnLiveness {
-
- err = connCheck(conn)
-
- }
-
- if err != nil {
-
- errLog.Print("closing bad idle connection: ", err)
-
- mc.Close()
-
- return driver.ErrBadConn
-
- }
-
- }
-
- for {
-
- var size int
-
- if pktLen >= maxPacketSize {
-
- data[0] = 0xff
-
- data[1] = 0xff
-
- data[2] = 0xff
-
- size = maxPacketSize
-
- } else {
-
- data[0] = byte(pktLen)
-
- data[1] = byte(pktLen >> 8)
-
- data[2] = byte(pktLen >> 16)
-
- size = pktLen
-
- }
-
- data[3] = mc.sequence
-
- // Write packet
-
- if mc.writeTimeout > 0 {
-
- if err := mc.netConn.SetWriteDeadline(time.Now().Add(mc.writeTimeout)); err != nil {
-
- return err
-
- }
-
- }
-
- n, err := mc.netConn.Write(data[:4+size])
-
- if err == nil && n == 4+size {
-
- mc.sequence++
-
- if size != maxPacketSize {
-
- return nil
-
- }
-
- pktLen -= size
-
- data = data[size:]
-
- continue
-
- }
-
- // Handle error
-
- if err == nil { // n != len(data)
-
- mc.cleanup()
-
- errLog.Print(ErrMalformPkt)
-
- } else {
-
- if cerr := mc.canceled.Value(); cerr != nil {
-
- return cerr
-
- }
-
- if n == 0 && pktLen == len(data)-4 {
-
- // only for the first loop iteration when nothing was written yet
-
- return errBadConnNoWrite
-
- }
-
- mc.cleanup()
-
- errLog.Print(err)
-
- }
-
- return ErrInvalidConn
-
- }
-
-}
-
-/******************************************************************************
-
-* Initialization Process *
-
-******************************************************************************/
-
-// Handshake Initialization Packet
-
-// http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::Handshake
-
-func (mc *mysqlConn) readHandshakePacket() (data []byte, plugin string, err error) {
-
- data, err = mc.readPacket()
-
- if err != nil {
-
- // for init we can rewrite this to ErrBadConn for sql.Driver to retry, since
-
- // in connection initialization we don't risk retrying non-idempotent actions.
-
- if err == ErrInvalidConn {
-
- return nil, "", driver.ErrBadConn
-
- }
-
- return
-
- }
-
- if data[0] == iERR {
-
- return nil, "", mc.handleErrorPacket(data)
-
- }
-
- // protocol version [1 byte]
-
- if data[0] < minProtocolVersion {
-
- return nil, "", fmt.Errorf(
-
- "unsupported protocol version %d. Version %d or higher is required",
-
- data[0],
-
- minProtocolVersion,
- )
-
- }
-
- // server version [null terminated string]
-
- // connection id [4 bytes]
-
- pos := 1 + bytes.IndexByte(data[1:], 0x00) + 1 + 4
-
- // first part of the password cipher [8 bytes]
-
- authData := data[pos : pos+8]
-
- // (filler) always 0x00 [1 byte]
-
- pos += 8 + 1
-
- // capability flags (lower 2 bytes) [2 bytes]
-
- mc.flags = clientFlag(binary.LittleEndian.Uint16(data[pos : pos+2]))
-
- if mc.flags&clientProtocol41 == 0 {
-
- return nil, "", ErrOldProtocol
-
- }
-
- if mc.flags&clientSSL == 0 && mc.cfg.tls != nil {
-
- if mc.cfg.TLSConfig == "preferred" {
-
- mc.cfg.tls = nil
-
- } else {
-
- return nil, "", ErrNoTLS
-
- }
-
- }
-
- pos += 2
-
- if len(data) > pos {
-
- // character set [1 byte]
-
- // status flags [2 bytes]
-
- // capability flags (upper 2 bytes) [2 bytes]
-
- // length of auth-plugin-data [1 byte]
-
- // reserved (all [00]) [10 bytes]
-
- pos += 1 + 2 + 2 + 1 + 10
-
- // second part of the password cipher [mininum 13 bytes],
-
- // where len=MAX(13, length of auth-plugin-data - 8)
-
- //
-
- // The web documentation is ambiguous about the length. However,
-
- // according to mysql-5.7/sql/auth/sql_authentication.cc line 538,
-
- // the 13th byte is "\0 byte, terminating the second part of
-
- // a scramble". So the second part of the password cipher is
-
- // a NULL terminated string that's at least 13 bytes with the
-
- // last byte being NULL.
-
- //
-
- // The official Python library uses the fixed length 12
-
- // which seems to work but technically could have a hidden bug.
-
- authData = append(authData, data[pos:pos+12]...)
-
- pos += 13
-
- // EOF if version (>= 5.5.7 and < 5.5.10) or (>= 5.6.0 and < 5.6.2)
-
- // \NUL otherwise
-
- if end := bytes.IndexByte(data[pos:], 0x00); end != -1 {
-
- plugin = string(data[pos : pos+end])
-
- } else {
-
- plugin = string(data[pos:])
-
- }
-
- // make a memory safe copy of the cipher slice
-
- var b [20]byte
-
- copy(b[:], authData)
-
- return b[:], plugin, nil
-
- }
-
- // make a memory safe copy of the cipher slice
-
- var b [8]byte
-
- copy(b[:], authData)
-
- return b[:], plugin, nil
-
-}
-
-// Client Authentication Packet
-
-// http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::HandshakeResponse
-
-func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string) error {
-
- // Adjust client flags based on server support
-
- clientFlags := clientProtocol41 |
-
- clientSecureConn |
-
- clientLongPassword |
-
- clientTransactions |
-
- clientLocalFiles |
-
- clientPluginAuth |
-
- clientMultiResults |
-
- mc.flags&clientLongFlag
-
- if mc.cfg.ClientFoundRows {
-
- clientFlags |= clientFoundRows
-
- }
-
- // To enable TLS / SSL
-
- if mc.cfg.tls != nil {
-
- clientFlags |= clientSSL
-
- }
-
- if mc.cfg.MultiStatements {
-
- clientFlags |= clientMultiStatements
-
- }
-
- // encode length of the auth plugin data
-
- var authRespLEIBuf [9]byte
-
- authRespLen := len(authResp)
-
- authRespLEI := appendLengthEncodedInteger(authRespLEIBuf[:0], uint64(authRespLen))
-
- if len(authRespLEI) > 1 {
-
- // if the length can not be written in 1 byte, it must be written as a
-
- // length encoded integer
-
- clientFlags |= clientPluginAuthLenEncClientData
-
- }
-
- pktLen := 4 + 4 + 1 + 23 + len(mc.cfg.User) + 1 + len(authRespLEI) + len(authResp) + 21 + 1
-
- // To specify a db name
-
- if n := len(mc.cfg.DBName); n > 0 {
-
- clientFlags |= clientConnectWithDB
-
- pktLen += n + 1
-
- }
-
- // Calculate packet length and get buffer with that size
-
- data, err := mc.buf.takeSmallBuffer(pktLen + 4)
-
- if err != nil {
-
- // cannot take the buffer. Something must be wrong with the connection
-
- errLog.Print(err)
-
- return errBadConnNoWrite
-
- }
-
- // ClientFlags [32 bit]
-
- data[4] = byte(clientFlags)
-
- data[5] = byte(clientFlags >> 8)
-
- data[6] = byte(clientFlags >> 16)
-
- data[7] = byte(clientFlags >> 24)
-
- // MaxPacketSize [32 bit] (none)
-
- data[8] = 0x00
-
- data[9] = 0x00
-
- data[10] = 0x00
-
- data[11] = 0x00
-
- // Charset [1 byte]
-
- var found bool
-
- data[12], found = collations[mc.cfg.Collation]
-
- if !found {
-
- // Note possibility for false negatives:
-
- // could be triggered although the collation is valid if the
-
- // collations map does not contain entries the server supports.
-
- return errors.New("unknown collation")
-
- }
-
- // Filler [23 bytes] (all 0x00)
-
- pos := 13
-
- for ; pos < 13+23; pos++ {
-
- data[pos] = 0
-
- }
-
- // SSL Connection Request Packet
-
- // http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::SSLRequest
-
- if mc.cfg.tls != nil {
-
- // Send TLS / SSL request packet
-
- if err := mc.writePacket(data[:(4+4+1+23)+4]); err != nil {
-
- return err
-
- }
-
- // Switch to TLS
-
- tlsConn := tls.Client(mc.netConn, mc.cfg.tls)
-
- if err := tlsConn.Handshake(); err != nil {
-
- return err
-
- }
-
- mc.rawConn = mc.netConn
-
- mc.netConn = tlsConn
-
- mc.buf.nc = tlsConn
-
- }
-
- // User [null terminated string]
-
- if len(mc.cfg.User) > 0 {
-
- pos += copy(data[pos:], mc.cfg.User)
-
- }
-
- data[pos] = 0x00
-
- pos++
-
- // Auth Data [length encoded integer]
-
- pos += copy(data[pos:], authRespLEI)
-
- pos += copy(data[pos:], authResp)
-
- // Databasename [null terminated string]
-
- if len(mc.cfg.DBName) > 0 {
-
- pos += copy(data[pos:], mc.cfg.DBName)
-
- data[pos] = 0x00
-
- pos++
-
- }
-
- pos += copy(data[pos:], plugin)
-
- data[pos] = 0x00
-
- pos++
-
- // Send Auth packet
-
- return mc.writePacket(data[:pos])
-
-}
-
-// http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::AuthSwitchResponse
-
-func (mc *mysqlConn) writeAuthSwitchPacket(authData []byte) error {
-
- pktLen := 4 + len(authData)
-
- data, err := mc.buf.takeSmallBuffer(pktLen)
-
- if err != nil {
-
- // cannot take the buffer. Something must be wrong with the connection
-
- errLog.Print(err)
-
- return errBadConnNoWrite
-
- }
-
- // Add the auth data [EOF]
-
- copy(data[4:], authData)
-
- return mc.writePacket(data)
-
-}
-
-/******************************************************************************
-
-* Command Packets *
-
-******************************************************************************/
-
-func (mc *mysqlConn) writeCommandPacket(command byte) error {
-
- // Reset Packet Sequence
-
- mc.sequence = 0
-
- data, err := mc.buf.takeSmallBuffer(4 + 1)
-
- if err != nil {
-
- // cannot take the buffer. Something must be wrong with the connection
-
- errLog.Print(err)
-
- return errBadConnNoWrite
-
- }
-
- // Add command byte
-
- data[4] = command
-
- // Send CMD packet
-
- return mc.writePacket(data)
-
-}
-
-func (mc *mysqlConn) writeCommandPacketStr(command byte, arg string) error {
-
- // Reset Packet Sequence
-
- mc.sequence = 0
-
- pktLen := 1 + len(arg)
-
- data, err := mc.buf.takeBuffer(pktLen + 4)
-
- if err != nil {
-
- // cannot take the buffer. Something must be wrong with the connection
-
- errLog.Print(err)
-
- return errBadConnNoWrite
-
- }
-
- // Add command byte
-
- data[4] = command
-
- // Add arg
-
- copy(data[5:], arg)
-
- // Send CMD packet
-
- return mc.writePacket(data)
-
-}
-
-func (mc *mysqlConn) writeCommandPacketUint32(command byte, arg uint32) error {
-
- // Reset Packet Sequence
-
- mc.sequence = 0
-
- data, err := mc.buf.takeSmallBuffer(4 + 1 + 4)
-
- if err != nil {
-
- // cannot take the buffer. Something must be wrong with the connection
-
- errLog.Print(err)
-
- return errBadConnNoWrite
-
- }
-
- // Add command byte
-
- data[4] = command
-
- // Add arg [32 bit]
-
- data[5] = byte(arg)
-
- data[6] = byte(arg >> 8)
-
- data[7] = byte(arg >> 16)
-
- data[8] = byte(arg >> 24)
-
- // Send CMD packet
-
- return mc.writePacket(data)
-
-}
-
-/******************************************************************************
-
-* Result Packets *
-
-******************************************************************************/
-
-func (mc *mysqlConn) readAuthResult() ([]byte, string, error) {
-
- data, err := mc.readPacket()
-
- if err != nil {
-
- return nil, "", err
-
- }
-
- // packet indicator
-
- switch data[0] {
-
- case iOK:
-
- return nil, "", mc.handleOkPacket(data)
-
- case iAuthMoreData:
-
- return data[1:], "", err
-
- case iEOF:
-
- if len(data) == 1 {
-
- // https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::OldAuthSwitchRequest
-
- return nil, "mysql_old_password", nil
-
- }
-
- pluginEndIndex := bytes.IndexByte(data, 0x00)
-
- if pluginEndIndex < 0 {
-
- return nil, "", ErrMalformPkt
-
- }
-
- plugin := string(data[1:pluginEndIndex])
-
- authData := data[pluginEndIndex+1:]
-
- return authData, plugin, nil
-
- default: // Error otherwise
-
- return nil, "", mc.handleErrorPacket(data)
-
- }
-
-}
-
-// Returns error if Packet is not an 'Result OK'-Packet
-
-func (mc *mysqlConn) readResultOK() error {
-
- data, err := mc.readPacket()
-
- if err != nil {
-
- return err
-
- }
-
- if data[0] == iOK {
-
- return mc.handleOkPacket(data)
-
- }
-
- return mc.handleErrorPacket(data)
-
-}
-
-// Result Set Header Packet
-
-// http://dev.mysql.com/doc/internals/en/com-query-response.html#packet-ProtocolText::Resultset
-
-func (mc *mysqlConn) readResultSetHeaderPacket() (int, error) {
-
- data, err := mc.readPacket()
-
- if err == nil {
-
- switch data[0] {
-
- case iOK:
-
- return 0, mc.handleOkPacket(data)
-
- case iERR:
-
- return 0, mc.handleErrorPacket(data)
-
- case iLocalInFile:
-
- return 0, mc.handleInFileRequest(string(data[1:]))
-
- }
-
- // column count
-
- num, _, n := readLengthEncodedInteger(data)
-
- if n-len(data) == 0 {
-
- return int(num), nil
-
- }
-
- return 0, ErrMalformPkt
-
- }
-
- return 0, err
-
-}
-
-// Error Packet
-
-// http://dev.mysql.com/doc/internals/en/generic-response-packets.html#packet-ERR_Packet
-
-func (mc *mysqlConn) handleErrorPacket(data []byte) error {
-
- if data[0] != iERR {
-
- return ErrMalformPkt
-
- }
-
- // 0xff [1 byte]
-
- // Error Number [16 bit uint]
-
- errno := binary.LittleEndian.Uint16(data[1:3])
-
- // 1792: ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-
- // 1290: ER_OPTION_PREVENTS_STATEMENT (returned by Aurora during failover)
-
- if (errno == 1792 || errno == 1290) && mc.cfg.RejectReadOnly {
-
- // Oops; we are connected to a read-only connection, and won't be able
-
- // to issue any write statements. Since RejectReadOnly is configured,
-
- // we throw away this connection hoping this one would have write
-
- // permission. This is specifically for a possible race condition
-
- // during failover (e.g. on AWS Aurora). See README.md for more.
-
- //
-
- // We explicitly close the connection before returning
-
- // driver.ErrBadConn to ensure that `database/sql` purges this
-
- // connection and initiates a new one for next statement next time.
-
- mc.Close()
-
- return driver.ErrBadConn
-
- }
-
- pos := 3
-
- // SQL State [optional: # + 5bytes string]
-
- if data[3] == 0x23 {
-
- //sqlstate := string(data[4 : 4+5])
-
- pos = 9
-
- }
-
- // Error Message [string]
-
- return &MySQLError{
-
- Number: errno,
-
- Message: string(data[pos:]),
- }
-
-}
-
-func readStatus(b []byte) statusFlag {
-
- return statusFlag(b[0]) | statusFlag(b[1])<<8
-
-}
-
-// Ok Packet
-
-// http://dev.mysql.com/doc/internals/en/generic-response-packets.html#packet-OK_Packet
-
-func (mc *mysqlConn) handleOkPacket(data []byte) error {
-
- var n, m int
-
- // 0x00 [1 byte]
-
- // Affected rows [Length Coded Binary]
-
- mc.affectedRows, _, n = readLengthEncodedInteger(data[1:])
-
- // Insert id [Length Coded Binary]
-
- mc.insertId, _, m = readLengthEncodedInteger(data[1+n:])
-
- // server_status [2 bytes]
-
- mc.status = readStatus(data[1+n+m : 1+n+m+2])
-
- if mc.status&statusMoreResultsExists != 0 {
-
- return nil
-
- }
-
- // warning count [2 bytes]
-
- return nil
-
-}
-
-// Read Packets as Field Packets until EOF-Packet or an Error appears
-
-// http://dev.mysql.com/doc/internals/en/com-query-response.html#packet-Protocol::ColumnDefinition41
-
-func (mc *mysqlConn) readColumns(count int) ([]mysqlField, error) {
-
- columns := make([]mysqlField, count)
-
- for i := 0; ; i++ {
-
- data, err := mc.readPacket()
-
- if err != nil {
-
- return nil, err
-
- }
-
- // EOF Packet
-
- if data[0] == iEOF && (len(data) == 5 || len(data) == 1) {
-
- if i == count {
-
- return columns, nil
-
- }
-
- return nil, fmt.Errorf("column count mismatch n:%d len:%d", count, len(columns))
-
- }
-
- // Catalog
-
- pos, err := skipLengthEncodedString(data)
-
- if err != nil {
-
- return nil, err
-
- }
-
- // Database [len coded string]
-
- n, err := skipLengthEncodedString(data[pos:])
-
- if err != nil {
-
- return nil, err
-
- }
-
- pos += n
-
- // Table [len coded string]
-
- if mc.cfg.ColumnsWithAlias {
-
- tableName, _, n, err := readLengthEncodedString(data[pos:])
-
- if err != nil {
-
- return nil, err
-
- }
-
- pos += n
-
- columns[i].tableName = string(tableName)
-
- } else {
-
- n, err = skipLengthEncodedString(data[pos:])
-
- if err != nil {
-
- return nil, err
-
- }
-
- pos += n
-
- }
-
- // Original table [len coded string]
-
- n, err = skipLengthEncodedString(data[pos:])
-
- if err != nil {
-
- return nil, err
-
- }
-
- pos += n
-
- // Name [len coded string]
-
- name, _, n, err := readLengthEncodedString(data[pos:])
-
- if err != nil {
-
- return nil, err
-
- }
-
- columns[i].name = string(name)
-
- pos += n
-
- // Original name [len coded string]
-
- n, err = skipLengthEncodedString(data[pos:])
-
- if err != nil {
-
- return nil, err
-
- }
-
- pos += n
-
- // Filler [uint8]
-
- pos++
-
- // Charset [charset, collation uint8]
-
- columns[i].charSet = data[pos]
-
- pos += 2
-
- // Length [uint32]
-
- columns[i].length = binary.LittleEndian.Uint32(data[pos : pos+4])
-
- pos += 4
-
- // Field type [uint8]
-
- columns[i].fieldType = fieldType(data[pos])
-
- pos++
-
- // Flags [uint16]
-
- columns[i].flags = fieldFlag(binary.LittleEndian.Uint16(data[pos : pos+2]))
-
- pos += 2
-
- // Decimals [uint8]
-
- columns[i].decimals = data[pos]
-
- //pos++
-
- // Default value [len coded binary]
-
- //if pos < len(data) {
-
- // defaultVal, _, err = bytesToLengthCodedBinary(data[pos:])
-
- //}
-
- }
-
-}
-
-// Read Packets as Field Packets until EOF-Packet or an Error appears
-
-// http://dev.mysql.com/doc/internals/en/com-query-response.html#packet-ProtocolText::ResultsetRow
-
-func (rows *textRows) readRow(dest []driver.Value) error {
-
- mc := rows.mc
-
- if rows.rs.done {
-
- return io.EOF
-
- }
-
- data, err := mc.readPacket()
-
- if err != nil {
-
- return err
-
- }
-
- // EOF Packet
-
- if data[0] == iEOF && len(data) == 5 {
-
- // server_status [2 bytes]
-
- rows.mc.status = readStatus(data[3:])
-
- rows.rs.done = true
-
- if !rows.HasNextResultSet() {
-
- rows.mc = nil
-
- }
-
- return io.EOF
-
- }
-
- if data[0] == iERR {
-
- rows.mc = nil
-
- return mc.handleErrorPacket(data)
-
- }
-
- // RowSet Packet
-
- var n int
-
- var isNull bool
-
- pos := 0
-
- for i := range dest {
-
- // Read bytes and convert to string
-
- dest[i], isNull, n, err = readLengthEncodedString(data[pos:])
-
- pos += n
-
- if err == nil {
-
- if !isNull {
-
- if !mc.parseTime {
-
- continue
-
- } else {
-
- switch rows.rs.columns[i].fieldType {
-
- case fieldTypeTimestamp, fieldTypeDateTime,
-
- fieldTypeDate, fieldTypeNewDate:
-
- dest[i], err = parseDateTime(
-
- dest[i].([]byte),
-
- mc.cfg.Loc,
- )
-
- if err == nil {
-
- continue
-
- }
-
- default:
-
- continue
-
- }
-
- }
-
- } else {
-
- dest[i] = nil
-
- continue
-
- }
-
- }
-
- return err // err != nil
-
- }
-
- return nil
-
-}
-
-// Reads Packets until EOF-Packet or an Error appears. Returns count of Packets read
-
-func (mc *mysqlConn) readUntilEOF() error {
-
- for {
-
- data, err := mc.readPacket()
-
- if err != nil {
-
- return err
-
- }
-
- switch data[0] {
-
- case iERR:
-
- return mc.handleErrorPacket(data)
-
- case iEOF:
-
- if len(data) == 5 {
-
- mc.status = readStatus(data[3:])
-
- }
-
- return nil
-
- }
-
- }
-
-}
-
-/******************************************************************************
-
-* Prepared Statements *
-
-******************************************************************************/
-
-// Prepare Result Packets
-
-// http://dev.mysql.com/doc/internals/en/com-stmt-prepare-response.html
-
-func (stmt *mysqlStmt) readPrepareResultPacket() (uint16, error) {
-
- data, err := stmt.mc.readPacket()
-
- if err == nil {
-
- // packet indicator [1 byte]
-
- if data[0] != iOK {
-
- return 0, stmt.mc.handleErrorPacket(data)
-
- }
-
- // statement id [4 bytes]
-
- stmt.id = binary.LittleEndian.Uint32(data[1:5])
-
- // Column count [16 bit uint]
-
- columnCount := binary.LittleEndian.Uint16(data[5:7])
-
- // Param count [16 bit uint]
-
- stmt.paramCount = int(binary.LittleEndian.Uint16(data[7:9]))
-
- // Reserved [8 bit]
-
- // Warning count [16 bit uint]
-
- return columnCount, nil
-
- }
-
- return 0, err
-
-}
-
-// http://dev.mysql.com/doc/internals/en/com-stmt-send-long-data.html
-
-func (stmt *mysqlStmt) writeCommandLongData(paramID int, arg []byte) error {
-
- maxLen := stmt.mc.maxAllowedPacket - 1
-
- pktLen := maxLen
-
- // After the header (bytes 0-3) follows before the data:
-
- // 1 byte command
-
- // 4 bytes stmtID
-
- // 2 bytes paramID
-
- const dataOffset = 1 + 4 + 2
-
- // Cannot use the write buffer since
-
- // a) the buffer is too small
-
- // b) it is in use
-
- data := make([]byte, 4+1+4+2+len(arg))
-
- copy(data[4+dataOffset:], arg)
-
- for argLen := len(arg); argLen > 0; argLen -= pktLen - dataOffset {
-
- if dataOffset+argLen < maxLen {
-
- pktLen = dataOffset + argLen
-
- }
-
- stmt.mc.sequence = 0
-
- // Add command byte [1 byte]
-
- data[4] = comStmtSendLongData
-
- // Add stmtID [32 bit]
-
- data[5] = byte(stmt.id)
-
- data[6] = byte(stmt.id >> 8)
-
- data[7] = byte(stmt.id >> 16)
-
- data[8] = byte(stmt.id >> 24)
-
- // Add paramID [16 bit]
-
- data[9] = byte(paramID)
-
- data[10] = byte(paramID >> 8)
-
- // Send CMD packet
-
- err := stmt.mc.writePacket(data[:4+pktLen])
-
- if err == nil {
-
- data = data[pktLen-dataOffset:]
-
- continue
-
- }
-
- return err
-
- }
-
- // Reset Packet Sequence
-
- stmt.mc.sequence = 0
-
- return nil
-
-}
-
-// Execute Prepared Statement
-
-// http://dev.mysql.com/doc/internals/en/com-stmt-execute.html
-
-func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
-
- if len(args) != stmt.paramCount {
-
- return fmt.Errorf(
-
- "argument count mismatch (got: %d; has: %d)",
-
- len(args),
-
- stmt.paramCount,
- )
-
- }
-
- const minPktLen = 4 + 1 + 4 + 1 + 4
-
- mc := stmt.mc
-
- // Determine threshold dynamically to avoid packet size shortage.
-
- longDataSize := mc.maxAllowedPacket / (stmt.paramCount + 1)
-
- if longDataSize < 64 {
-
- longDataSize = 64
-
- }
-
- // Reset packet-sequence
-
- mc.sequence = 0
-
- var data []byte
-
- var err error
-
- if len(args) == 0 {
-
- data, err = mc.buf.takeBuffer(minPktLen)
-
- } else {
-
- data, err = mc.buf.takeCompleteBuffer()
-
- // In this case the len(data) == cap(data) which is used to optimise the flow below.
-
- }
-
- if err != nil {
-
- // cannot take the buffer. Something must be wrong with the connection
-
- errLog.Print(err)
-
- return errBadConnNoWrite
-
- }
-
- // command [1 byte]
-
- data[4] = comStmtExecute
-
- // statement_id [4 bytes]
-
- data[5] = byte(stmt.id)
-
- data[6] = byte(stmt.id >> 8)
-
- data[7] = byte(stmt.id >> 16)
-
- data[8] = byte(stmt.id >> 24)
-
- // flags (0: CURSOR_TYPE_NO_CURSOR) [1 byte]
-
- data[9] = 0x00
-
- // iteration_count (uint32(1)) [4 bytes]
-
- data[10] = 0x01
-
- data[11] = 0x00
-
- data[12] = 0x00
-
- data[13] = 0x00
-
- if len(args) > 0 {
-
- pos := minPktLen
-
- var nullMask []byte
-
- if maskLen, typesLen := (len(args)+7)/8, 1+2*len(args); pos+maskLen+typesLen >= cap(data) {
-
- // buffer has to be extended but we don't know by how much so
-
- // we depend on append after all data with known sizes fit.
-
- // We stop at that because we deal with a lot of columns here
-
- // which makes the required allocation size hard to guess.
-
- tmp := make([]byte, pos+maskLen+typesLen)
-
- copy(tmp[:pos], data[:pos])
-
- data = tmp
-
- nullMask = data[pos : pos+maskLen]
-
- // No need to clean nullMask as make ensures that.
-
- pos += maskLen
-
- } else {
-
- nullMask = data[pos : pos+maskLen]
-
- for i := range nullMask {
-
- nullMask[i] = 0
-
- }
-
- pos += maskLen
-
- }
-
- // newParameterBoundFlag 1 [1 byte]
-
- data[pos] = 0x01
-
- pos++
-
- // type of each parameter [len(args)*2 bytes]
-
- paramTypes := data[pos:]
-
- pos += len(args) * 2
-
- // value of each parameter [n bytes]
-
- paramValues := data[pos:pos]
-
- valuesCap := cap(paramValues)
-
- for i, arg := range args {
-
- // build NULL-bitmap
-
- if arg == nil {
-
- nullMask[i/8] |= 1 << (uint(i) & 7)
-
- paramTypes[i+i] = byte(fieldTypeNULL)
-
- paramTypes[i+i+1] = 0x00
-
- continue
-
- }
-
- if v, ok := arg.(json.RawMessage); ok {
-
- arg = []byte(v)
-
- }
-
- // cache types and values
-
- switch v := arg.(type) {
-
- case int64:
-
- paramTypes[i+i] = byte(fieldTypeLongLong)
-
- paramTypes[i+i+1] = 0x00
-
- if cap(paramValues)-len(paramValues)-8 >= 0 {
-
- paramValues = paramValues[:len(paramValues)+8]
-
- binary.LittleEndian.PutUint64(
-
- paramValues[len(paramValues)-8:],
-
- uint64(v),
- )
-
- } else {
-
- paramValues = append(paramValues,
-
- uint64ToBytes(uint64(v))...,
- )
-
- }
-
- case uint64:
-
- paramTypes[i+i] = byte(fieldTypeLongLong)
-
- paramTypes[i+i+1] = 0x80 // type is unsigned
-
- if cap(paramValues)-len(paramValues)-8 >= 0 {
-
- paramValues = paramValues[:len(paramValues)+8]
-
- binary.LittleEndian.PutUint64(
-
- paramValues[len(paramValues)-8:],
-
- uint64(v),
- )
-
- } else {
-
- paramValues = append(paramValues,
-
- uint64ToBytes(uint64(v))...,
- )
-
- }
-
- case float64:
-
- paramTypes[i+i] = byte(fieldTypeDouble)
-
- paramTypes[i+i+1] = 0x00
-
- if cap(paramValues)-len(paramValues)-8 >= 0 {
-
- paramValues = paramValues[:len(paramValues)+8]
-
- binary.LittleEndian.PutUint64(
-
- paramValues[len(paramValues)-8:],
-
- math.Float64bits(v),
- )
-
- } else {
-
- paramValues = append(paramValues,
-
- uint64ToBytes(math.Float64bits(v))...,
- )
-
- }
-
- case bool:
-
- paramTypes[i+i] = byte(fieldTypeTiny)
-
- paramTypes[i+i+1] = 0x00
-
- if v {
-
- paramValues = append(paramValues, 0x01)
-
- } else {
-
- paramValues = append(paramValues, 0x00)
-
- }
-
- case []byte:
-
- // Common case (non-nil value) first
-
- if v != nil {
-
- paramTypes[i+i] = byte(fieldTypeString)
-
- paramTypes[i+i+1] = 0x00
-
- if len(v) < longDataSize {
-
- paramValues = appendLengthEncodedInteger(paramValues,
-
- uint64(len(v)),
- )
-
- paramValues = append(paramValues, v...)
-
- } else {
-
- if err := stmt.writeCommandLongData(i, v); err != nil {
-
- return err
-
- }
-
- }
-
- continue
-
- }
-
- // Handle []byte(nil) as a NULL value
-
- nullMask[i/8] |= 1 << (uint(i) & 7)
-
- paramTypes[i+i] = byte(fieldTypeNULL)
-
- paramTypes[i+i+1] = 0x00
-
- case string:
-
- paramTypes[i+i] = byte(fieldTypeString)
-
- paramTypes[i+i+1] = 0x00
-
- if len(v) < longDataSize {
-
- paramValues = appendLengthEncodedInteger(paramValues,
-
- uint64(len(v)),
- )
-
- paramValues = append(paramValues, v...)
-
- } else {
-
- if err := stmt.writeCommandLongData(i, []byte(v)); err != nil {
-
- return err
-
- }
-
- }
-
- case time.Time:
-
- paramTypes[i+i] = byte(fieldTypeString)
-
- paramTypes[i+i+1] = 0x00
-
- var a [64]byte
-
- var b = a[:0]
-
- if v.IsZero() {
-
- b = append(b, "0000-00-00"...)
-
- } else {
-
- b, err = appendDateTime(b, v.In(mc.cfg.Loc))
-
- if err != nil {
-
- return err
-
- }
-
- }
-
- paramValues = appendLengthEncodedInteger(paramValues,
-
- uint64(len(b)),
- )
-
- paramValues = append(paramValues, b...)
-
- default:
-
- return fmt.Errorf("cannot convert type: %T", arg)
-
- }
-
- }
-
- // Check if param values exceeded the available buffer
-
- // In that case we must build the data packet with the new values buffer
-
- if valuesCap != cap(paramValues) {
-
- data = append(data[:pos], paramValues...)
-
- if err = mc.buf.store(data); err != nil {
-
- errLog.Print(err)
-
- return errBadConnNoWrite
-
- }
-
- }
-
- pos += len(paramValues)
-
- data = data[:pos]
-
- }
-
- return mc.writePacket(data)
-
-}
-
-func (mc *mysqlConn) discardResults() error {
-
- for mc.status&statusMoreResultsExists != 0 {
-
- resLen, err := mc.readResultSetHeaderPacket()
-
- if err != nil {
-
- return err
-
- }
-
- if resLen > 0 {
-
- // columns
-
- if err := mc.readUntilEOF(); err != nil {
-
- return err
-
- }
-
- // rows
-
- if err := mc.readUntilEOF(); err != nil {
-
- return err
-
- }
-
- }
-
- }
-
- return nil
-
-}
-
-// http://dev.mysql.com/doc/internals/en/binary-protocol-resultset-row.html
-
-func (rows *binaryRows) readRow(dest []driver.Value) error {
-
- data, err := rows.mc.readPacket()
-
- if err != nil {
-
- return err
-
- }
-
- // packet indicator [1 byte]
-
- if data[0] != iOK {
-
- // EOF Packet
-
- if data[0] == iEOF && len(data) == 5 {
-
- rows.mc.status = readStatus(data[3:])
-
- rows.rs.done = true
-
- if !rows.HasNextResultSet() {
-
- rows.mc = nil
-
- }
-
- return io.EOF
-
- }
-
- mc := rows.mc
-
- rows.mc = nil
-
- // Error otherwise
-
- return mc.handleErrorPacket(data)
-
- }
-
- // NULL-bitmap, [(column-count + 7 + 2) / 8 bytes]
-
- pos := 1 + (len(dest)+7+2)>>3
-
- nullMask := data[1:pos]
-
- for i := range dest {
-
- // Field is NULL
-
- // (byte >> bit-pos) % 2 == 1
-
- if ((nullMask[(i+2)>>3] >> uint((i+2)&7)) & 1) == 1 {
-
- dest[i] = nil
-
- continue
-
- }
-
- // Convert to byte-coded string
-
- switch rows.rs.columns[i].fieldType {
-
- case fieldTypeNULL:
-
- dest[i] = nil
-
- continue
-
- // Numeric Types
-
- case fieldTypeTiny:
-
- if rows.rs.columns[i].flags&flagUnsigned != 0 {
-
- dest[i] = int64(data[pos])
-
- } else {
-
- dest[i] = int64(int8(data[pos]))
-
- }
-
- pos++
-
- continue
-
- case fieldTypeShort, fieldTypeYear:
-
- if rows.rs.columns[i].flags&flagUnsigned != 0 {
-
- dest[i] = int64(binary.LittleEndian.Uint16(data[pos : pos+2]))
-
- } else {
-
- dest[i] = int64(int16(binary.LittleEndian.Uint16(data[pos : pos+2])))
-
- }
-
- pos += 2
-
- continue
-
- case fieldTypeInt24, fieldTypeLong:
-
- if rows.rs.columns[i].flags&flagUnsigned != 0 {
-
- dest[i] = int64(binary.LittleEndian.Uint32(data[pos : pos+4]))
-
- } else {
-
- dest[i] = int64(int32(binary.LittleEndian.Uint32(data[pos : pos+4])))
-
- }
-
- pos += 4
-
- continue
-
- case fieldTypeLongLong:
-
- if rows.rs.columns[i].flags&flagUnsigned != 0 {
-
- val := binary.LittleEndian.Uint64(data[pos : pos+8])
-
- if val > math.MaxInt64 {
-
- dest[i] = uint64ToString(val)
-
- } else {
-
- dest[i] = int64(val)
-
- }
-
- } else {
-
- dest[i] = int64(binary.LittleEndian.Uint64(data[pos : pos+8]))
-
- }
-
- pos += 8
-
- continue
-
- case fieldTypeFloat:
-
- dest[i] = math.Float32frombits(binary.LittleEndian.Uint32(data[pos : pos+4]))
-
- pos += 4
-
- continue
-
- case fieldTypeDouble:
-
- dest[i] = math.Float64frombits(binary.LittleEndian.Uint64(data[pos : pos+8]))
-
- pos += 8
-
- continue
-
- // Length coded Binary Strings
-
- case fieldTypeDecimal, fieldTypeNewDecimal, fieldTypeVarChar,
-
- fieldTypeBit, fieldTypeEnum, fieldTypeSet, fieldTypeTinyBLOB,
-
- fieldTypeMediumBLOB, fieldTypeLongBLOB, fieldTypeBLOB,
-
- fieldTypeVarString, fieldTypeString, fieldTypeGeometry, fieldTypeJSON:
-
- var isNull bool
-
- var n int
-
- dest[i], isNull, n, err = readLengthEncodedString(data[pos:])
-
- pos += n
-
- if err == nil {
-
- if !isNull {
-
- continue
-
- } else {
-
- dest[i] = nil
-
- continue
-
- }
-
- }
-
- return err
-
- case
-
- fieldTypeDate, fieldTypeNewDate, // Date YYYY-MM-DD
-
- fieldTypeTime, // Time [-][H]HH:MM:SS[.fractal]
-
- fieldTypeTimestamp, fieldTypeDateTime: // Timestamp YYYY-MM-DD HH:MM:SS[.fractal]
-
- num, isNull, n := readLengthEncodedInteger(data[pos:])
-
- pos += n
-
- switch {
-
- case isNull:
-
- dest[i] = nil
-
- continue
-
- case rows.rs.columns[i].fieldType == fieldTypeTime:
-
- // database/sql does not support an equivalent to TIME, return a string
-
- var dstlen uint8
-
- switch decimals := rows.rs.columns[i].decimals; decimals {
-
- case 0x00, 0x1f:
-
- dstlen = 8
-
- case 1, 2, 3, 4, 5, 6:
-
- dstlen = 8 + 1 + decimals
-
- default:
-
- return fmt.Errorf(
-
- "protocol error, illegal decimals value %d",
-
- rows.rs.columns[i].decimals,
- )
-
- }
-
- dest[i], err = formatBinaryTime(data[pos:pos+int(num)], dstlen)
-
- case rows.mc.parseTime:
-
- dest[i], err = parseBinaryDateTime(num, data[pos:], rows.mc.cfg.Loc)
-
- default:
-
- var dstlen uint8
-
- if rows.rs.columns[i].fieldType == fieldTypeDate {
-
- dstlen = 10
-
- } else {
-
- switch decimals := rows.rs.columns[i].decimals; decimals {
-
- case 0x00, 0x1f:
-
- dstlen = 19
-
- case 1, 2, 3, 4, 5, 6:
-
- dstlen = 19 + 1 + decimals
-
- default:
-
- return fmt.Errorf(
-
- "protocol error, illegal decimals value %d",
-
- rows.rs.columns[i].decimals,
- )
-
- }
-
- }
-
- dest[i], err = formatBinaryDateTime(data[pos:pos+int(num)], dstlen)
-
- }
-
- if err == nil {
-
- pos += int(num)
-
- continue
-
- } else {
-
- return err
-
- }
-
- // Please report if this happens!
-
- default:
-
- return fmt.Errorf("unknown field type %d", rows.rs.columns[i].fieldType)
-
- }
-
- }
-
- return nil
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/result.go b/vendor/github.com/go-sql-driver/mysql/result.go
deleted file mode 100644
index c6438d0..0000000
--- a/vendor/github.com/go-sql-driver/mysql/result.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-//
-// Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-type mysqlResult struct {
- affectedRows int64
- insertId int64
-}
-
-func (res *mysqlResult) LastInsertId() (int64, error) {
- return res.insertId, nil
-}
-
-func (res *mysqlResult) RowsAffected() (int64, error) {
- return res.affectedRows, nil
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/rows.go b/vendor/github.com/go-sql-driver/mysql/rows.go
deleted file mode 100644
index a7820cd..0000000
--- a/vendor/github.com/go-sql-driver/mysql/rows.go
+++ /dev/null
@@ -1,360 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-
-//
-
-// Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-import (
- "database/sql/driver"
- "io"
- "math"
- "reflect"
-)
-
-type resultSet struct {
- columns []mysqlField
-
- columnNames []string
-
- done bool
-}
-
-type mysqlRows struct {
- mc *mysqlConn
-
- rs resultSet
-
- finish func()
-}
-
-type binaryRows struct {
- mysqlRows
-}
-
-type textRows struct {
- mysqlRows
-}
-
-func (rows *mysqlRows) Columns() []string {
-
- if rows.rs.columnNames != nil {
-
- return rows.rs.columnNames
-
- }
-
- columns := make([]string, len(rows.rs.columns))
-
- if rows.mc != nil && rows.mc.cfg.ColumnsWithAlias {
-
- for i := range columns {
-
- if tableName := rows.rs.columns[i].tableName; len(tableName) > 0 {
-
- columns[i] = tableName + "." + rows.rs.columns[i].name
-
- } else {
-
- columns[i] = rows.rs.columns[i].name
-
- }
-
- }
-
- } else {
-
- for i := range columns {
-
- columns[i] = rows.rs.columns[i].name
-
- }
-
- }
-
- rows.rs.columnNames = columns
-
- return columns
-
-}
-
-func (rows *mysqlRows) ColumnTypeDatabaseTypeName(i int) string {
-
- return rows.rs.columns[i].typeDatabaseName()
-
-}
-
-// func (rows *mysqlRows) ColumnTypeLength(i int) (length int64, ok bool) {
-
-// return int64(rows.rs.columns[i].length), true
-
-// }
-
-func (rows *mysqlRows) ColumnTypeNullable(i int) (nullable, ok bool) {
-
- return rows.rs.columns[i].flags&flagNotNULL == 0, true
-
-}
-
-func (rows *mysqlRows) ColumnTypePrecisionScale(i int) (int64, int64, bool) {
-
- column := rows.rs.columns[i]
-
- decimals := int64(column.decimals)
-
- switch column.fieldType {
-
- case fieldTypeDecimal, fieldTypeNewDecimal:
-
- if decimals > 0 {
-
- return int64(column.length) - 2, decimals, true
-
- }
-
- return int64(column.length) - 1, decimals, true
-
- case fieldTypeTimestamp, fieldTypeDateTime, fieldTypeTime:
-
- return decimals, decimals, true
-
- case fieldTypeFloat, fieldTypeDouble:
-
- if decimals == 0x1f {
-
- return math.MaxInt64, math.MaxInt64, true
-
- }
-
- return math.MaxInt64, decimals, true
-
- }
-
- return 0, 0, false
-
-}
-
-func (rows *mysqlRows) ColumnTypeScanType(i int) reflect.Type {
-
- return rows.rs.columns[i].scanType()
-
-}
-
-func (rows *mysqlRows) Close() (err error) {
-
- if f := rows.finish; f != nil {
-
- f()
-
- rows.finish = nil
-
- }
-
- mc := rows.mc
-
- if mc == nil {
-
- return nil
-
- }
-
- if err := mc.error(); err != nil {
-
- return err
-
- }
-
- // flip the buffer for this connection if we need to drain it.
-
- // note that for a successful query (i.e. one where rows.next()
-
- // has been called until it returns false), `rows.mc` will be nil
-
- // by the time the user calls `(*Rows).Close`, so we won't reach this
-
- // see: https://github.com/golang/go/commit/651ddbdb5056ded455f47f9c494c67b389622a47
-
- mc.buf.flip()
-
- // Remove unread packets from stream
-
- if !rows.rs.done {
-
- err = mc.readUntilEOF()
-
- }
-
- if err == nil {
-
- if err = mc.discardResults(); err != nil {
-
- return err
-
- }
-
- }
-
- rows.mc = nil
-
- return err
-
-}
-
-func (rows *mysqlRows) HasNextResultSet() (b bool) {
-
- if rows.mc == nil {
-
- return false
-
- }
-
- return rows.mc.status&statusMoreResultsExists != 0
-
-}
-
-func (rows *mysqlRows) nextResultSet() (int, error) {
-
- if rows.mc == nil {
-
- return 0, io.EOF
-
- }
-
- if err := rows.mc.error(); err != nil {
-
- return 0, err
-
- }
-
- // Remove unread packets from stream
-
- if !rows.rs.done {
-
- if err := rows.mc.readUntilEOF(); err != nil {
-
- return 0, err
-
- }
-
- rows.rs.done = true
-
- }
-
- if !rows.HasNextResultSet() {
-
- rows.mc = nil
-
- return 0, io.EOF
-
- }
-
- rows.rs = resultSet{}
-
- return rows.mc.readResultSetHeaderPacket()
-
-}
-
-func (rows *mysqlRows) nextNotEmptyResultSet() (int, error) {
-
- for {
-
- resLen, err := rows.nextResultSet()
-
- if err != nil {
-
- return 0, err
-
- }
-
- if resLen > 0 {
-
- return resLen, nil
-
- }
-
- rows.rs.done = true
-
- }
-
-}
-
-func (rows *binaryRows) NextResultSet() error {
-
- resLen, err := rows.nextNotEmptyResultSet()
-
- if err != nil {
-
- return err
-
- }
-
- rows.rs.columns, err = rows.mc.readColumns(resLen)
-
- return err
-
-}
-
-func (rows *binaryRows) Next(dest []driver.Value) error {
-
- if mc := rows.mc; mc != nil {
-
- if err := mc.error(); err != nil {
-
- return err
-
- }
-
- // Fetch next row from stream
-
- return rows.readRow(dest)
-
- }
-
- return io.EOF
-
-}
-
-func (rows *textRows) NextResultSet() (err error) {
-
- resLen, err := rows.nextNotEmptyResultSet()
-
- if err != nil {
-
- return err
-
- }
-
- rows.rs.columns, err = rows.mc.readColumns(resLen)
-
- return err
-
-}
-
-func (rows *textRows) Next(dest []driver.Value) error {
-
- if mc := rows.mc; mc != nil {
-
- if err := mc.error(); err != nil {
-
- return err
-
- }
-
- // Fetch next row from stream
-
- return rows.readRow(dest)
-
- }
-
- return io.EOF
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/statement.go b/vendor/github.com/go-sql-driver/mysql/statement.go
deleted file mode 100644
index 7f48608..0000000
--- a/vendor/github.com/go-sql-driver/mysql/statement.go
+++ /dev/null
@@ -1,370 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-
-//
-
-// Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-import (
- "database/sql/driver"
- "encoding/json"
- "fmt"
- "io"
- "reflect"
-)
-
-type mysqlStmt struct {
- mc *mysqlConn
-
- id uint32
-
- paramCount int
-}
-
-func (stmt *mysqlStmt) Close() error {
-
- if stmt.mc == nil || stmt.mc.closed.IsSet() {
-
- // driver.Stmt.Close can be called more than once, thus this function
-
- // has to be idempotent.
-
- // See also Issue #450 and golang/go#16019.
-
- //errLog.Print(ErrInvalidConn)
-
- return driver.ErrBadConn
-
- }
-
- err := stmt.mc.writeCommandPacketUint32(comStmtClose, stmt.id)
-
- stmt.mc = nil
-
- return err
-
-}
-
-func (stmt *mysqlStmt) NumInput() int {
-
- return stmt.paramCount
-
-}
-
-func (stmt *mysqlStmt) ColumnConverter(idx int) driver.ValueConverter {
-
- return converter{}
-
-}
-
-func (stmt *mysqlStmt) CheckNamedValue(nv *driver.NamedValue) (err error) {
-
- nv.Value, err = converter{}.ConvertValue(nv.Value)
-
- return
-
-}
-
-func (stmt *mysqlStmt) Exec(args []driver.Value) (driver.Result, error) {
-
- if stmt.mc.closed.IsSet() {
-
- errLog.Print(ErrInvalidConn)
-
- return nil, driver.ErrBadConn
-
- }
-
- // Send command
-
- err := stmt.writeExecutePacket(args)
-
- if err != nil {
-
- return nil, stmt.mc.markBadConn(err)
-
- }
-
- mc := stmt.mc
-
- mc.affectedRows = 0
-
- mc.insertId = 0
-
- // Read Result
-
- resLen, err := mc.readResultSetHeaderPacket()
-
- if err != nil {
-
- return nil, err
-
- }
-
- if resLen > 0 {
-
- // Columns
-
- if err = mc.readUntilEOF(); err != nil {
-
- return nil, err
-
- }
-
- // Rows
-
- if err := mc.readUntilEOF(); err != nil {
-
- return nil, err
-
- }
-
- }
-
- if err := mc.discardResults(); err != nil {
-
- return nil, err
-
- }
-
- return &mysqlResult{
-
- affectedRows: int64(mc.affectedRows),
-
- insertId: int64(mc.insertId),
- }, nil
-
-}
-
-func (stmt *mysqlStmt) Query(args []driver.Value) (driver.Rows, error) {
-
- return stmt.query(args)
-
-}
-
-func (stmt *mysqlStmt) query(args []driver.Value) (*binaryRows, error) {
-
- if stmt.mc.closed.IsSet() {
-
- errLog.Print(ErrInvalidConn)
-
- return nil, driver.ErrBadConn
-
- }
-
- // Send command
-
- err := stmt.writeExecutePacket(args)
-
- if err != nil {
-
- return nil, stmt.mc.markBadConn(err)
-
- }
-
- mc := stmt.mc
-
- // Read Result
-
- resLen, err := mc.readResultSetHeaderPacket()
-
- if err != nil {
-
- return nil, err
-
- }
-
- rows := new(binaryRows)
-
- if resLen > 0 {
-
- rows.mc = mc
-
- rows.rs.columns, err = mc.readColumns(resLen)
-
- } else {
-
- rows.rs.done = true
-
- switch err := rows.NextResultSet(); err {
-
- case nil, io.EOF:
-
- return rows, nil
-
- default:
-
- return nil, err
-
- }
-
- }
-
- return rows, err
-
-}
-
-var jsonType = reflect.TypeOf(json.RawMessage{})
-
-type converter struct{}
-
-// ConvertValue mirrors the reference/default converter in database/sql/driver
-
-// with _one_ exception. We support uint64 with their high bit and the default
-
-// implementation does not. This function should be kept in sync with
-
-// database/sql/driver defaultConverter.ConvertValue() except for that
-
-// deliberate difference.
-
-func (c converter) ConvertValue(v interface{}) (driver.Value, error) {
-
- if driver.IsValue(v) {
-
- return v, nil
-
- }
-
- if vr, ok := v.(driver.Valuer); ok {
-
- sv, err := callValuerValue(vr)
-
- if err != nil {
-
- return nil, err
-
- }
-
- if driver.IsValue(sv) {
-
- return sv, nil
-
- }
-
- // A value returend from the Valuer interface can be "a type handled by
-
- // a database driver's NamedValueChecker interface" so we should accept
-
- // uint64 here as well.
-
- if u, ok := sv.(uint64); ok {
-
- return u, nil
-
- }
-
- return nil, fmt.Errorf("non-Value type %T returned from Value", sv)
-
- }
-
- rv := reflect.ValueOf(v)
-
- switch rv.Kind() {
-
- case reflect.Ptr:
-
- // indirect pointers
-
- if rv.IsNil() {
-
- return nil, nil
-
- } else {
-
- return c.ConvertValue(rv.Elem().Interface())
-
- }
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-
- return rv.Int(), nil
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
-
- return rv.Uint(), nil
-
- case reflect.Float32, reflect.Float64:
-
- return rv.Float(), nil
-
- case reflect.Bool:
-
- return rv.Bool(), nil
-
- case reflect.Slice:
-
- switch t := rv.Type(); {
-
- case t == jsonType:
-
- return v, nil
-
- case t.Elem().Kind() == reflect.Uint8:
-
- return rv.Bytes(), nil
-
- default:
-
- return nil, fmt.Errorf("unsupported type %T, a slice of %s", v, t.Elem().Kind())
-
- }
-
- case reflect.String:
-
- return rv.String(), nil
-
- }
-
- return nil, fmt.Errorf("unsupported type %T, a %s", v, rv.Kind())
-
-}
-
-var valuerReflectType = reflect.TypeOf((*driver.Valuer)(nil)).Elem()
-
-// callValuerValue returns vr.Value(), with one exception:
-
-// If vr.Value is an auto-generated method on a pointer type and the
-
-// pointer is nil, it would panic at runtime in the panicwrap
-
-// method. Treat it like nil instead.
-
-//
-
-// This is so people can implement driver.Value on value types and
-
-// still use nil pointers to those types to mean nil/NULL, just like
-
-// string/*string.
-
-//
-
-// This is an exact copy of the same-named unexported function from the
-
-// database/sql package.
-
-func callValuerValue(vr driver.Valuer) (v driver.Value, err error) {
-
- if rv := reflect.ValueOf(vr); rv.Kind() == reflect.Ptr &&
-
- rv.IsNil() &&
-
- rv.Type().Elem().Implements(valuerReflectType) {
-
- return nil, nil
-
- }
-
- return vr.Value()
-
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/transaction.go b/vendor/github.com/go-sql-driver/mysql/transaction.go
deleted file mode 100644
index 417d727..0000000
--- a/vendor/github.com/go-sql-driver/mysql/transaction.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-//
-// Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-type mysqlTx struct {
- mc *mysqlConn
-}
-
-func (tx *mysqlTx) Commit() (err error) {
- if tx.mc == nil || tx.mc.closed.IsSet() {
- return ErrInvalidConn
- }
- err = tx.mc.exec("COMMIT")
- tx.mc = nil
- return
-}
-
-func (tx *mysqlTx) Rollback() (err error) {
- if tx.mc == nil || tx.mc.closed.IsSet() {
- return ErrInvalidConn
- }
- err = tx.mc.exec("ROLLBACK")
- tx.mc = nil
- return
-}
diff --git a/vendor/github.com/go-sql-driver/mysql/utils.go b/vendor/github.com/go-sql-driver/mysql/utils.go
deleted file mode 100644
index d5444b2..0000000
--- a/vendor/github.com/go-sql-driver/mysql/utils.go
+++ /dev/null
@@ -1,1509 +0,0 @@
-// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
-
-//
-
-// Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
-
-//
-
-// This Source Code Form is subject to the terms of the Mozilla Public
-
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-package mysql
-
-import (
- "crypto/tls"
- "database/sql"
- "database/sql/driver"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "strconv"
- "strings"
- "sync"
- "sync/atomic"
- "time"
-)
-
-// Registry for custom tls.Configs
-
-var (
- tlsConfigLock sync.RWMutex
-
- tlsConfigRegistry map[string]*tls.Config
-)
-
-// RegisterTLSConfig registers a custom tls.Config to be used with sql.Open.
-
-// Use the key as a value in the DSN where tls=value.
-
-//
-
-// Note: The provided tls.Config is exclusively owned by the driver after
-
-// registering it.
-
-//
-
-// rootCertPool := x509.NewCertPool()
-
-// pem, err := ioutil.ReadFile("/path/ca-cert.pem")
-
-// if err != nil {
-
-// log.Fatal(err)
-
-// }
-
-// if ok := rootCertPool.AppendCertsFromPEM(pem); !ok {
-
-// log.Fatal("Failed to append PEM.")
-
-// }
-
-// clientCert := make([]tls.Certificate, 0, 1)
-
-// certs, err := tls.LoadX509KeyPair("/path/client-cert.pem", "/path/client-key.pem")
-
-// if err != nil {
-
-// log.Fatal(err)
-
-// }
-
-// clientCert = append(clientCert, certs)
-
-// mysql.RegisterTLSConfig("custom", &tls.Config{
-
-// RootCAs: rootCertPool,
-
-// Certificates: clientCert,
-
-// })
-
-// db, err := sql.Open("mysql", "user@tcp(localhost:3306)/test?tls=custom")
-
-func RegisterTLSConfig(key string, config *tls.Config) error {
-
- if _, isBool := readBool(key); isBool || strings.ToLower(key) == "skip-verify" || strings.ToLower(key) == "preferred" {
-
- return fmt.Errorf("key '%s' is reserved", key)
-
- }
-
- tlsConfigLock.Lock()
-
- if tlsConfigRegistry == nil {
-
- tlsConfigRegistry = make(map[string]*tls.Config)
-
- }
-
- tlsConfigRegistry[key] = config
-
- tlsConfigLock.Unlock()
-
- return nil
-
-}
-
-// DeregisterTLSConfig removes the tls.Config associated with key.
-
-func DeregisterTLSConfig(key string) {
-
- tlsConfigLock.Lock()
-
- if tlsConfigRegistry != nil {
-
- delete(tlsConfigRegistry, key)
-
- }
-
- tlsConfigLock.Unlock()
-
-}
-
-func getTLSConfigClone(key string) (config *tls.Config) {
-
- tlsConfigLock.RLock()
-
- if v, ok := tlsConfigRegistry[key]; ok {
-
- config = v.Clone()
-
- }
-
- tlsConfigLock.RUnlock()
-
- return
-
-}
-
-// Returns the bool value of the input.
-
-// The 2nd return value indicates if the input was a valid bool value
-
-func readBool(input string) (value bool, valid bool) {
-
- switch input {
-
- case "1", "true", "TRUE", "True":
-
- return true, true
-
- case "0", "false", "FALSE", "False":
-
- return false, true
-
- }
-
- // Not a valid bool value
-
- return
-
-}
-
-/******************************************************************************
-
-* Time related utils *
-
-******************************************************************************/
-
-func parseDateTime(b []byte, loc *time.Location) (time.Time, error) {
-
- const base = "0000-00-00 00:00:00.000000"
-
- switch len(b) {
-
- case 10, 19, 21, 22, 23, 24, 25, 26: // up to "YYYY-MM-DD HH:MM:SS.MMMMMM"
-
- if string(b) == base[:len(b)] {
-
- return time.Time{}, nil
-
- }
-
- year, err := parseByteYear(b)
-
- if err != nil {
-
- return time.Time{}, err
-
- }
-
- if year <= 0 {
-
- year = 1
-
- }
-
- if b[4] != '-' {
-
- return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[4])
-
- }
-
- m, err := parseByte2Digits(b[5], b[6])
-
- if err != nil {
-
- return time.Time{}, err
-
- }
-
- if m <= 0 {
-
- m = 1
-
- }
-
- month := time.Month(m)
-
- if b[7] != '-' {
-
- return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[7])
-
- }
-
- day, err := parseByte2Digits(b[8], b[9])
-
- if err != nil {
-
- return time.Time{}, err
-
- }
-
- if day <= 0 {
-
- day = 1
-
- }
-
- if len(b) == 10 {
-
- return time.Date(year, month, day, 0, 0, 0, 0, loc), nil
-
- }
-
- if b[10] != ' ' {
-
- return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[10])
-
- }
-
- hour, err := parseByte2Digits(b[11], b[12])
-
- if err != nil {
-
- return time.Time{}, err
-
- }
-
- if b[13] != ':' {
-
- return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[13])
-
- }
-
- min, err := parseByte2Digits(b[14], b[15])
-
- if err != nil {
-
- return time.Time{}, err
-
- }
-
- if b[16] != ':' {
-
- return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[16])
-
- }
-
- sec, err := parseByte2Digits(b[17], b[18])
-
- if err != nil {
-
- return time.Time{}, err
-
- }
-
- if len(b) == 19 {
-
- return time.Date(year, month, day, hour, min, sec, 0, loc), nil
-
- }
-
- if b[19] != '.' {
-
- return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[19])
-
- }
-
- nsec, err := parseByteNanoSec(b[20:])
-
- if err != nil {
-
- return time.Time{}, err
-
- }
-
- return time.Date(year, month, day, hour, min, sec, nsec, loc), nil
-
- default:
-
- return time.Time{}, fmt.Errorf("invalid time bytes: %s", b)
-
- }
-
-}
-
-func parseByteYear(b []byte) (int, error) {
-
- year, n := 0, 1000
-
- for i := 0; i < 4; i++ {
-
- v, err := bToi(b[i])
-
- if err != nil {
-
- return 0, err
-
- }
-
- year += v * n
-
- n = n / 10
-
- }
-
- return year, nil
-
-}
-
-func parseByte2Digits(b1, b2 byte) (int, error) {
-
- d1, err := bToi(b1)
-
- if err != nil {
-
- return 0, err
-
- }
-
- d2, err := bToi(b2)
-
- if err != nil {
-
- return 0, err
-
- }
-
- return d1*10 + d2, nil
-
-}
-
-func parseByteNanoSec(b []byte) (int, error) {
-
- ns, digit := 0, 100000 // max is 6-digits
-
- for i := 0; i < len(b); i++ {
-
- v, err := bToi(b[i])
-
- if err != nil {
-
- return 0, err
-
- }
-
- ns += v * digit
-
- digit /= 10
-
- }
-
- // nanoseconds has 10-digits. (needs to scale digits)
-
- // 10 - 6 = 4, so we have to multiple 1000.
-
- return ns * 1000, nil
-
-}
-
-func bToi(b byte) (int, error) {
-
- if b < '0' || b > '9' {
-
- return 0, errors.New("not [0-9]")
-
- }
-
- return int(b - '0'), nil
-
-}
-
-func parseBinaryDateTime(num uint64, data []byte, loc *time.Location) (driver.Value, error) {
-
- switch num {
-
- case 0:
-
- return time.Time{}, nil
-
- case 4:
-
- return time.Date(
-
- int(binary.LittleEndian.Uint16(data[:2])), // year
-
- time.Month(data[2]), // month
-
- int(data[3]), // day
-
- 0, 0, 0, 0,
-
- loc,
- ), nil
-
- case 7:
-
- return time.Date(
-
- int(binary.LittleEndian.Uint16(data[:2])), // year
-
- time.Month(data[2]), // month
-
- int(data[3]), // day
-
- int(data[4]), // hour
-
- int(data[5]), // minutes
-
- int(data[6]), // seconds
-
- 0,
-
- loc,
- ), nil
-
- case 11:
-
- return time.Date(
-
- int(binary.LittleEndian.Uint16(data[:2])), // year
-
- time.Month(data[2]), // month
-
- int(data[3]), // day
-
- int(data[4]), // hour
-
- int(data[5]), // minutes
-
- int(data[6]), // seconds
-
- int(binary.LittleEndian.Uint32(data[7:11]))*1000, // nanoseconds
-
- loc,
- ), nil
-
- }
-
- return nil, fmt.Errorf("invalid DATETIME packet length %d", num)
-
-}
-
-func appendDateTime(buf []byte, t time.Time) ([]byte, error) {
-
- year, month, day := t.Date()
-
- hour, min, sec := t.Clock()
-
- nsec := t.Nanosecond()
-
- if year < 1 || year > 9999 {
-
- return buf, errors.New("year is not in the range [1, 9999]: " + strconv.Itoa(year)) // use errors.New instead of fmt.Errorf to avoid year escape to heap
-
- }
-
- year100 := year / 100
-
- year1 := year % 100
-
- var localBuf [len("2006-01-02T15:04:05.999999999")]byte // does not escape
-
- localBuf[0], localBuf[1], localBuf[2], localBuf[3] = digits10[year100], digits01[year100], digits10[year1], digits01[year1]
-
- localBuf[4] = '-'
-
- localBuf[5], localBuf[6] = digits10[month], digits01[month]
-
- localBuf[7] = '-'
-
- localBuf[8], localBuf[9] = digits10[day], digits01[day]
-
- if hour == 0 && min == 0 && sec == 0 && nsec == 0 {
-
- return append(buf, localBuf[:10]...), nil
-
- }
-
- localBuf[10] = ' '
-
- localBuf[11], localBuf[12] = digits10[hour], digits01[hour]
-
- localBuf[13] = ':'
-
- localBuf[14], localBuf[15] = digits10[min], digits01[min]
-
- localBuf[16] = ':'
-
- localBuf[17], localBuf[18] = digits10[sec], digits01[sec]
-
- if nsec == 0 {
-
- return append(buf, localBuf[:19]...), nil
-
- }
-
- nsec100000000 := nsec / 100000000
-
- nsec1000000 := (nsec / 1000000) % 100
-
- nsec10000 := (nsec / 10000) % 100
-
- nsec100 := (nsec / 100) % 100
-
- nsec1 := nsec % 100
-
- localBuf[19] = '.'
-
- // milli second
-
- localBuf[20], localBuf[21], localBuf[22] =
-
- digits01[nsec100000000], digits10[nsec1000000], digits01[nsec1000000]
-
- // micro second
-
- localBuf[23], localBuf[24], localBuf[25] =
-
- digits10[nsec10000], digits01[nsec10000], digits10[nsec100]
-
- // nano second
-
- localBuf[26], localBuf[27], localBuf[28] =
-
- digits01[nsec100], digits10[nsec1], digits01[nsec1]
-
- // trim trailing zeros
-
- n := len(localBuf)
-
- for n > 0 && localBuf[n-1] == '0' {
-
- n--
-
- }
-
- return append(buf, localBuf[:n]...), nil
-
-}
-
-// zeroDateTime is used in formatBinaryDateTime to avoid an allocation
-
-// if the DATE or DATETIME has the zero value.
-
-// It must never be changed.
-
-// The current behavior depends on database/sql copying the result.
-
-var zeroDateTime = []byte("0000-00-00 00:00:00.000000")
-
-const digits01 = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
-
-const digits10 = "0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999"
-
-func appendMicrosecs(dst, src []byte, decimals int) []byte {
-
- if decimals <= 0 {
-
- return dst
-
- }
-
- if len(src) == 0 {
-
- return append(dst, ".000000"[:decimals+1]...)
-
- }
-
- microsecs := binary.LittleEndian.Uint32(src[:4])
-
- p1 := byte(microsecs / 10000)
-
- microsecs -= 10000 * uint32(p1)
-
- p2 := byte(microsecs / 100)
-
- microsecs -= 100 * uint32(p2)
-
- p3 := byte(microsecs)
-
- switch decimals {
-
- default:
-
- return append(dst, '.',
-
- digits10[p1], digits01[p1],
-
- digits10[p2], digits01[p2],
-
- digits10[p3], digits01[p3],
- )
-
- case 1:
-
- return append(dst, '.',
-
- digits10[p1],
- )
-
- case 2:
-
- return append(dst, '.',
-
- digits10[p1], digits01[p1],
- )
-
- case 3:
-
- return append(dst, '.',
-
- digits10[p1], digits01[p1],
-
- digits10[p2],
- )
-
- case 4:
-
- return append(dst, '.',
-
- digits10[p1], digits01[p1],
-
- digits10[p2], digits01[p2],
- )
-
- case 5:
-
- return append(dst, '.',
-
- digits10[p1], digits01[p1],
-
- digits10[p2], digits01[p2],
-
- digits10[p3],
- )
-
- }
-
-}
-
-func formatBinaryDateTime(src []byte, length uint8) (driver.Value, error) {
-
- // length expects the deterministic length of the zero value,
-
- // negative time and 100+ hours are automatically added if needed
-
- if len(src) == 0 {
-
- return zeroDateTime[:length], nil
-
- }
-
- var dst []byte // return value
-
- var p1, p2, p3 byte // current digit pair
-
- switch length {
-
- case 10, 19, 21, 22, 23, 24, 25, 26:
-
- default:
-
- t := "DATE"
-
- if length > 10 {
-
- t += "TIME"
-
- }
-
- return nil, fmt.Errorf("illegal %s length %d", t, length)
-
- }
-
- switch len(src) {
-
- case 4, 7, 11:
-
- default:
-
- t := "DATE"
-
- if length > 10 {
-
- t += "TIME"
-
- }
-
- return nil, fmt.Errorf("illegal %s packet length %d", t, len(src))
-
- }
-
- dst = make([]byte, 0, length)
-
- // start with the date
-
- year := binary.LittleEndian.Uint16(src[:2])
-
- pt := year / 100
-
- p1 = byte(year - 100*uint16(pt))
-
- p2, p3 = src[2], src[3]
-
- dst = append(dst,
-
- digits10[pt], digits01[pt],
-
- digits10[p1], digits01[p1], '-',
-
- digits10[p2], digits01[p2], '-',
-
- digits10[p3], digits01[p3],
- )
-
- if length == 10 {
-
- return dst, nil
-
- }
-
- if len(src) == 4 {
-
- return append(dst, zeroDateTime[10:length]...), nil
-
- }
-
- dst = append(dst, ' ')
-
- p1 = src[4] // hour
-
- src = src[5:]
-
- // p1 is 2-digit hour, src is after hour
-
- p2, p3 = src[0], src[1]
-
- dst = append(dst,
-
- digits10[p1], digits01[p1], ':',
-
- digits10[p2], digits01[p2], ':',
-
- digits10[p3], digits01[p3],
- )
-
- return appendMicrosecs(dst, src[2:], int(length)-20), nil
-
-}
-
-func formatBinaryTime(src []byte, length uint8) (driver.Value, error) {
-
- // length expects the deterministic length of the zero value,
-
- // negative time and 100+ hours are automatically added if needed
-
- if len(src) == 0 {
-
- return zeroDateTime[11 : 11+length], nil
-
- }
-
- var dst []byte // return value
-
- switch length {
-
- case
-
- 8, // time (can be up to 10 when negative and 100+ hours)
-
- 10, 11, 12, 13, 14, 15: // time with fractional seconds
-
- default:
-
- return nil, fmt.Errorf("illegal TIME length %d", length)
-
- }
-
- switch len(src) {
-
- case 8, 12:
-
- default:
-
- return nil, fmt.Errorf("invalid TIME packet length %d", len(src))
-
- }
-
- // +2 to enable negative time and 100+ hours
-
- dst = make([]byte, 0, length+2)
-
- if src[0] == 1 {
-
- dst = append(dst, '-')
-
- }
-
- days := binary.LittleEndian.Uint32(src[1:5])
-
- hours := int64(days)*24 + int64(src[5])
-
- if hours >= 100 {
-
- dst = strconv.AppendInt(dst, hours, 10)
-
- } else {
-
- dst = append(dst, digits10[hours], digits01[hours])
-
- }
-
- min, sec := src[6], src[7]
-
- dst = append(dst, ':',
-
- digits10[min], digits01[min], ':',
-
- digits10[sec], digits01[sec],
- )
-
- return appendMicrosecs(dst, src[8:], int(length)-9), nil
-
-}
-
-/******************************************************************************
-
-* Convert from and to bytes *
-
-******************************************************************************/
-
-func uint64ToBytes(n uint64) []byte {
-
- return []byte{
-
- byte(n),
-
- byte(n >> 8),
-
- byte(n >> 16),
-
- byte(n >> 24),
-
- byte(n >> 32),
-
- byte(n >> 40),
-
- byte(n >> 48),
-
- byte(n >> 56),
- }
-
-}
-
-func uint64ToString(n uint64) []byte {
-
- var a [20]byte
-
- i := 20
-
- // U+0030 = 0
-
- // ...
-
- // U+0039 = 9
-
- var q uint64
-
- for n >= 10 {
-
- i--
-
- q = n / 10
-
- a[i] = uint8(n-q*10) + 0x30
-
- n = q
-
- }
-
- i--
-
- a[i] = uint8(n) + 0x30
-
- return a[i:]
-
-}
-
-// treats string value as unsigned integer representation
-
-func stringToInt(b []byte) int {
-
- val := 0
-
- for i := range b {
-
- val *= 10
-
- val += int(b[i] - 0x30)
-
- }
-
- return val
-
-}
-
-// returns the string read as a bytes slice, wheter the value is NULL,
-
-// the number of bytes read and an error, in case the string is longer than
-
-// the input slice
-
-func readLengthEncodedString(b []byte) ([]byte, bool, int, error) {
-
- // Get length
-
- num, isNull, n := readLengthEncodedInteger(b)
-
- if num < 1 {
-
- return b[n:n], isNull, n, nil
-
- }
-
- n += int(num)
-
- // Check data length
-
- if len(b) >= n {
-
- return b[n-int(num) : n : n], false, n, nil
-
- }
-
- return nil, false, n, io.EOF
-
-}
-
-// returns the number of bytes skipped and an error, in case the string is
-
-// longer than the input slice
-
-func skipLengthEncodedString(b []byte) (int, error) {
-
- // Get length
-
- num, _, n := readLengthEncodedInteger(b)
-
- if num < 1 {
-
- return n, nil
-
- }
-
- n += int(num)
-
- // Check data length
-
- if len(b) >= n {
-
- return n, nil
-
- }
-
- return n, io.EOF
-
-}
-
-// returns the number read, whether the value is NULL and the number of bytes read
-
-func readLengthEncodedInteger(b []byte) (uint64, bool, int) {
-
- // See issue #349
-
- if len(b) == 0 {
-
- return 0, true, 1
-
- }
-
- switch b[0] {
-
- // 251: NULL
-
- case 0xfb:
-
- return 0, true, 1
-
- // 252: value of following 2
-
- case 0xfc:
-
- return uint64(b[1]) | uint64(b[2])<<8, false, 3
-
- // 253: value of following 3
-
- case 0xfd:
-
- return uint64(b[1]) | uint64(b[2])<<8 | uint64(b[3])<<16, false, 4
-
- // 254: value of following 8
-
- case 0xfe:
-
- return uint64(b[1]) | uint64(b[2])<<8 | uint64(b[3])<<16 |
-
- uint64(b[4])<<24 | uint64(b[5])<<32 | uint64(b[6])<<40 |
-
- uint64(b[7])<<48 | uint64(b[8])<<56,
-
- false, 9
-
- }
-
- // 0-250: value of first byte
-
- return uint64(b[0]), false, 1
-
-}
-
-// encodes a uint64 value and appends it to the given bytes slice
-
-func appendLengthEncodedInteger(b []byte, n uint64) []byte {
-
- switch {
-
- case n <= 250:
-
- return append(b, byte(n))
-
- case n <= 0xffff:
-
- return append(b, 0xfc, byte(n), byte(n>>8))
-
- case n <= 0xffffff:
-
- return append(b, 0xfd, byte(n), byte(n>>8), byte(n>>16))
-
- }
-
- return append(b, 0xfe, byte(n), byte(n>>8), byte(n>>16), byte(n>>24),
-
- byte(n>>32), byte(n>>40), byte(n>>48), byte(n>>56))
-
-}
-
-// reserveBuffer checks cap(buf) and expand buffer to len(buf) + appendSize.
-
-// If cap(buf) is not enough, reallocate new buffer.
-
-func reserveBuffer(buf []byte, appendSize int) []byte {
-
- newSize := len(buf) + appendSize
-
- if cap(buf) < newSize {
-
- // Grow buffer exponentially
-
- newBuf := make([]byte, len(buf)*2+appendSize)
-
- copy(newBuf, buf)
-
- buf = newBuf
-
- }
-
- return buf[:newSize]
-
-}
-
-// escapeBytesBackslash escapes []byte with backslashes (\)
-
-// This escapes the contents of a string (provided as []byte) by adding backslashes before special
-
-// characters, and turning others into specific escape sequences, such as
-
-// turning newlines into \n and null bytes into \0.
-
-// https://github.com/mysql/mysql-server/blob/mysql-5.7.5/mysys/charset.c#L823-L932
-
-func escapeBytesBackslash(buf, v []byte) []byte {
-
- pos := len(buf)
-
- buf = reserveBuffer(buf, len(v)*2)
-
- for _, c := range v {
-
- switch c {
-
- case '\x00':
-
- buf[pos] = '\\'
-
- buf[pos+1] = '0'
-
- pos += 2
-
- case '\n':
-
- buf[pos] = '\\'
-
- buf[pos+1] = 'n'
-
- pos += 2
-
- case '\r':
-
- buf[pos] = '\\'
-
- buf[pos+1] = 'r'
-
- pos += 2
-
- case '\x1a':
-
- buf[pos] = '\\'
-
- buf[pos+1] = 'Z'
-
- pos += 2
-
- case '\'':
-
- buf[pos] = '\\'
-
- buf[pos+1] = '\''
-
- pos += 2
-
- case '"':
-
- buf[pos] = '\\'
-
- buf[pos+1] = '"'
-
- pos += 2
-
- case '\\':
-
- buf[pos] = '\\'
-
- buf[pos+1] = '\\'
-
- pos += 2
-
- default:
-
- buf[pos] = c
-
- pos++
-
- }
-
- }
-
- return buf[:pos]
-
-}
-
-// escapeStringBackslash is similar to escapeBytesBackslash but for string.
-
-func escapeStringBackslash(buf []byte, v string) []byte {
-
- pos := len(buf)
-
- buf = reserveBuffer(buf, len(v)*2)
-
- for i := 0; i < len(v); i++ {
-
- c := v[i]
-
- switch c {
-
- case '\x00':
-
- buf[pos] = '\\'
-
- buf[pos+1] = '0'
-
- pos += 2
-
- case '\n':
-
- buf[pos] = '\\'
-
- buf[pos+1] = 'n'
-
- pos += 2
-
- case '\r':
-
- buf[pos] = '\\'
-
- buf[pos+1] = 'r'
-
- pos += 2
-
- case '\x1a':
-
- buf[pos] = '\\'
-
- buf[pos+1] = 'Z'
-
- pos += 2
-
- case '\'':
-
- buf[pos] = '\\'
-
- buf[pos+1] = '\''
-
- pos += 2
-
- case '"':
-
- buf[pos] = '\\'
-
- buf[pos+1] = '"'
-
- pos += 2
-
- case '\\':
-
- buf[pos] = '\\'
-
- buf[pos+1] = '\\'
-
- pos += 2
-
- default:
-
- buf[pos] = c
-
- pos++
-
- }
-
- }
-
- return buf[:pos]
-
-}
-
-// escapeBytesQuotes escapes apostrophes in []byte by doubling them up.
-
-// This escapes the contents of a string by doubling up any apostrophes that
-
-// it contains. This is used when the NO_BACKSLASH_ESCAPES SQL_MODE is in
-
-// effect on the server.
-
-// https://github.com/mysql/mysql-server/blob/mysql-5.7.5/mysys/charset.c#L963-L1038
-
-func escapeBytesQuotes(buf, v []byte) []byte {
-
- pos := len(buf)
-
- buf = reserveBuffer(buf, len(v)*2)
-
- for _, c := range v {
-
- if c == '\'' {
-
- buf[pos] = '\''
-
- buf[pos+1] = '\''
-
- pos += 2
-
- } else {
-
- buf[pos] = c
-
- pos++
-
- }
-
- }
-
- return buf[:pos]
-
-}
-
-// escapeStringQuotes is similar to escapeBytesQuotes but for string.
-
-func escapeStringQuotes(buf []byte, v string) []byte {
-
- pos := len(buf)
-
- buf = reserveBuffer(buf, len(v)*2)
-
- for i := 0; i < len(v); i++ {
-
- c := v[i]
-
- if c == '\'' {
-
- buf[pos] = '\''
-
- buf[pos+1] = '\''
-
- pos += 2
-
- } else {
-
- buf[pos] = c
-
- pos++
-
- }
-
- }
-
- return buf[:pos]
-
-}
-
-/******************************************************************************
-
-* Sync utils *
-
-******************************************************************************/
-
-// noCopy may be embedded into structs which must not be copied
-
-// after the first use.
-
-//
-
-// See https://github.com/golang/go/issues/8005#issuecomment-190753527
-
-// for details.
-
-type noCopy struct{}
-
-// Lock is a no-op used by -copylocks checker from `go vet`.
-
-func (*noCopy) Lock() {}
-
-// atomicBool is a wrapper around uint32 for usage as a boolean value with
-
-// atomic access.
-
-type atomicBool struct {
- _noCopy noCopy
-
- value uint32
-}
-
-// IsSet returns whether the current boolean value is true
-
-func (ab *atomicBool) IsSet() bool {
-
- return atomic.LoadUint32(&ab.value) > 0
-
-}
-
-// Set sets the value of the bool regardless of the previous value
-
-func (ab *atomicBool) Set(value bool) {
-
- if value {
-
- atomic.StoreUint32(&ab.value, 1)
-
- } else {
-
- atomic.StoreUint32(&ab.value, 0)
-
- }
-
-}
-
-// TrySet sets the value of the bool and returns whether the value changed
-
-func (ab *atomicBool) TrySet(value bool) bool {
-
- if value {
-
- return atomic.SwapUint32(&ab.value, 1) == 0
-
- }
-
- return atomic.SwapUint32(&ab.value, 0) > 0
-
-}
-
-// atomicError is a wrapper for atomically accessed error values
-
-type atomicError struct {
- _noCopy noCopy
-
- value atomic.Value
-}
-
-// Set sets the error value regardless of the previous value.
-
-// The value must not be nil
-
-func (ae *atomicError) Set(value error) {
-
- ae.value.Store(value)
-
-}
-
-// Value returns the current error value
-
-func (ae *atomicError) Value() error {
-
- if v := ae.value.Load(); v != nil {
-
- // this will panic if the value doesn't implement the error interface
-
- return v.(error)
-
- }
-
- return nil
-
-}
-
-func namedValueToValue(named []driver.NamedValue) ([]driver.Value, error) {
-
- dargs := make([]driver.Value, len(named))
-
- for n, param := range named {
-
- if len(param.Name) > 0 {
-
- // TODO: support the use of Named Parameters #561
-
- return nil, errors.New("mysql: driver does not support the use of Named Parameters")
-
- }
-
- dargs[n] = param.Value
-
- }
-
- return dargs, nil
-
-}
-
-func mapIsolationLevel(level driver.IsolationLevel) (string, error) {
-
- switch sql.IsolationLevel(level) {
-
- case sql.LevelRepeatableRead:
-
- return "REPEATABLE READ", nil
-
- case sql.LevelReadCommitted:
-
- return "READ COMMITTED", nil
-
- case sql.LevelReadUncommitted:
-
- return "READ UNCOMMITTED", nil
-
- case sql.LevelSerializable:
-
- return "SERIALIZABLE", nil
-
- default:
-
- return "", fmt.Errorf("mysql: unsupported isolation level: %v", level)
-
- }
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/.gitignore b/vendor/github.com/golang-jwt/jwt/.gitignore
deleted file mode 100644
index 09573e0..0000000
--- a/vendor/github.com/golang-jwt/jwt/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.DS_Store
-bin
-.idea/
-
diff --git a/vendor/github.com/golang-jwt/jwt/LICENSE b/vendor/github.com/golang-jwt/jwt/LICENSE
deleted file mode 100644
index 35dbc25..0000000
--- a/vendor/github.com/golang-jwt/jwt/LICENSE
+++ /dev/null
@@ -1,9 +0,0 @@
-Copyright (c) 2012 Dave Grijalva
-Copyright (c) 2021 golang-jwt maintainers
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
diff --git a/vendor/github.com/golang-jwt/jwt/MIGRATION_GUIDE.md b/vendor/github.com/golang-jwt/jwt/MIGRATION_GUIDE.md
deleted file mode 100644
index c4efbd2..0000000
--- a/vendor/github.com/golang-jwt/jwt/MIGRATION_GUIDE.md
+++ /dev/null
@@ -1,22 +0,0 @@
-## Migration Guide (v3.2.1)
-
-Starting from [v3.2.1](https://github.com/golang-jwt/jwt/releases/tag/v3.2.1]), the import path has changed from `github.com/dgrijalva/jwt-go` to `github.com/golang-jwt/jwt`. Future releases will be using the `github.com/golang-jwt/jwt` import path and continue the existing versioning scheme of `v3.x.x+incompatible`. Backwards-compatible patches and fixes will be done on the `v3` release branch, where as new build-breaking features will be developed in a `v4` release, possibly including a SIV-style import path.
-
-### go.mod replacement
-
-In a first step, the easiest way is to use `go mod edit` to issue a replacement.
-
-```
-go mod edit -replace github.com/dgrijalva/jwt-go=github.com/golang-jwt/jwt@v3.2.1+incompatible
-go mod tidy
-```
-
-This will still keep the old import path in your code but replace it with the new package and also introduce a new indirect dependency to `github.com/golang-jwt/jwt`. Try to compile your project; it should still work.
-
-### Cleanup
-
-If your code still consistently builds, you can replace all occurences of `github.com/dgrijalva/jwt-go` with `github.com/golang-jwt/jwt`, either manually or by using tools such as `sed`. Finally, the `replace` directive in the `go.mod` file can be removed.
-
-## Older releases (before v3.2.0)
-
-The original migration guide for older releases can be found at https://github.com/dgrijalva/jwt-go/blob/master/MIGRATION_GUIDE.md.
\ No newline at end of file
diff --git a/vendor/github.com/golang-jwt/jwt/README.md b/vendor/github.com/golang-jwt/jwt/README.md
deleted file mode 100644
index 9b653e4..0000000
--- a/vendor/github.com/golang-jwt/jwt/README.md
+++ /dev/null
@@ -1,113 +0,0 @@
-# jwt-go
-
-[![build](https://github.com/golang-jwt/jwt/actions/workflows/build.yml/badge.svg)](https://github.com/golang-jwt/jwt/actions/workflows/build.yml)
-[![Go Reference](https://pkg.go.dev/badge/github.com/golang-jwt/jwt.svg)](https://pkg.go.dev/github.com/golang-jwt/jwt)
-
-A [go](http://www.golang.org) (or 'golang' for search engine friendliness) implementation of [JSON Web Tokens](https://datatracker.ietf.org/doc/html/rfc7519).
-
-**IMPORT PATH CHANGE:** Starting from [v3.2.1](https://github.com/golang-jwt/jwt/releases/tag/v3.2.1), the import path has changed from `github.com/dgrijalva/jwt-go` to `github.com/golang-jwt/jwt`. After the original author of the library suggested migrating the maintenance of `jwt-go`, a dedicated team of open source maintainers decided to clone the existing library into this repository. See [dgrijalva/jwt-go#462](https://github.com/dgrijalva/jwt-go/issues/462) for a detailed discussion on this topic.
-
-Future releases will be using the `github.com/golang-jwt/jwt` import path and continue the existing versioning scheme of `v3.x.x+incompatible`. Backwards-compatible patches and fixes will be done on the `v3` release branch, where as new build-breaking features will be developed in a `v4` release, possibly including a SIV-style import path.
-
-**SECURITY NOTICE:** Some older versions of Go have a security issue in the crypto/elliptic. Recommendation is to upgrade to at least 1.15 See issue [dgrijalva/jwt-go#216](https://github.com/dgrijalva/jwt-go/issues/216) for more detail.
-
-**SECURITY NOTICE:** It's important that you [validate the `alg` presented is what you expect](https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/). This library attempts to make it easy to do the right thing by requiring key types match the expected alg, but you should take the extra step to verify it in your usage. See the examples provided.
-
-### Supported Go versions
-
-Our support of Go versions is aligned with Go's [version release policy](https://golang.org/doc/devel/release#policy).
-So we will support a major version of Go until there are two newer major releases.
-We no longer support building jwt-go with unsupported Go versions, as these contain security vulnerabilities
-which will not be fixed.
-
-## What the heck is a JWT?
-
-JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web Tokens.
-
-In short, it's a signed JSON object that does something useful (for example, authentication). It's commonly used for `Bearer` tokens in Oauth 2. A token is made of three parts, separated by `.`'s. The first two parts are JSON objects, that have been [base64url](https://datatracker.ietf.org/doc/html/rfc4648) encoded. The last part is the signature, encoded the same way.
-
-The first part is called the header. It contains the necessary information for verifying the last part, the signature. For example, which encryption method was used for signing and what key was used.
-
-The part in the middle is the interesting bit. It's called the Claims and contains the actual stuff you care about. Refer to [RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519) for information about reserved keys and the proper way to add your own.
-
-## What's in the box?
-
-This library supports the parsing and verification as well as the generation and signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA, RSA-PSS, and ECDSA, though hooks are present for adding your own.
-
-## Examples
-
-See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt) for examples of usage:
-
-* [Simple example of parsing and validating a token](https://pkg.go.dev/github.com/golang-jwt/jwt#example-Parse-Hmac)
-* [Simple example of building and signing a token](https://pkg.go.dev/github.com/golang-jwt/jwt#example-New-Hmac)
-* [Directory of Examples](https://pkg.go.dev/github.com/golang-jwt/jwt#pkg-examples)
-
-## Extensions
-
-This library publishes all the necessary components for adding your own signing methods. Simply implement the `SigningMethod` interface and register a factory method using `RegisterSigningMethod`.
-
-Here's an example of an extension that integrates with multiple Google Cloud Platform signing tools (AppEngine, IAM API, Cloud KMS): https://github.com/someone1/gcp-jwt-go
-
-## Compliance
-
-This library was last reviewed to comply with [RTF 7519](https://datatracker.ietf.org/doc/html/rfc7519) dated May 2015 with a few notable differences:
-
-* In order to protect against accidental use of [Unsecured JWTs](https://datatracker.ietf.org/doc/html/rfc7519#section-6), tokens using `alg=none` will only be accepted if the constant `jwt.UnsafeAllowNoneSignatureType` is provided as the key.
-
-## Project Status & Versioning
-
-This library is considered production ready. Feedback and feature requests are appreciated. The API should be considered stable. There should be very few backwards-incompatible changes outside of major version updates (and only with good reason).
-
-This project uses [Semantic Versioning 2.0.0](http://semver.org). Accepted pull requests will land on `main`. Periodically, versions will be tagged from `main`. You can find all the releases on [the project releases page](https://github.com/golang-jwt/jwt/releases).
-
-While we try to make it obvious when we make breaking changes, there isn't a great mechanism for pushing announcements out to users. You may want to use this alternative package include: `gopkg.in/golang-jwt/jwt.v3`. It will do the right thing WRT semantic versioning.
-
-**BREAKING CHANGES:***
-* Version 3.0.0 includes _a lot_ of changes from the 2.x line, including a few that break the API. We've tried to break as few things as possible, so there should just be a few type signature changes. A full list of breaking changes is available in `VERSION_HISTORY.md`. See `MIGRATION_GUIDE.md` for more information on updating your code.
-
-## Usage Tips
-
-### Signing vs Encryption
-
-A token is simply a JSON object that is signed by its author. this tells you exactly two things about the data:
-
-* The author of the token was in the possession of the signing secret
-* The data has not been modified since it was signed
-
-It's important to know that JWT does not provide encryption, which means anyone who has access to the token can read its contents. If you need to protect (encrypt) the data, there is a companion spec, `JWE`, that provides this functionality. JWE is currently outside the scope of this library.
-
-### Choosing a Signing Method
-
-There are several signing methods available, and you should probably take the time to learn about the various options before choosing one. The principal design decision is most likely going to be symmetric vs asymmetric.
-
-Symmetric signing methods, such as HSA, use only a single secret. This is probably the simplest signing method to use since any `[]byte` can be used as a valid secret. They are also slightly computationally faster to use, though this rarely is enough to matter. Symmetric signing methods work the best when both producers and consumers of tokens are trusted, or even the same system. Since the same secret is used to both sign and validate tokens, you can't easily distribute the key for validation.
-
-Asymmetric signing methods, such as RSA, use different keys for signing and verifying tokens. This makes it possible to produce tokens with a private key, and allow any consumer to access the public key for verification.
-
-### Signing Methods and Key Types
-
-Each signing method expects a different object type for its signing keys. See the package documentation for details. Here are the most common ones:
-
-* The [HMAC signing method](https://pkg.go.dev/github.com/golang-jwt/jwt#SigningMethodHMAC) (`HS256`,`HS384`,`HS512`) expect `[]byte` values for signing and validation
-* The [RSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt#SigningMethodRSA) (`RS256`,`RS384`,`RS512`) expect `*rsa.PrivateKey` for signing and `*rsa.PublicKey` for validation
-* The [ECDSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt#SigningMethodECDSA) (`ES256`,`ES384`,`ES512`) expect `*ecdsa.PrivateKey` for signing and `*ecdsa.PublicKey` for validation
-
-### JWT and OAuth
-
-It's worth mentioning that OAuth and JWT are not the same thing. A JWT token is simply a signed JSON object. It can be used anywhere such a thing is useful. There is some confusion, though, as JWT is the most common type of bearer token used in OAuth2 authentication.
-
-Without going too far down the rabbit hole, here's a description of the interaction of these technologies:
-
-* OAuth is a protocol for allowing an identity provider to be separate from the service a user is logging in to. For example, whenever you use Facebook to log into a different service (Yelp, Spotify, etc), you are using OAuth.
-* OAuth defines several options for passing around authentication data. One popular method is called a "bearer token". A bearer token is simply a string that _should_ only be held by an authenticated user. Thus, simply presenting this token proves your identity. You can probably derive from here why a JWT might make a good bearer token.
-* Because bearer tokens are used for authentication, it's important they're kept secret. This is why transactions that use bearer tokens typically happen over SSL.
-
-### Troubleshooting
-
-This library uses descriptive error messages whenever possible. If you are not getting the expected result, have a look at the errors. The most common place people get stuck is providing the correct type of key to the parser. See the above section on signing methods and key types.
-
-## More
-
-Documentation can be found [on pkg.go.dev](https://pkg.go.dev/github.com/golang-jwt/jwt).
-
-The command line utility included in this project (cmd/jwt) provides a straightforward example of token creation and parsing as well as a useful tool for debugging your own integration. You'll also find several implementation examples in the documentation.
diff --git a/vendor/github.com/golang-jwt/jwt/VERSION_HISTORY.md b/vendor/github.com/golang-jwt/jwt/VERSION_HISTORY.md
deleted file mode 100644
index 637f2ba..0000000
--- a/vendor/github.com/golang-jwt/jwt/VERSION_HISTORY.md
+++ /dev/null
@@ -1,131 +0,0 @@
-## `jwt-go` Version History
-
-#### 3.2.2
-
-* Starting from this release, we are adopting the policy to support the most 2 recent versions of Go currently available. By the time of this release, this is Go 1.15 and 1.16 ([#28](https://github.com/golang-jwt/jwt/pull/28)).
-* Fixed a potential issue that could occur when the verification of `exp`, `iat` or `nbf` was not required and contained invalid contents, i.e. non-numeric/date. Thanks for @thaJeztah for making us aware of that and @giorgos-f3 for originally reporting it to the formtech fork ([#40](https://github.com/golang-jwt/jwt/pull/40)).
-* Added support for EdDSA / ED25519 ([#36](https://github.com/golang-jwt/jwt/pull/36)).
-* Optimized allocations ([#33](https://github.com/golang-jwt/jwt/pull/33)).
-
-#### 3.2.1
-
-* **Import Path Change**: See MIGRATION_GUIDE.md for tips on updating your code
- * Changed the import path from `github.com/dgrijalva/jwt-go` to `github.com/golang-jwt/jwt`
-* Fixed type confusing issue between `string` and `[]string` in `VerifyAudience` ([#12](https://github.com/golang-jwt/jwt/pull/12)). This fixes CVE-2020-26160
-
-#### 3.2.0
-
-* Added method `ParseUnverified` to allow users to split up the tasks of parsing and validation
-* HMAC signing method returns `ErrInvalidKeyType` instead of `ErrInvalidKey` where appropriate
-* Added options to `request.ParseFromRequest`, which allows for an arbitrary list of modifiers to parsing behavior. Initial set include `WithClaims` and `WithParser`. Existing usage of this function will continue to work as before.
-* Deprecated `ParseFromRequestWithClaims` to simplify API in the future.
-
-#### 3.1.0
-
-* Improvements to `jwt` command line tool
-* Added `SkipClaimsValidation` option to `Parser`
-* Documentation updates
-
-#### 3.0.0
-
-* **Compatibility Breaking Changes**: See MIGRATION_GUIDE.md for tips on updating your code
- * Dropped support for `[]byte` keys when using RSA signing methods. This convenience feature could contribute to security vulnerabilities involving mismatched key types with signing methods.
- * `ParseFromRequest` has been moved to `request` subpackage and usage has changed
- * The `Claims` property on `Token` is now type `Claims` instead of `map[string]interface{}`. The default value is type `MapClaims`, which is an alias to `map[string]interface{}`. This makes it possible to use a custom type when decoding claims.
-* Other Additions and Changes
- * Added `Claims` interface type to allow users to decode the claims into a custom type
- * Added `ParseWithClaims`, which takes a third argument of type `Claims`. Use this function instead of `Parse` if you have a custom type you'd like to decode into.
- * Dramatically improved the functionality and flexibility of `ParseFromRequest`, which is now in the `request` subpackage
- * Added `ParseFromRequestWithClaims` which is the `FromRequest` equivalent of `ParseWithClaims`
- * Added new interface type `Extractor`, which is used for extracting JWT strings from http requests. Used with `ParseFromRequest` and `ParseFromRequestWithClaims`.
- * Added several new, more specific, validation errors to error type bitmask
- * Moved examples from README to executable example files
- * Signing method registry is now thread safe
- * Added new property to `ValidationError`, which contains the raw error returned by calls made by parse/verify (such as those returned by keyfunc or json parser)
-
-#### 2.7.0
-
-This will likely be the last backwards compatible release before 3.0.0, excluding essential bug fixes.
-
-* Added new option `-show` to the `jwt` command that will just output the decoded token without verifying
-* Error text for expired tokens includes how long it's been expired
-* Fixed incorrect error returned from `ParseRSAPublicKeyFromPEM`
-* Documentation updates
-
-#### 2.6.0
-
-* Exposed inner error within ValidationError
-* Fixed validation errors when using UseJSONNumber flag
-* Added several unit tests
-
-#### 2.5.0
-
-* Added support for signing method none. You shouldn't use this. The API tries to make this clear.
-* Updated/fixed some documentation
-* Added more helpful error message when trying to parse tokens that begin with `BEARER `
-
-#### 2.4.0
-
-* Added new type, Parser, to allow for configuration of various parsing parameters
- * You can now specify a list of valid signing methods. Anything outside this set will be rejected.
- * You can now opt to use the `json.Number` type instead of `float64` when parsing token JSON
-* Added support for [Travis CI](https://travis-ci.org/dgrijalva/jwt-go)
-* Fixed some bugs with ECDSA parsing
-
-#### 2.3.0
-
-* Added support for ECDSA signing methods
-* Added support for RSA PSS signing methods (requires go v1.4)
-
-#### 2.2.0
-
-* Gracefully handle a `nil` `Keyfunc` being passed to `Parse`. Result will now be the parsed token and an error, instead of a panic.
-
-#### 2.1.0
-
-Backwards compatible API change that was missed in 2.0.0.
-
-* The `SignedString` method on `Token` now takes `interface{}` instead of `[]byte`
-
-#### 2.0.0
-
-There were two major reasons for breaking backwards compatibility with this update. The first was a refactor required to expand the width of the RSA and HMAC-SHA signing implementations. There will likely be no required code changes to support this change.
-
-The second update, while unfortunately requiring a small change in integration, is required to open up this library to other signing methods. Not all keys used for all signing methods have a single standard on-disk representation. Requiring `[]byte` as the type for all keys proved too limiting. Additionally, this implementation allows for pre-parsed tokens to be reused, which might matter in an application that parses a high volume of tokens with a small set of keys. Backwards compatibilty has been maintained for passing `[]byte` to the RSA signing methods, but they will also accept `*rsa.PublicKey` and `*rsa.PrivateKey`.
-
-It is likely the only integration change required here will be to change `func(t *jwt.Token) ([]byte, error)` to `func(t *jwt.Token) (interface{}, error)` when calling `Parse`.
-
-* **Compatibility Breaking Changes**
- * `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct`
- * `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct`
- * `KeyFunc` now returns `interface{}` instead of `[]byte`
- * `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key
- * `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key
-* Renamed type `SigningMethodHS256` to `SigningMethodHMAC`. Specific sizes are now just instances of this type.
- * Added public package global `SigningMethodHS256`
- * Added public package global `SigningMethodHS384`
- * Added public package global `SigningMethodHS512`
-* Renamed type `SigningMethodRS256` to `SigningMethodRSA`. Specific sizes are now just instances of this type.
- * Added public package global `SigningMethodRS256`
- * Added public package global `SigningMethodRS384`
- * Added public package global `SigningMethodRS512`
-* Moved sample private key for HMAC tests from an inline value to a file on disk. Value is unchanged.
-* Refactored the RSA implementation to be easier to read
-* Exposed helper methods `ParseRSAPrivateKeyFromPEM` and `ParseRSAPublicKeyFromPEM`
-
-#### 1.0.2
-
-* Fixed bug in parsing public keys from certificates
-* Added more tests around the parsing of keys for RS256
-* Code refactoring in RS256 implementation. No functional changes
-
-#### 1.0.1
-
-* Fixed panic if RS256 signing method was passed an invalid key
-
-#### 1.0.0
-
-* First versioned release
-* API stabilized
-* Supports creating, signing, parsing, and validating JWT tokens
-* Supports RS256 and HS256 signing methods
diff --git a/vendor/github.com/golang-jwt/jwt/claims.go b/vendor/github.com/golang-jwt/jwt/claims.go
deleted file mode 100644
index a2645dd..0000000
--- a/vendor/github.com/golang-jwt/jwt/claims.go
+++ /dev/null
@@ -1,237 +0,0 @@
-package jwt
-
-import (
- "crypto/subtle"
- "fmt"
- "time"
-)
-
-// For a type to be a Claims object, it must just have a Valid method that determines
-
-// if the token is invalid for any supported reason
-
-type Claims interface {
- Valid() error
-}
-
-// Structured version of Claims Section, as referenced at
-
-// https://tools.ietf.org/html/rfc7519#section-4.1
-
-// See examples for how to use this with your own claim types
-
-type StandardClaims struct {
- Audience string `json:"aud,omitempty"`
-
- ExpiresAt int64 `json:"exp,omitempty"`
-
- Id string `json:"jti,omitempty"`
-
- IssuedAt int64 `json:"iat,omitempty"`
-
- Issuer string `json:"iss,omitempty"`
-
- NotBefore int64 `json:"nbf,omitempty"`
-
- Subject string `json:"sub,omitempty"`
-}
-
-// Validates time based claims "exp, iat, nbf".
-
-// There is no accounting for clock skew.
-
-// As well, if any of the above claims are not in the token, it will still
-
-// be considered a valid claim.
-
-func (c StandardClaims) Valid() error {
-
- vErr := new(ValidationError)
-
- now := TimeFunc().Unix()
-
- // The claims below are optional, by default, so if they are set to the
-
- // default value in Go, let's not fail the verification for them.
-
- if !c.VerifyExpiresAt(now, false) {
-
- delta := time.Unix(now, 0).Sub(time.Unix(c.ExpiresAt, 0))
-
- vErr.Inner = fmt.Errorf("token is expired by %v", delta)
-
- vErr.Errors |= ValidationErrorExpired
-
- }
-
- if !c.VerifyIssuedAt(now, false) {
-
- vErr.Inner = fmt.Errorf("Token used before issued")
-
- vErr.Errors |= ValidationErrorIssuedAt
-
- }
-
- if !c.VerifyNotBefore(now, false) {
-
- vErr.Inner = fmt.Errorf("token is not valid yet")
-
- vErr.Errors |= ValidationErrorNotValidYet
-
- }
-
- if vErr.valid() {
-
- return nil
-
- }
-
- return vErr
-
-}
-
-// Compares the aud claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (c *StandardClaims) VerifyAudience(cmp string, req bool) bool {
-
- return verifyAud([]string{c.Audience}, cmp, req)
-
-}
-
-// Compares the exp claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (c *StandardClaims) VerifyExpiresAt(cmp int64, req bool) bool {
-
- return verifyExp(c.ExpiresAt, cmp, req)
-
-}
-
-// Compares the iat claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (c *StandardClaims) VerifyIssuedAt(cmp int64, req bool) bool {
-
- return verifyIat(c.IssuedAt, cmp, req)
-
-}
-
-// Compares the iss claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (c *StandardClaims) VerifyIssuer(cmp string, req bool) bool {
-
- return verifyIss(c.Issuer, cmp, req)
-
-}
-
-// Compares the nbf claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (c *StandardClaims) VerifyNotBefore(cmp int64, req bool) bool {
-
- return verifyNbf(c.NotBefore, cmp, req)
-
-}
-
-// ----- helpers
-
-func verifyAud(aud []string, cmp string, required bool) bool {
-
- if len(aud) == 0 {
-
- return !required
-
- }
-
- // use a var here to keep constant time compare when looping over a number of claims
-
- result := false
-
- var stringClaims string
-
- for _, a := range aud {
-
- if subtle.ConstantTimeCompare([]byte(a), []byte(cmp)) != 0 {
-
- result = true
-
- }
-
- stringClaims = stringClaims + a
-
- }
-
- // case where "" is sent in one or many aud claims
-
- if len(stringClaims) == 0 {
-
- return !required
-
- }
-
- return result
-
-}
-
-func verifyExp(exp int64, now int64, required bool) bool {
-
- if exp == 0 {
-
- return !required
-
- }
-
- return now <= exp
-
-}
-
-func verifyIat(iat int64, now int64, required bool) bool {
-
- if iat == 0 {
-
- return !required
-
- }
-
- return now >= iat
-
-}
-
-func verifyIss(iss string, cmp string, required bool) bool {
-
- if iss == "" {
-
- return !required
-
- }
-
- if subtle.ConstantTimeCompare([]byte(iss), []byte(cmp)) != 0 {
-
- return true
-
- } else {
-
- return false
-
- }
-
-}
-
-func verifyNbf(nbf int64, now int64, required bool) bool {
-
- if nbf == 0 {
-
- return !required
-
- }
-
- return now >= nbf
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/doc.go b/vendor/github.com/golang-jwt/jwt/doc.go
deleted file mode 100644
index a86dc1a..0000000
--- a/vendor/github.com/golang-jwt/jwt/doc.go
+++ /dev/null
@@ -1,4 +0,0 @@
-// Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html
-//
-// See README.md for more info.
-package jwt
diff --git a/vendor/github.com/golang-jwt/jwt/ecdsa.go b/vendor/github.com/golang-jwt/jwt/ecdsa.go
deleted file mode 100644
index 6cfc5f3..0000000
--- a/vendor/github.com/golang-jwt/jwt/ecdsa.go
+++ /dev/null
@@ -1,224 +0,0 @@
-package jwt
-
-import (
- "crypto"
- "crypto/ecdsa"
- "crypto/rand"
- "errors"
- "math/big"
-)
-
-var (
-
- // Sadly this is missing from crypto/ecdsa compared to crypto/rsa
-
- ErrECDSAVerification = errors.New("crypto/ecdsa: verification error")
-)
-
-// Implements the ECDSA family of signing methods signing methods
-
-// Expects *ecdsa.PrivateKey for signing and *ecdsa.PublicKey for verification
-
-type SigningMethodECDSA struct {
- Name string
-
- Hash crypto.Hash
-
- KeySize int
-
- CurveBits int
-}
-
-// Specific instances for EC256 and company
-
-var (
- SigningMethodES256 *SigningMethodECDSA
-
- SigningMethodES384 *SigningMethodECDSA
-
- SigningMethodES512 *SigningMethodECDSA
-)
-
-func init() {
-
- // ES256
-
- SigningMethodES256 = &SigningMethodECDSA{"ES256", crypto.SHA256, 32, 256}
-
- RegisterSigningMethod(SigningMethodES256.Alg(), func() SigningMethod {
-
- return SigningMethodES256
-
- })
-
- // ES384
-
- SigningMethodES384 = &SigningMethodECDSA{"ES384", crypto.SHA384, 48, 384}
-
- RegisterSigningMethod(SigningMethodES384.Alg(), func() SigningMethod {
-
- return SigningMethodES384
-
- })
-
- // ES512
-
- SigningMethodES512 = &SigningMethodECDSA{"ES512", crypto.SHA512, 66, 521}
-
- RegisterSigningMethod(SigningMethodES512.Alg(), func() SigningMethod {
-
- return SigningMethodES512
-
- })
-
-}
-
-func (m *SigningMethodECDSA) Alg() string {
-
- return m.Name
-
-}
-
-// Implements the Verify method from SigningMethod
-
-// For this verify method, key must be an ecdsa.PublicKey struct
-
-func (m *SigningMethodECDSA) Verify(signingString, signature string, key interface{}) error {
-
- var err error
-
- // Decode the signature
-
- var sig []byte
-
- if sig, err = DecodeSegment(signature); err != nil {
-
- return err
-
- }
-
- // Get the key
-
- var ecdsaKey *ecdsa.PublicKey
-
- switch k := key.(type) {
-
- case *ecdsa.PublicKey:
-
- ecdsaKey = k
-
- default:
-
- return ErrInvalidKeyType
-
- }
-
- if len(sig) != 2*m.KeySize {
-
- return ErrECDSAVerification
-
- }
-
- r := big.NewInt(0).SetBytes(sig[:m.KeySize])
-
- s := big.NewInt(0).SetBytes(sig[m.KeySize:])
-
- // Create hasher
-
- if !m.Hash.Available() {
-
- return ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Verify the signature
-
- if verifystatus := ecdsa.Verify(ecdsaKey, hasher.Sum(nil), r, s); verifystatus {
-
- return nil
-
- }
-
- return ErrECDSAVerification
-
-}
-
-// Implements the Sign method from SigningMethod
-
-// For this signing method, key must be an ecdsa.PrivateKey struct
-
-func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) (string, error) {
-
- // Get the key
-
- var ecdsaKey *ecdsa.PrivateKey
-
- switch k := key.(type) {
-
- case *ecdsa.PrivateKey:
-
- ecdsaKey = k
-
- default:
-
- return "", ErrInvalidKeyType
-
- }
-
- // Create the hasher
-
- if !m.Hash.Available() {
-
- return "", ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Sign the string and return r, s
-
- if r, s, err := ecdsa.Sign(rand.Reader, ecdsaKey, hasher.Sum(nil)); err == nil {
-
- curveBits := ecdsaKey.Curve.Params().BitSize
-
- if m.CurveBits != curveBits {
-
- return "", ErrInvalidKey
-
- }
-
- keyBytes := curveBits / 8
-
- if curveBits%8 > 0 {
-
- keyBytes += 1
-
- }
-
- // We serialize the outputs (r and s) into big-endian byte arrays
-
- // padded with zeros on the left to make sure the sizes work out.
-
- // Output must be 2*keyBytes long.
-
- out := make([]byte, 2*keyBytes)
-
- r.FillBytes(out[0:keyBytes]) // r is assigned to the first half of output.
-
- s.FillBytes(out[keyBytes:]) // s is assigned to the second half of output.
-
- return EncodeSegment(out), nil
-
- } else {
-
- return "", err
-
- }
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/ecdsa_utils.go b/vendor/github.com/golang-jwt/jwt/ecdsa_utils.go
deleted file mode 100644
index b126a25..0000000
--- a/vendor/github.com/golang-jwt/jwt/ecdsa_utils.go
+++ /dev/null
@@ -1,106 +0,0 @@
-package jwt
-
-import (
- "crypto/ecdsa"
- "crypto/x509"
- "encoding/pem"
- "errors"
-)
-
-var (
- ErrNotECPublicKey = errors.New("Key is not a valid ECDSA public key")
-
- ErrNotECPrivateKey = errors.New("Key is not a valid ECDSA private key")
-)
-
-// Parse PEM encoded Elliptic Curve Private Key Structure
-
-func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil {
-
- if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
-
- return nil, err
-
- }
-
- }
-
- var pkey *ecdsa.PrivateKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok {
-
- return nil, ErrNotECPrivateKey
-
- }
-
- return pkey, nil
-
-}
-
-// Parse PEM encoded PKCS1 or PKCS8 public key
-
-func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
-
- if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
-
- parsedKey = cert.PublicKey
-
- } else {
-
- return nil, err
-
- }
-
- }
-
- var pkey *ecdsa.PublicKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok {
-
- return nil, ErrNotECPublicKey
-
- }
-
- return pkey, nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/ed25519.go b/vendor/github.com/golang-jwt/jwt/ed25519.go
deleted file mode 100644
index 2cf9928..0000000
--- a/vendor/github.com/golang-jwt/jwt/ed25519.go
+++ /dev/null
@@ -1,120 +0,0 @@
-package jwt
-
-import (
- "crypto/ed25519"
- "errors"
-)
-
-var (
- ErrEd25519Verification = errors.New("ed25519: verification error")
-)
-
-// Implements the EdDSA family
-
-// Expects ed25519.PrivateKey for signing and ed25519.PublicKey for verification
-
-type SigningMethodEd25519 struct{}
-
-// Specific instance for EdDSA
-
-var (
- SigningMethodEdDSA *SigningMethodEd25519
-)
-
-func init() {
-
- SigningMethodEdDSA = &SigningMethodEd25519{}
-
- RegisterSigningMethod(SigningMethodEdDSA.Alg(), func() SigningMethod {
-
- return SigningMethodEdDSA
-
- })
-
-}
-
-func (m *SigningMethodEd25519) Alg() string {
-
- return "EdDSA"
-
-}
-
-// Implements the Verify method from SigningMethod
-
-// For this verify method, key must be an ed25519.PublicKey
-
-func (m *SigningMethodEd25519) Verify(signingString, signature string, key interface{}) error {
-
- var err error
-
- var ed25519Key ed25519.PublicKey
-
- var ok bool
-
- if ed25519Key, ok = key.(ed25519.PublicKey); !ok {
-
- return ErrInvalidKeyType
-
- }
-
- if len(ed25519Key) != ed25519.PublicKeySize {
-
- return ErrInvalidKey
-
- }
-
- // Decode the signature
-
- var sig []byte
-
- if sig, err = DecodeSegment(signature); err != nil {
-
- return err
-
- }
-
- // Verify the signature
-
- if !ed25519.Verify(ed25519Key, []byte(signingString), sig) {
-
- return ErrEd25519Verification
-
- }
-
- return nil
-
-}
-
-// Implements the Sign method from SigningMethod
-
-// For this signing method, key must be an ed25519.PrivateKey
-
-func (m *SigningMethodEd25519) Sign(signingString string, key interface{}) (string, error) {
-
- var ed25519Key ed25519.PrivateKey
-
- var ok bool
-
- if ed25519Key, ok = key.(ed25519.PrivateKey); !ok {
-
- return "", ErrInvalidKeyType
-
- }
-
- // ed25519.Sign panics if private key not equal to ed25519.PrivateKeySize
-
- // this allows to avoid recover usage
-
- if len(ed25519Key) != ed25519.PrivateKeySize {
-
- return "", ErrInvalidKey
-
- }
-
- // Sign the string and return the encoded result
-
- sig := ed25519.Sign(ed25519Key, []byte(signingString))
-
- return EncodeSegment(sig), nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/ed25519_utils.go b/vendor/github.com/golang-jwt/jwt/ed25519_utils.go
deleted file mode 100644
index a738a0a..0000000
--- a/vendor/github.com/golang-jwt/jwt/ed25519_utils.go
+++ /dev/null
@@ -1,95 +0,0 @@
-package jwt
-
-import (
- "crypto"
- "crypto/ed25519"
- "crypto/x509"
- "encoding/pem"
- "errors"
-)
-
-var (
- ErrNotEdPrivateKey = errors.New("Key is not a valid Ed25519 private key")
-
- ErrNotEdPublicKey = errors.New("Key is not a valid Ed25519 public key")
-)
-
-// Parse PEM-encoded Edwards curve private key
-
-func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
-
- return nil, err
-
- }
-
- var pkey ed25519.PrivateKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(ed25519.PrivateKey); !ok {
-
- return nil, ErrNotEdPrivateKey
-
- }
-
- return pkey, nil
-
-}
-
-// Parse PEM-encoded Edwards curve public key
-
-func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
-
- return nil, err
-
- }
-
- var pkey ed25519.PublicKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(ed25519.PublicKey); !ok {
-
- return nil, ErrNotEdPublicKey
-
- }
-
- return pkey, nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/errors.go b/vendor/github.com/golang-jwt/jwt/errors.go
deleted file mode 100644
index 1c93024..0000000
--- a/vendor/github.com/golang-jwt/jwt/errors.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package jwt
-
-import (
- "errors"
-)
-
-// Error constants
-var (
- ErrInvalidKey = errors.New("key is invalid")
- ErrInvalidKeyType = errors.New("key is of invalid type")
- ErrHashUnavailable = errors.New("the requested hash function is unavailable")
-)
-
-// The errors that might occur when parsing and validating a token
-const (
- ValidationErrorMalformed uint32 = 1 << iota // Token is malformed
- ValidationErrorUnverifiable // Token could not be verified because of signing problems
- ValidationErrorSignatureInvalid // Signature validation failed
-
- // Standard Claim validation errors
- ValidationErrorAudience // AUD validation failed
- ValidationErrorExpired // EXP validation failed
- ValidationErrorIssuedAt // IAT validation failed
- ValidationErrorIssuer // ISS validation failed
- ValidationErrorNotValidYet // NBF validation failed
- ValidationErrorId // JTI validation failed
- ValidationErrorClaimsInvalid // Generic claims validation error
-)
-
-// Helper for constructing a ValidationError with a string error message
-func NewValidationError(errorText string, errorFlags uint32) *ValidationError {
- return &ValidationError{
- text: errorText,
- Errors: errorFlags,
- }
-}
-
-// The error from Parse if token is not valid
-type ValidationError struct {
- Inner error // stores the error returned by external dependencies, i.e.: KeyFunc
- Errors uint32 // bitfield. see ValidationError... constants
- text string // errors that do not have a valid error just have text
-}
-
-// Validation error is an error type
-func (e ValidationError) Error() string {
- if e.Inner != nil {
- return e.Inner.Error()
- } else if e.text != "" {
- return e.text
- } else {
- return "token is invalid"
- }
-}
-
-// No errors
-func (e *ValidationError) valid() bool {
- return e.Errors == 0
-}
diff --git a/vendor/github.com/golang-jwt/jwt/hmac.go b/vendor/github.com/golang-jwt/jwt/hmac.go
deleted file mode 100644
index 0321cf8..0000000
--- a/vendor/github.com/golang-jwt/jwt/hmac.go
+++ /dev/null
@@ -1,149 +0,0 @@
-package jwt
-
-import (
- "crypto"
- "crypto/hmac"
- "errors"
-)
-
-// Implements the HMAC-SHA family of signing methods signing methods
-
-// Expects key type of []byte for both signing and validation
-
-type SigningMethodHMAC struct {
- Name string
-
- Hash crypto.Hash
-}
-
-// Specific instances for HS256 and company
-
-var (
- SigningMethodHS256 *SigningMethodHMAC
-
- SigningMethodHS384 *SigningMethodHMAC
-
- SigningMethodHS512 *SigningMethodHMAC
-
- ErrSignatureInvalid = errors.New("signature is invalid")
-)
-
-func init() {
-
- // HS256
-
- SigningMethodHS256 = &SigningMethodHMAC{"HS256", crypto.SHA256}
-
- RegisterSigningMethod(SigningMethodHS256.Alg(), func() SigningMethod {
-
- return SigningMethodHS256
-
- })
-
- // HS384
-
- SigningMethodHS384 = &SigningMethodHMAC{"HS384", crypto.SHA384}
-
- RegisterSigningMethod(SigningMethodHS384.Alg(), func() SigningMethod {
-
- return SigningMethodHS384
-
- })
-
- // HS512
-
- SigningMethodHS512 = &SigningMethodHMAC{"HS512", crypto.SHA512}
-
- RegisterSigningMethod(SigningMethodHS512.Alg(), func() SigningMethod {
-
- return SigningMethodHS512
-
- })
-
-}
-
-func (m *SigningMethodHMAC) Alg() string {
-
- return m.Name
-
-}
-
-// Verify the signature of HSXXX tokens. Returns nil if the signature is valid.
-
-func (m *SigningMethodHMAC) Verify(signingString, signature string, key interface{}) error {
-
- // Verify the key is the right type
-
- keyBytes, ok := key.([]byte)
-
- if !ok {
-
- return ErrInvalidKeyType
-
- }
-
- // Decode signature, for comparison
-
- sig, err := DecodeSegment(signature)
-
- if err != nil {
-
- return err
-
- }
-
- // Can we use the specified hashing method?
-
- if !m.Hash.Available() {
-
- return ErrHashUnavailable
-
- }
-
- // This signing method is symmetric, so we validate the signature
-
- // by reproducing the signature from the signing string and key, then
-
- // comparing that against the provided signature.
-
- hasher := hmac.New(m.Hash.New, keyBytes)
-
- hasher.Write([]byte(signingString))
-
- if !hmac.Equal(sig, hasher.Sum(nil)) {
-
- return ErrSignatureInvalid
-
- }
-
- // No validation errors. Signature is good.
-
- return nil
-
-}
-
-// Implements the Sign method from SigningMethod for this signing method.
-
-// Key must be []byte
-
-func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) (string, error) {
-
- if keyBytes, ok := key.([]byte); ok {
-
- if !m.Hash.Available() {
-
- return "", ErrHashUnavailable
-
- }
-
- hasher := hmac.New(m.Hash.New, keyBytes)
-
- hasher.Write([]byte(signingString))
-
- return EncodeSegment(hasher.Sum(nil)), nil
-
- }
-
- return "", ErrInvalidKeyType
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/map_claims.go b/vendor/github.com/golang-jwt/jwt/map_claims.go
deleted file mode 100644
index bafbbd8..0000000
--- a/vendor/github.com/golang-jwt/jwt/map_claims.go
+++ /dev/null
@@ -1,208 +0,0 @@
-package jwt
-
-import (
- "encoding/json"
- "errors"
-)
-
-// Claims type that uses the map[string]interface{} for JSON decoding
-
-// This is the default claims type if you don't supply one
-
-type MapClaims map[string]interface{}
-
-// VerifyAudience Compares the aud claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (m MapClaims) VerifyAudience(cmp string, req bool) bool {
-
- var aud []string
-
- switch v := m["aud"].(type) {
-
- case string:
-
- aud = append(aud, v)
-
- case []string:
-
- aud = v
-
- case []interface{}:
-
- for _, a := range v {
-
- vs, ok := a.(string)
-
- if !ok {
-
- return false
-
- }
-
- aud = append(aud, vs)
-
- }
-
- }
-
- return verifyAud(aud, cmp, req)
-
-}
-
-// Compares the exp claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool {
-
- exp, ok := m["exp"]
-
- if !ok {
-
- return !req
-
- }
-
- switch expType := exp.(type) {
-
- case float64:
-
- return verifyExp(int64(expType), cmp, req)
-
- case json.Number:
-
- v, _ := expType.Int64()
-
- return verifyExp(v, cmp, req)
-
- }
-
- return false
-
-}
-
-// Compares the iat claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (m MapClaims) VerifyIssuedAt(cmp int64, req bool) bool {
-
- iat, ok := m["iat"]
-
- if !ok {
-
- return !req
-
- }
-
- switch iatType := iat.(type) {
-
- case float64:
-
- return verifyIat(int64(iatType), cmp, req)
-
- case json.Number:
-
- v, _ := iatType.Int64()
-
- return verifyIat(v, cmp, req)
-
- }
-
- return false
-
-}
-
-// Compares the iss claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (m MapClaims) VerifyIssuer(cmp string, req bool) bool {
-
- iss, _ := m["iss"].(string)
-
- return verifyIss(iss, cmp, req)
-
-}
-
-// Compares the nbf claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (m MapClaims) VerifyNotBefore(cmp int64, req bool) bool {
-
- nbf, ok := m["nbf"]
-
- if !ok {
-
- return !req
-
- }
-
- switch nbfType := nbf.(type) {
-
- case float64:
-
- return verifyNbf(int64(nbfType), cmp, req)
-
- case json.Number:
-
- v, _ := nbfType.Int64()
-
- return verifyNbf(v, cmp, req)
-
- }
-
- return false
-
-}
-
-// Validates time based claims "exp, iat, nbf".
-
-// There is no accounting for clock skew.
-
-// As well, if any of the above claims are not in the token, it will still
-
-// be considered a valid claim.
-
-func (m MapClaims) Valid() error {
-
- vErr := new(ValidationError)
-
- now := TimeFunc().Unix()
-
- if !m.VerifyExpiresAt(now, false) {
-
- vErr.Inner = errors.New("Token is expired")
-
- vErr.Errors |= ValidationErrorExpired
-
- }
-
- if !m.VerifyIssuedAt(now, false) {
-
- vErr.Inner = errors.New("Token used before issued")
-
- vErr.Errors |= ValidationErrorIssuedAt
-
- }
-
- if !m.VerifyNotBefore(now, false) {
-
- vErr.Inner = errors.New("Token is not valid yet")
-
- vErr.Errors |= ValidationErrorNotValidYet
-
- }
-
- if vErr.valid() {
-
- return nil
-
- }
-
- return vErr
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/none.go b/vendor/github.com/golang-jwt/jwt/none.go
deleted file mode 100644
index f04d189..0000000
--- a/vendor/github.com/golang-jwt/jwt/none.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package jwt
-
-// Implements the none signing method. This is required by the spec
-// but you probably should never use it.
-var SigningMethodNone *signingMethodNone
-
-const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed"
-
-var NoneSignatureTypeDisallowedError error
-
-type signingMethodNone struct{}
-type unsafeNoneMagicConstant string
-
-func init() {
- SigningMethodNone = &signingMethodNone{}
- NoneSignatureTypeDisallowedError = NewValidationError("'none' signature type is not allowed", ValidationErrorSignatureInvalid)
-
- RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod {
- return SigningMethodNone
- })
-}
-
-func (m *signingMethodNone) Alg() string {
- return "none"
-}
-
-// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key
-func (m *signingMethodNone) Verify(signingString, signature string, key interface{}) (err error) {
- // Key must be UnsafeAllowNoneSignatureType to prevent accidentally
- // accepting 'none' signing method
- if _, ok := key.(unsafeNoneMagicConstant); !ok {
- return NoneSignatureTypeDisallowedError
- }
- // If signing method is none, signature must be an empty string
- if signature != "" {
- return NewValidationError(
- "'none' signing method with non-empty signature",
- ValidationErrorSignatureInvalid,
- )
- }
-
- // Accept 'none' signing method.
- return nil
-}
-
-// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key
-func (m *signingMethodNone) Sign(signingString string, key interface{}) (string, error) {
- if _, ok := key.(unsafeNoneMagicConstant); ok {
- return "", nil
- }
- return "", NoneSignatureTypeDisallowedError
-}
diff --git a/vendor/github.com/golang-jwt/jwt/parser.go b/vendor/github.com/golang-jwt/jwt/parser.go
deleted file mode 100644
index 70f0ca2..0000000
--- a/vendor/github.com/golang-jwt/jwt/parser.go
+++ /dev/null
@@ -1,251 +0,0 @@
-package jwt
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "strings"
-)
-
-type Parser struct {
- ValidMethods []string // If populated, only these methods will be considered valid
-
- UseJSONNumber bool // Use JSON Number format in JSON decoder
-
- SkipClaimsValidation bool // Skip claims validation during token parsing
-
-}
-
-// Parse, validate, and return a token.
-
-// keyFunc will receive the parsed token and should return the key for validating.
-
-// If everything is kosher, err will be nil
-
-func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
-
- return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc)
-
-}
-
-func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) {
-
- token, parts, err := p.ParseUnverified(tokenString, claims)
-
- if err != nil {
-
- return token, err
-
- }
-
- // Verify signing method is in the required set
-
- if p.ValidMethods != nil {
-
- var signingMethodValid = false
-
- var alg = token.Method.Alg()
-
- for _, m := range p.ValidMethods {
-
- if m == alg {
-
- signingMethodValid = true
-
- break
-
- }
-
- }
-
- if !signingMethodValid {
-
- // signing method is not in the listed set
-
- return token, NewValidationError(fmt.Sprintf("signing method %v is invalid", alg), ValidationErrorSignatureInvalid)
-
- }
-
- }
-
- // Lookup key
-
- var key interface{}
-
- if keyFunc == nil {
-
- // keyFunc was not provided. short circuiting validation
-
- return token, NewValidationError("no Keyfunc was provided.", ValidationErrorUnverifiable)
-
- }
-
- if key, err = keyFunc(token); err != nil {
-
- // keyFunc returned an error
-
- if ve, ok := err.(*ValidationError); ok {
-
- return token, ve
-
- }
-
- return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable}
-
- }
-
- vErr := &ValidationError{}
-
- // Validate Claims
-
- if !p.SkipClaimsValidation {
-
- if err := token.Claims.Valid(); err != nil {
-
- // If the Claims Valid returned an error, check if it is a validation error,
-
- // If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set
-
- if e, ok := err.(*ValidationError); !ok {
-
- vErr = &ValidationError{Inner: err, Errors: ValidationErrorClaimsInvalid}
-
- } else {
-
- vErr = e
-
- }
-
- }
-
- }
-
- // Perform validation
-
- token.Signature = parts[2]
-
- if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
-
- vErr.Inner = err
-
- vErr.Errors |= ValidationErrorSignatureInvalid
-
- }
-
- if vErr.valid() {
-
- token.Valid = true
-
- return token, nil
-
- }
-
- return token, vErr
-
-}
-
-// WARNING: Don't use this method unless you know what you're doing
-
-//
-
-// This method parses the token but doesn't validate the signature. It's only
-
-// ever useful in cases where you know the signature is valid (because it has
-
-// been checked previously in the stack) and you want to extract values from
-
-// it.
-
-func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error) {
-
- parts = strings.Split(tokenString, ".")
-
- if len(parts) != 3 {
-
- return nil, parts, NewValidationError("token contains an invalid number of segments", ValidationErrorMalformed)
-
- }
-
- token = &Token{Raw: tokenString}
-
- // parse Header
-
- var headerBytes []byte
-
- if headerBytes, err = DecodeSegment(parts[0]); err != nil {
-
- if strings.HasPrefix(strings.ToLower(tokenString), "bearer ") {
-
- return token, parts, NewValidationError("tokenstring should not contain 'bearer '", ValidationErrorMalformed)
-
- }
-
- return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
-
- }
-
- if err = json.Unmarshal(headerBytes, &token.Header); err != nil {
-
- return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
-
- }
-
- // parse Claims
-
- var claimBytes []byte
-
- token.Claims = claims
-
- if claimBytes, err = DecodeSegment(parts[1]); err != nil {
-
- return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
-
- }
-
- dec := json.NewDecoder(bytes.NewBuffer(claimBytes))
-
- if p.UseJSONNumber {
-
- dec.UseNumber()
-
- }
-
- // JSON Decode. Special case for map type to avoid weird pointer behavior
-
- if c, ok := token.Claims.(MapClaims); ok {
-
- err = dec.Decode(&c)
-
- } else {
-
- err = dec.Decode(&claims)
-
- }
-
- // Handle decode error
-
- if err != nil {
-
- return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
-
- }
-
- // Lookup signature method
-
- if method, ok := token.Header["alg"].(string); ok {
-
- if token.Method = GetSigningMethod(method); token.Method == nil {
-
- return token, parts, NewValidationError("signing method (alg) is unavailable.", ValidationErrorUnverifiable)
-
- }
-
- } else {
-
- return token, parts, NewValidationError("signing method (alg) is unspecified.", ValidationErrorUnverifiable)
-
- }
-
- return token, parts, nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/rsa.go b/vendor/github.com/golang-jwt/jwt/rsa.go
deleted file mode 100644
index b63546b..0000000
--- a/vendor/github.com/golang-jwt/jwt/rsa.go
+++ /dev/null
@@ -1,157 +0,0 @@
-package jwt
-
-import (
- "crypto"
- "crypto/rand"
- "crypto/rsa"
-)
-
-// Implements the RSA family of signing methods signing methods
-
-// Expects *rsa.PrivateKey for signing and *rsa.PublicKey for validation
-
-type SigningMethodRSA struct {
- Name string
-
- Hash crypto.Hash
-}
-
-// Specific instances for RS256 and company
-
-var (
- SigningMethodRS256 *SigningMethodRSA
-
- SigningMethodRS384 *SigningMethodRSA
-
- SigningMethodRS512 *SigningMethodRSA
-)
-
-func init() {
-
- // RS256
-
- SigningMethodRS256 = &SigningMethodRSA{"RS256", crypto.SHA256}
-
- RegisterSigningMethod(SigningMethodRS256.Alg(), func() SigningMethod {
-
- return SigningMethodRS256
-
- })
-
- // RS384
-
- SigningMethodRS384 = &SigningMethodRSA{"RS384", crypto.SHA384}
-
- RegisterSigningMethod(SigningMethodRS384.Alg(), func() SigningMethod {
-
- return SigningMethodRS384
-
- })
-
- // RS512
-
- SigningMethodRS512 = &SigningMethodRSA{"RS512", crypto.SHA512}
-
- RegisterSigningMethod(SigningMethodRS512.Alg(), func() SigningMethod {
-
- return SigningMethodRS512
-
- })
-
-}
-
-func (m *SigningMethodRSA) Alg() string {
-
- return m.Name
-
-}
-
-// Implements the Verify method from SigningMethod
-
-// For this signing method, must be an *rsa.PublicKey structure.
-
-func (m *SigningMethodRSA) Verify(signingString, signature string, key interface{}) error {
-
- var err error
-
- // Decode the signature
-
- var sig []byte
-
- if sig, err = DecodeSegment(signature); err != nil {
-
- return err
-
- }
-
- var rsaKey *rsa.PublicKey
-
- var ok bool
-
- if rsaKey, ok = key.(*rsa.PublicKey); !ok {
-
- return ErrInvalidKeyType
-
- }
-
- // Create hasher
-
- if !m.Hash.Available() {
-
- return ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Verify the signature
-
- return rsa.VerifyPKCS1v15(rsaKey, m.Hash, hasher.Sum(nil), sig)
-
-}
-
-// Implements the Sign method from SigningMethod
-
-// For this signing method, must be an *rsa.PrivateKey structure.
-
-func (m *SigningMethodRSA) Sign(signingString string, key interface{}) (string, error) {
-
- var rsaKey *rsa.PrivateKey
-
- var ok bool
-
- // Validate type of key
-
- if rsaKey, ok = key.(*rsa.PrivateKey); !ok {
-
- return "", ErrInvalidKey
-
- }
-
- // Create the hasher
-
- if !m.Hash.Available() {
-
- return "", ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Sign the string and return the encoded bytes
-
- if sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil {
-
- return EncodeSegment(sigBytes), nil
-
- } else {
-
- return "", err
-
- }
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/rsa_pss.go b/vendor/github.com/golang-jwt/jwt/rsa_pss.go
deleted file mode 100644
index 61deea4..0000000
--- a/vendor/github.com/golang-jwt/jwt/rsa_pss.go
+++ /dev/null
@@ -1,228 +0,0 @@
-//go:build go1.4
-// +build go1.4
-
-package jwt
-
-import (
- "crypto"
- "crypto/rand"
- "crypto/rsa"
-)
-
-// Implements the RSAPSS family of signing methods signing methods
-
-type SigningMethodRSAPSS struct {
- *SigningMethodRSA
-
- Options *rsa.PSSOptions
-
- // VerifyOptions is optional. If set overrides Options for rsa.VerifyPPS.
-
- // Used to accept tokens signed with rsa.PSSSaltLengthAuto, what doesn't follow
-
- // https://tools.ietf.org/html/rfc7518#section-3.5 but was used previously.
-
- // See https://github.com/dgrijalva/jwt-go/issues/285#issuecomment-437451244 for details.
-
- VerifyOptions *rsa.PSSOptions
-}
-
-// Specific instances for RS/PS and company.
-
-var (
- SigningMethodPS256 *SigningMethodRSAPSS
-
- SigningMethodPS384 *SigningMethodRSAPSS
-
- SigningMethodPS512 *SigningMethodRSAPSS
-)
-
-func init() {
-
- // PS256
-
- SigningMethodPS256 = &SigningMethodRSAPSS{
-
- SigningMethodRSA: &SigningMethodRSA{
-
- Name: "PS256",
-
- Hash: crypto.SHA256,
- },
-
- Options: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthEqualsHash,
- },
-
- VerifyOptions: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthAuto,
- },
- }
-
- RegisterSigningMethod(SigningMethodPS256.Alg(), func() SigningMethod {
-
- return SigningMethodPS256
-
- })
-
- // PS384
-
- SigningMethodPS384 = &SigningMethodRSAPSS{
-
- SigningMethodRSA: &SigningMethodRSA{
-
- Name: "PS384",
-
- Hash: crypto.SHA384,
- },
-
- Options: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthEqualsHash,
- },
-
- VerifyOptions: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthAuto,
- },
- }
-
- RegisterSigningMethod(SigningMethodPS384.Alg(), func() SigningMethod {
-
- return SigningMethodPS384
-
- })
-
- // PS512
-
- SigningMethodPS512 = &SigningMethodRSAPSS{
-
- SigningMethodRSA: &SigningMethodRSA{
-
- Name: "PS512",
-
- Hash: crypto.SHA512,
- },
-
- Options: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthEqualsHash,
- },
-
- VerifyOptions: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthAuto,
- },
- }
-
- RegisterSigningMethod(SigningMethodPS512.Alg(), func() SigningMethod {
-
- return SigningMethodPS512
-
- })
-
-}
-
-// Implements the Verify method from SigningMethod
-
-// For this verify method, key must be an rsa.PublicKey struct
-
-func (m *SigningMethodRSAPSS) Verify(signingString, signature string, key interface{}) error {
-
- var err error
-
- // Decode the signature
-
- var sig []byte
-
- if sig, err = DecodeSegment(signature); err != nil {
-
- return err
-
- }
-
- var rsaKey *rsa.PublicKey
-
- switch k := key.(type) {
-
- case *rsa.PublicKey:
-
- rsaKey = k
-
- default:
-
- return ErrInvalidKey
-
- }
-
- // Create hasher
-
- if !m.Hash.Available() {
-
- return ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- opts := m.Options
-
- if m.VerifyOptions != nil {
-
- opts = m.VerifyOptions
-
- }
-
- return rsa.VerifyPSS(rsaKey, m.Hash, hasher.Sum(nil), sig, opts)
-
-}
-
-// Implements the Sign method from SigningMethod
-
-// For this signing method, key must be an rsa.PrivateKey struct
-
-func (m *SigningMethodRSAPSS) Sign(signingString string, key interface{}) (string, error) {
-
- var rsaKey *rsa.PrivateKey
-
- switch k := key.(type) {
-
- case *rsa.PrivateKey:
-
- rsaKey = k
-
- default:
-
- return "", ErrInvalidKeyType
-
- }
-
- // Create the hasher
-
- if !m.Hash.Available() {
-
- return "", ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Sign the string and return the encoded bytes
-
- if sigBytes, err := rsa.SignPSS(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil), m.Options); err == nil {
-
- return EncodeSegment(sigBytes), nil
-
- } else {
-
- return "", err
-
- }
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/rsa_utils.go b/vendor/github.com/golang-jwt/jwt/rsa_utils.go
deleted file mode 100644
index 83625ba..0000000
--- a/vendor/github.com/golang-jwt/jwt/rsa_utils.go
+++ /dev/null
@@ -1,156 +0,0 @@
-package jwt
-
-import (
- "crypto/rsa"
- "crypto/x509"
- "encoding/pem"
- "errors"
-)
-
-var (
- ErrKeyMustBePEMEncoded = errors.New("Invalid Key: Key must be a PEM encoded PKCS1 or PKCS8 key")
-
- ErrNotRSAPrivateKey = errors.New("Key is not a valid RSA private key")
-
- ErrNotRSAPublicKey = errors.New("Key is not a valid RSA public key")
-)
-
-// Parse PEM encoded PKCS1 or PKCS8 private key
-
-func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil {
-
- if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
-
- return nil, err
-
- }
-
- }
-
- var pkey *rsa.PrivateKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok {
-
- return nil, ErrNotRSAPrivateKey
-
- }
-
- return pkey, nil
-
-}
-
-// Parse PEM encoded PKCS1 or PKCS8 private key protected with password
-
-func ParseRSAPrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- var parsedKey interface{}
-
- var blockDecrypted []byte
-
- if blockDecrypted, err = x509.DecryptPEMBlock(block, []byte(password)); err != nil {
-
- return nil, err
-
- }
-
- if parsedKey, err = x509.ParsePKCS1PrivateKey(blockDecrypted); err != nil {
-
- if parsedKey, err = x509.ParsePKCS8PrivateKey(blockDecrypted); err != nil {
-
- return nil, err
-
- }
-
- }
-
- var pkey *rsa.PrivateKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok {
-
- return nil, ErrNotRSAPrivateKey
-
- }
-
- return pkey, nil
-
-}
-
-// Parse PEM encoded PKCS1 or PKCS8 public key
-
-func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
-
- if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
-
- parsedKey = cert.PublicKey
-
- } else {
-
- return nil, err
-
- }
-
- }
-
- var pkey *rsa.PublicKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*rsa.PublicKey); !ok {
-
- return nil, ErrNotRSAPublicKey
-
- }
-
- return pkey, nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/signing_method.go b/vendor/github.com/golang-jwt/jwt/signing_method.go
deleted file mode 100644
index ed1f212..0000000
--- a/vendor/github.com/golang-jwt/jwt/signing_method.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package jwt
-
-import (
- "sync"
-)
-
-var signingMethods = map[string]func() SigningMethod{}
-var signingMethodLock = new(sync.RWMutex)
-
-// Implement SigningMethod to add new methods for signing or verifying tokens.
-type SigningMethod interface {
- Verify(signingString, signature string, key interface{}) error // Returns nil if signature is valid
- Sign(signingString string, key interface{}) (string, error) // Returns encoded signature or error
- Alg() string // returns the alg identifier for this method (example: 'HS256')
-}
-
-// Register the "alg" name and a factory function for signing method.
-// This is typically done during init() in the method's implementation
-func RegisterSigningMethod(alg string, f func() SigningMethod) {
- signingMethodLock.Lock()
- defer signingMethodLock.Unlock()
-
- signingMethods[alg] = f
-}
-
-// Get a signing method from an "alg" string
-func GetSigningMethod(alg string) (method SigningMethod) {
- signingMethodLock.RLock()
- defer signingMethodLock.RUnlock()
-
- if methodF, ok := signingMethods[alg]; ok {
- method = methodF()
- }
- return
-}
diff --git a/vendor/github.com/golang-jwt/jwt/token.go b/vendor/github.com/golang-jwt/jwt/token.go
deleted file mode 100644
index 4730d78..0000000
--- a/vendor/github.com/golang-jwt/jwt/token.go
+++ /dev/null
@@ -1,173 +0,0 @@
-package jwt
-
-import (
- "encoding/base64"
- "encoding/json"
- "strings"
- "time"
-)
-
-// TimeFunc provides the current time when parsing token to validate "exp" claim (expiration time).
-
-// You can override it to use another time value. This is useful for testing or if your
-
-// server uses a different time zone than your tokens.
-
-var TimeFunc = time.Now
-
-// Parse methods use this callback function to supply
-
-// the key for verification. The function receives the parsed,
-
-// but unverified Token. This allows you to use properties in the
-
-// Header of the token (such as `kid`) to identify which key to use.
-
-type Keyfunc func(*Token) (interface{}, error)
-
-// A JWT Token. Different fields will be used depending on whether you're
-
-// creating or parsing/verifying a token.
-
-type Token struct {
- Raw string // The raw token. Populated when you Parse a token
-
- Method SigningMethod // The signing method used or to be used
-
- Header map[string]interface{} // The first segment of the token
-
- Claims Claims // The second segment of the token
-
- Signature string // The third segment of the token. Populated when you Parse a token
-
- Valid bool // Is the token valid? Populated when you Parse/Verify a token
-
-}
-
-// Create a new Token. Takes a signing method
-
-func New(method SigningMethod) *Token {
-
- return NewWithClaims(method, MapClaims{})
-
-}
-
-func NewWithClaims(method SigningMethod, claims Claims) *Token {
-
- return &Token{
-
- Header: map[string]interface{}{
-
- "typ": "JWT",
-
- "alg": method.Alg(),
- },
-
- Claims: claims,
-
- Method: method,
- }
-
-}
-
-// Get the complete, signed token
-
-func (t *Token) SignedString(key interface{}) (string, error) {
-
- var sig, sstr string
-
- var err error
-
- if sstr, err = t.SigningString(); err != nil {
-
- return "", err
-
- }
-
- if sig, err = t.Method.Sign(sstr, key); err != nil {
-
- return "", err
-
- }
-
- return strings.Join([]string{sstr, sig}, "."), nil
-
-}
-
-// Generate the signing string. This is the
-
-// most expensive part of the whole deal. Unless you
-
-// need this for something special, just go straight for
-
-// the SignedString.
-
-func (t *Token) SigningString() (string, error) {
-
- var err error
-
- parts := make([]string, 2)
-
- for i := range parts {
-
- var jsonValue []byte
-
- if i == 0 {
-
- if jsonValue, err = json.Marshal(t.Header); err != nil {
-
- return "", err
-
- }
-
- } else {
-
- if jsonValue, err = json.Marshal(t.Claims); err != nil {
-
- return "", err
-
- }
-
- }
-
- parts[i] = EncodeSegment(jsonValue)
-
- }
-
- return strings.Join(parts, "."), nil
-
-}
-
-// Parse, validate, and return a token.
-
-// keyFunc will receive the parsed token and should return the key for validating.
-
-// If everything is kosher, err will be nil
-
-func Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
-
- return new(Parser).Parse(tokenString, keyFunc)
-
-}
-
-func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) {
-
- return new(Parser).ParseWithClaims(tokenString, claims, keyFunc)
-
-}
-
-// Encode JWT specific base64url encoding with padding stripped
-
-func EncodeSegment(seg []byte) string {
-
- return base64.RawURLEncoding.EncodeToString(seg)
-
-}
-
-// Decode JWT specific base64url encoding with padding stripped
-
-func DecodeSegment(seg string) ([]byte, error) {
-
- return base64.RawURLEncoding.DecodeString(seg)
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/.gitignore b/vendor/github.com/golang-jwt/jwt/v4/.gitignore
deleted file mode 100644
index 09573e0..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.DS_Store
-bin
-.idea/
-
diff --git a/vendor/github.com/golang-jwt/jwt/v4/LICENSE b/vendor/github.com/golang-jwt/jwt/v4/LICENSE
deleted file mode 100644
index 35dbc25..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/LICENSE
+++ /dev/null
@@ -1,9 +0,0 @@
-Copyright (c) 2012 Dave Grijalva
-Copyright (c) 2021 golang-jwt maintainers
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
diff --git a/vendor/github.com/golang-jwt/jwt/v4/MIGRATION_GUIDE.md b/vendor/github.com/golang-jwt/jwt/v4/MIGRATION_GUIDE.md
deleted file mode 100644
index 32966f5..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/MIGRATION_GUIDE.md
+++ /dev/null
@@ -1,22 +0,0 @@
-## Migration Guide (v4.0.0)
-
-Starting from [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0), the import path will be:
-
- "github.com/golang-jwt/jwt/v4"
-
-The `/v4` version will be backwards compatible with existing `v3.x.y` tags in this repo, as well as
-`github.com/dgrijalva/jwt-go`. For most users this should be a drop-in replacement, if you're having
-troubles migrating, please open an issue.
-
-You can replace all occurrences of `github.com/dgrijalva/jwt-go` or `github.com/golang-jwt/jwt` with `github.com/golang-jwt/jwt/v4`, either manually or by using tools such as `sed` or `gofmt`.
-
-And then you'd typically run:
-
-```
-go get github.com/golang-jwt/jwt/v4
-go mod tidy
-```
-
-## Older releases (before v3.2.0)
-
-The original migration guide for older releases can be found at https://github.com/dgrijalva/jwt-go/blob/master/MIGRATION_GUIDE.md.
diff --git a/vendor/github.com/golang-jwt/jwt/v4/README.md b/vendor/github.com/golang-jwt/jwt/v4/README.md
deleted file mode 100644
index 30f2f2a..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/README.md
+++ /dev/null
@@ -1,138 +0,0 @@
-# jwt-go
-
-[![build](https://github.com/golang-jwt/jwt/actions/workflows/build.yml/badge.svg)](https://github.com/golang-jwt/jwt/actions/workflows/build.yml)
-[![Go Reference](https://pkg.go.dev/badge/github.com/golang-jwt/jwt/v4.svg)](https://pkg.go.dev/github.com/golang-jwt/jwt/v4)
-
-A [go](http://www.golang.org) (or 'golang' for search engine friendliness) implementation of [JSON Web Tokens](https://datatracker.ietf.org/doc/html/rfc7519).
-
-Starting with [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0) this project adds Go module support, but maintains backwards compatibility with older `v3.x.y` tags and upstream `github.com/dgrijalva/jwt-go`.
-See the [`MIGRATION_GUIDE.md`](./MIGRATION_GUIDE.md) for more information.
-
-> After the original author of the library suggested migrating the maintenance of `jwt-go`, a dedicated team of open source maintainers decided to clone the existing library into this repository. See [dgrijalva/jwt-go#462](https://github.com/dgrijalva/jwt-go/issues/462) for a detailed discussion on this topic.
-
-
-**SECURITY NOTICE:** Some older versions of Go have a security issue in the crypto/elliptic. Recommendation is to upgrade to at least 1.15 See issue [dgrijalva/jwt-go#216](https://github.com/dgrijalva/jwt-go/issues/216) for more detail.
-
-**SECURITY NOTICE:** It's important that you [validate the `alg` presented is what you expect](https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/). This library attempts to make it easy to do the right thing by requiring key types match the expected alg, but you should take the extra step to verify it in your usage. See the examples provided.
-
-### Supported Go versions
-
-Our support of Go versions is aligned with Go's [version release policy](https://golang.org/doc/devel/release#policy).
-So we will support a major version of Go until there are two newer major releases.
-We no longer support building jwt-go with unsupported Go versions, as these contain security vulnerabilities
-which will not be fixed.
-
-## What the heck is a JWT?
-
-JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web Tokens.
-
-In short, it's a signed JSON object that does something useful (for example, authentication). It's commonly used for `Bearer` tokens in Oauth 2. A token is made of three parts, separated by `.`'s. The first two parts are JSON objects, that have been [base64url](https://datatracker.ietf.org/doc/html/rfc4648) encoded. The last part is the signature, encoded the same way.
-
-The first part is called the header. It contains the necessary information for verifying the last part, the signature. For example, which encryption method was used for signing and what key was used.
-
-The part in the middle is the interesting bit. It's called the Claims and contains the actual stuff you care about. Refer to [RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519) for information about reserved keys and the proper way to add your own.
-
-## What's in the box?
-
-This library supports the parsing and verification as well as the generation and signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA, RSA-PSS, and ECDSA, though hooks are present for adding your own.
-
-## Installation Guidelines
-
-1. To install the jwt package, you first need to have [Go](https://go.dev/doc/install) installed, then you can use the command below to add `jwt-go` as a dependency in your Go program.
-
-```sh
-go get -u github.com/golang-jwt/jwt/v4
-```
-
-2. Import it in your code:
-
-```go
-import "github.com/golang-jwt/jwt/v4"
-```
-
-## Examples
-
-See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt/v4) for examples of usage:
-
-* [Simple example of parsing and validating a token](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#example-Parse-Hmac)
-* [Simple example of building and signing a token](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#example-New-Hmac)
-* [Directory of Examples](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#pkg-examples)
-
-## Extensions
-
-This library publishes all the necessary components for adding your own signing methods or key functions. Simply implement the `SigningMethod` interface and register a factory method using `RegisterSigningMethod` or provide a `jwt.Keyfunc`.
-
-A common use case would be integrating with different 3rd party signature providers, like key management services from various cloud providers or Hardware Security Modules (HSMs) or to implement additional standards.
-
-| Extension | Purpose | Repo |
-| --------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
-| GCP | Integrates with multiple Google Cloud Platform signing tools (AppEngine, IAM API, Cloud KMS) | https://github.com/someone1/gcp-jwt-go |
-| AWS | Integrates with AWS Key Management Service, KMS | https://github.com/matelang/jwt-go-aws-kms |
-| JWKS | Provides support for JWKS ([RFC 7517](https://datatracker.ietf.org/doc/html/rfc7517)) as a `jwt.Keyfunc` | https://github.com/MicahParks/keyfunc |
-
-*Disclaimer*: Unless otherwise specified, these integrations are maintained by third parties and should not be considered as a primary offer by any of the mentioned cloud providers
-
-## Compliance
-
-This library was last reviewed to comply with [RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519) dated May 2015 with a few notable differences:
-
-* In order to protect against accidental use of [Unsecured JWTs](https://datatracker.ietf.org/doc/html/rfc7519#section-6), tokens using `alg=none` will only be accepted if the constant `jwt.UnsafeAllowNoneSignatureType` is provided as the key.
-
-## Project Status & Versioning
-
-This library is considered production ready. Feedback and feature requests are appreciated. The API should be considered stable. There should be very few backwards-incompatible changes outside of major version updates (and only with good reason).
-
-This project uses [Semantic Versioning 2.0.0](http://semver.org). Accepted pull requests will land on `main`. Periodically, versions will be tagged from `main`. You can find all the releases on [the project releases page](https://github.com/golang-jwt/jwt/releases).
-
-**BREAKING CHANGES:***
-A full list of breaking changes is available in `VERSION_HISTORY.md`. See `MIGRATION_GUIDE.md` for more information on updating your code.
-
-## Usage Tips
-
-### Signing vs Encryption
-
-A token is simply a JSON object that is signed by its author. this tells you exactly two things about the data:
-
-* The author of the token was in the possession of the signing secret
-* The data has not been modified since it was signed
-
-It's important to know that JWT does not provide encryption, which means anyone who has access to the token can read its contents. If you need to protect (encrypt) the data, there is a companion spec, `JWE`, that provides this functionality. The companion project https://github.com/golang-jwt/jwe aims at a (very) experimental implementation of the JWE standard.
-
-### Choosing a Signing Method
-
-There are several signing methods available, and you should probably take the time to learn about the various options before choosing one. The principal design decision is most likely going to be symmetric vs asymmetric.
-
-Symmetric signing methods, such as HSA, use only a single secret. This is probably the simplest signing method to use since any `[]byte` can be used as a valid secret. They are also slightly computationally faster to use, though this rarely is enough to matter. Symmetric signing methods work the best when both producers and consumers of tokens are trusted, or even the same system. Since the same secret is used to both sign and validate tokens, you can't easily distribute the key for validation.
-
-Asymmetric signing methods, such as RSA, use different keys for signing and verifying tokens. This makes it possible to produce tokens with a private key, and allow any consumer to access the public key for verification.
-
-### Signing Methods and Key Types
-
-Each signing method expects a different object type for its signing keys. See the package documentation for details. Here are the most common ones:
-
-* The [HMAC signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodHMAC) (`HS256`,`HS384`,`HS512`) expect `[]byte` values for signing and validation
-* The [RSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodRSA) (`RS256`,`RS384`,`RS512`) expect `*rsa.PrivateKey` for signing and `*rsa.PublicKey` for validation
-* The [ECDSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodECDSA) (`ES256`,`ES384`,`ES512`) expect `*ecdsa.PrivateKey` for signing and `*ecdsa.PublicKey` for validation
-* The [EdDSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodEd25519) (`Ed25519`) expect `ed25519.PrivateKey` for signing and `ed25519.PublicKey` for validation
-
-### JWT and OAuth
-
-It's worth mentioning that OAuth and JWT are not the same thing. A JWT token is simply a signed JSON object. It can be used anywhere such a thing is useful. There is some confusion, though, as JWT is the most common type of bearer token used in OAuth2 authentication.
-
-Without going too far down the rabbit hole, here's a description of the interaction of these technologies:
-
-* OAuth is a protocol for allowing an identity provider to be separate from the service a user is logging in to. For example, whenever you use Facebook to log into a different service (Yelp, Spotify, etc), you are using OAuth.
-* OAuth defines several options for passing around authentication data. One popular method is called a "bearer token". A bearer token is simply a string that _should_ only be held by an authenticated user. Thus, simply presenting this token proves your identity. You can probably derive from here why a JWT might make a good bearer token.
-* Because bearer tokens are used for authentication, it's important they're kept secret. This is why transactions that use bearer tokens typically happen over SSL.
-
-### Troubleshooting
-
-This library uses descriptive error messages whenever possible. If you are not getting the expected result, have a look at the errors. The most common place people get stuck is providing the correct type of key to the parser. See the above section on signing methods and key types.
-
-## More
-
-Documentation can be found [on pkg.go.dev](https://pkg.go.dev/github.com/golang-jwt/jwt/v4).
-
-The command line utility included in this project (cmd/jwt) provides a straightforward example of token creation and parsing as well as a useful tool for debugging your own integration. You'll also find several implementation examples in the documentation.
-
-[golang-jwt](https://github.com/orgs/golang-jwt) incorporates a modified version of the JWT logo, which is distributed under the terms of the [MIT License](https://github.com/jsonwebtoken/jsonwebtoken.github.io/blob/master/LICENSE.txt).
diff --git a/vendor/github.com/golang-jwt/jwt/v4/SECURITY.md b/vendor/github.com/golang-jwt/jwt/v4/SECURITY.md
deleted file mode 100644
index b08402c..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/SECURITY.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# Security Policy
-
-## Supported Versions
-
-As of February 2022 (and until this document is updated), the latest version `v4` is supported.
-
-## Reporting a Vulnerability
-
-If you think you found a vulnerability, and even if you are not sure, please report it to jwt-go-security@googlegroups.com or one of the other [golang-jwt maintainers](https://github.com/orgs/golang-jwt/people). Please try be explicit, describe steps to reproduce the security issue with code example(s).
-
-You will receive a response within a timely manner. If the issue is confirmed, we will do our best to release a patch as soon as possible given the complexity of the problem.
-
-## Public Discussions
-
-Please avoid publicly discussing a potential security vulnerability.
-
-Let's take this offline and find a solution first, this limits the potential impact as much as possible.
-
-We appreciate your help!
diff --git a/vendor/github.com/golang-jwt/jwt/v4/VERSION_HISTORY.md b/vendor/github.com/golang-jwt/jwt/v4/VERSION_HISTORY.md
deleted file mode 100644
index afbfc4e..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/VERSION_HISTORY.md
+++ /dev/null
@@ -1,135 +0,0 @@
-## `jwt-go` Version History
-
-#### 4.0.0
-
-* Introduces support for Go modules. The `v4` version will be backwards compatible with `v3.x.y`.
-
-#### 3.2.2
-
-* Starting from this release, we are adopting the policy to support the most 2 recent versions of Go currently available. By the time of this release, this is Go 1.15 and 1.16 ([#28](https://github.com/golang-jwt/jwt/pull/28)).
-* Fixed a potential issue that could occur when the verification of `exp`, `iat` or `nbf` was not required and contained invalid contents, i.e. non-numeric/date. Thanks for @thaJeztah for making us aware of that and @giorgos-f3 for originally reporting it to the formtech fork ([#40](https://github.com/golang-jwt/jwt/pull/40)).
-* Added support for EdDSA / ED25519 ([#36](https://github.com/golang-jwt/jwt/pull/36)).
-* Optimized allocations ([#33](https://github.com/golang-jwt/jwt/pull/33)).
-
-#### 3.2.1
-
-* **Import Path Change**: See MIGRATION_GUIDE.md for tips on updating your code
- * Changed the import path from `github.com/dgrijalva/jwt-go` to `github.com/golang-jwt/jwt`
-* Fixed type confusing issue between `string` and `[]string` in `VerifyAudience` ([#12](https://github.com/golang-jwt/jwt/pull/12)). This fixes CVE-2020-26160
-
-#### 3.2.0
-
-* Added method `ParseUnverified` to allow users to split up the tasks of parsing and validation
-* HMAC signing method returns `ErrInvalidKeyType` instead of `ErrInvalidKey` where appropriate
-* Added options to `request.ParseFromRequest`, which allows for an arbitrary list of modifiers to parsing behavior. Initial set include `WithClaims` and `WithParser`. Existing usage of this function will continue to work as before.
-* Deprecated `ParseFromRequestWithClaims` to simplify API in the future.
-
-#### 3.1.0
-
-* Improvements to `jwt` command line tool
-* Added `SkipClaimsValidation` option to `Parser`
-* Documentation updates
-
-#### 3.0.0
-
-* **Compatibility Breaking Changes**: See MIGRATION_GUIDE.md for tips on updating your code
- * Dropped support for `[]byte` keys when using RSA signing methods. This convenience feature could contribute to security vulnerabilities involving mismatched key types with signing methods.
- * `ParseFromRequest` has been moved to `request` subpackage and usage has changed
- * The `Claims` property on `Token` is now type `Claims` instead of `map[string]interface{}`. The default value is type `MapClaims`, which is an alias to `map[string]interface{}`. This makes it possible to use a custom type when decoding claims.
-* Other Additions and Changes
- * Added `Claims` interface type to allow users to decode the claims into a custom type
- * Added `ParseWithClaims`, which takes a third argument of type `Claims`. Use this function instead of `Parse` if you have a custom type you'd like to decode into.
- * Dramatically improved the functionality and flexibility of `ParseFromRequest`, which is now in the `request` subpackage
- * Added `ParseFromRequestWithClaims` which is the `FromRequest` equivalent of `ParseWithClaims`
- * Added new interface type `Extractor`, which is used for extracting JWT strings from http requests. Used with `ParseFromRequest` and `ParseFromRequestWithClaims`.
- * Added several new, more specific, validation errors to error type bitmask
- * Moved examples from README to executable example files
- * Signing method registry is now thread safe
- * Added new property to `ValidationError`, which contains the raw error returned by calls made by parse/verify (such as those returned by keyfunc or json parser)
-
-#### 2.7.0
-
-This will likely be the last backwards compatible release before 3.0.0, excluding essential bug fixes.
-
-* Added new option `-show` to the `jwt` command that will just output the decoded token without verifying
-* Error text for expired tokens includes how long it's been expired
-* Fixed incorrect error returned from `ParseRSAPublicKeyFromPEM`
-* Documentation updates
-
-#### 2.6.0
-
-* Exposed inner error within ValidationError
-* Fixed validation errors when using UseJSONNumber flag
-* Added several unit tests
-
-#### 2.5.0
-
-* Added support for signing method none. You shouldn't use this. The API tries to make this clear.
-* Updated/fixed some documentation
-* Added more helpful error message when trying to parse tokens that begin with `BEARER `
-
-#### 2.4.0
-
-* Added new type, Parser, to allow for configuration of various parsing parameters
- * You can now specify a list of valid signing methods. Anything outside this set will be rejected.
- * You can now opt to use the `json.Number` type instead of `float64` when parsing token JSON
-* Added support for [Travis CI](https://travis-ci.org/dgrijalva/jwt-go)
-* Fixed some bugs with ECDSA parsing
-
-#### 2.3.0
-
-* Added support for ECDSA signing methods
-* Added support for RSA PSS signing methods (requires go v1.4)
-
-#### 2.2.0
-
-* Gracefully handle a `nil` `Keyfunc` being passed to `Parse`. Result will now be the parsed token and an error, instead of a panic.
-
-#### 2.1.0
-
-Backwards compatible API change that was missed in 2.0.0.
-
-* The `SignedString` method on `Token` now takes `interface{}` instead of `[]byte`
-
-#### 2.0.0
-
-There were two major reasons for breaking backwards compatibility with this update. The first was a refactor required to expand the width of the RSA and HMAC-SHA signing implementations. There will likely be no required code changes to support this change.
-
-The second update, while unfortunately requiring a small change in integration, is required to open up this library to other signing methods. Not all keys used for all signing methods have a single standard on-disk representation. Requiring `[]byte` as the type for all keys proved too limiting. Additionally, this implementation allows for pre-parsed tokens to be reused, which might matter in an application that parses a high volume of tokens with a small set of keys. Backwards compatibilty has been maintained for passing `[]byte` to the RSA signing methods, but they will also accept `*rsa.PublicKey` and `*rsa.PrivateKey`.
-
-It is likely the only integration change required here will be to change `func(t *jwt.Token) ([]byte, error)` to `func(t *jwt.Token) (interface{}, error)` when calling `Parse`.
-
-* **Compatibility Breaking Changes**
- * `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct`
- * `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct`
- * `KeyFunc` now returns `interface{}` instead of `[]byte`
- * `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key
- * `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key
-* Renamed type `SigningMethodHS256` to `SigningMethodHMAC`. Specific sizes are now just instances of this type.
- * Added public package global `SigningMethodHS256`
- * Added public package global `SigningMethodHS384`
- * Added public package global `SigningMethodHS512`
-* Renamed type `SigningMethodRS256` to `SigningMethodRSA`. Specific sizes are now just instances of this type.
- * Added public package global `SigningMethodRS256`
- * Added public package global `SigningMethodRS384`
- * Added public package global `SigningMethodRS512`
-* Moved sample private key for HMAC tests from an inline value to a file on disk. Value is unchanged.
-* Refactored the RSA implementation to be easier to read
-* Exposed helper methods `ParseRSAPrivateKeyFromPEM` and `ParseRSAPublicKeyFromPEM`
-
-#### 1.0.2
-
-* Fixed bug in parsing public keys from certificates
-* Added more tests around the parsing of keys for RS256
-* Code refactoring in RS256 implementation. No functional changes
-
-#### 1.0.1
-
-* Fixed panic if RS256 signing method was passed an invalid key
-
-#### 1.0.0
-
-* First versioned release
-* API stabilized
-* Supports creating, signing, parsing, and validating JWT tokens
-* Supports RS256 and HS256 signing methods
diff --git a/vendor/github.com/golang-jwt/jwt/v4/claims.go b/vendor/github.com/golang-jwt/jwt/v4/claims.go
deleted file mode 100644
index 4083e2b..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/claims.go
+++ /dev/null
@@ -1,434 +0,0 @@
-package jwt
-
-import (
- "crypto/subtle"
- "fmt"
- "time"
-)
-
-// Claims must just have a Valid method that determines
-
-// if the token is invalid for any supported reason
-
-type Claims interface {
- Valid() error
-}
-
-// RegisteredClaims are a structured version of the JWT Claims Set,
-
-// restricted to Registered Claim Names, as referenced at
-
-// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1
-
-//
-
-// This type can be used on its own, but then additional private and
-
-// public claims embedded in the JWT will not be parsed. The typical usecase
-
-// therefore is to embedded this in a user-defined claim type.
-
-//
-
-// See examples for how to use this with your own claim types.
-
-type RegisteredClaims struct {
-
- // the `iss` (Issuer) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1
-
- Issuer string `json:"iss,omitempty"`
-
- // the `sub` (Subject) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.2
-
- Subject string `json:"sub,omitempty"`
-
- // the `aud` (Audience) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3
-
- Audience ClaimStrings `json:"aud,omitempty"`
-
- // the `exp` (Expiration Time) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.4
-
- ExpiresAt *NumericDate `json:"exp,omitempty"`
-
- // the `nbf` (Not Before) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.5
-
- NotBefore *NumericDate `json:"nbf,omitempty"`
-
- // the `iat` (Issued At) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.6
-
- IssuedAt *NumericDate `json:"iat,omitempty"`
-
- // the `jti` (JWT ID) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.7
-
- ID string `json:"jti,omitempty"`
-}
-
-// Valid validates time based claims "exp, iat, nbf".
-
-// There is no accounting for clock skew.
-
-// As well, if any of the above claims are not in the token, it will still
-
-// be considered a valid claim.
-
-func (c RegisteredClaims) Valid() error {
-
- vErr := new(ValidationError)
-
- now := TimeFunc()
-
- // The claims below are optional, by default, so if they are set to the
-
- // default value in Go, let's not fail the verification for them.
-
- if !c.VerifyExpiresAt(now, false) {
-
- delta := now.Sub(c.ExpiresAt.Time)
-
- vErr.Inner = fmt.Errorf("%s by %s", ErrTokenExpired, delta)
-
- vErr.Errors |= ValidationErrorExpired
-
- }
-
- if !c.VerifyIssuedAt(now, false) {
-
- vErr.Inner = ErrTokenUsedBeforeIssued
-
- vErr.Errors |= ValidationErrorIssuedAt
-
- }
-
- if !c.VerifyNotBefore(now, false) {
-
- vErr.Inner = ErrTokenNotValidYet
-
- vErr.Errors |= ValidationErrorNotValidYet
-
- }
-
- if vErr.valid() {
-
- return nil
-
- }
-
- return vErr
-
-}
-
-// VerifyAudience compares the aud claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (c *RegisteredClaims) VerifyAudience(cmp string, req bool) bool {
-
- return verifyAud(c.Audience, cmp, req)
-
-}
-
-// VerifyExpiresAt compares the exp claim against cmp (cmp < exp).
-
-// If req is false, it will return true, if exp is unset.
-
-func (c *RegisteredClaims) VerifyExpiresAt(cmp time.Time, req bool) bool {
-
- if c.ExpiresAt == nil {
-
- return verifyExp(nil, cmp, req)
-
- }
-
- return verifyExp(&c.ExpiresAt.Time, cmp, req)
-
-}
-
-// VerifyIssuedAt compares the iat claim against cmp (cmp >= iat).
-
-// If req is false, it will return true, if iat is unset.
-
-func (c *RegisteredClaims) VerifyIssuedAt(cmp time.Time, req bool) bool {
-
- if c.IssuedAt == nil {
-
- return verifyIat(nil, cmp, req)
-
- }
-
- return verifyIat(&c.IssuedAt.Time, cmp, req)
-
-}
-
-// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf).
-
-// If req is false, it will return true, if nbf is unset.
-
-func (c *RegisteredClaims) VerifyNotBefore(cmp time.Time, req bool) bool {
-
- if c.NotBefore == nil {
-
- return verifyNbf(nil, cmp, req)
-
- }
-
- return verifyNbf(&c.NotBefore.Time, cmp, req)
-
-}
-
-// VerifyIssuer compares the iss claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (c *RegisteredClaims) VerifyIssuer(cmp string, req bool) bool {
-
- return verifyIss(c.Issuer, cmp, req)
-
-}
-
-// StandardClaims are a structured version of the JWT Claims Set, as referenced at
-
-// https://datatracker.ietf.org/doc/html/rfc7519#section-4. They do not follow the
-
-// specification exactly, since they were based on an earlier draft of the
-
-// specification and not updated. The main difference is that they only
-
-// support integer-based date fields and singular audiences. This might lead to
-
-// incompatibilities with other JWT implementations. The use of this is discouraged, instead
-
-// the newer RegisteredClaims struct should be used.
-
-//
-
-// Deprecated: Use RegisteredClaims instead for a forward-compatible way to access registered claims in a struct.
-
-type StandardClaims struct {
- Audience string `json:"aud,omitempty"`
-
- ExpiresAt int64 `json:"exp,omitempty"`
-
- Id string `json:"jti,omitempty"`
-
- IssuedAt int64 `json:"iat,omitempty"`
-
- Issuer string `json:"iss,omitempty"`
-
- NotBefore int64 `json:"nbf,omitempty"`
-
- Subject string `json:"sub,omitempty"`
-}
-
-// Valid validates time based claims "exp, iat, nbf". There is no accounting for clock skew.
-
-// As well, if any of the above claims are not in the token, it will still
-
-// be considered a valid claim.
-
-func (c StandardClaims) Valid() error {
-
- vErr := new(ValidationError)
-
- now := TimeFunc().Unix()
-
- // The claims below are optional, by default, so if they are set to the
-
- // default value in Go, let's not fail the verification for them.
-
- if !c.VerifyExpiresAt(now, false) {
-
- delta := time.Unix(now, 0).Sub(time.Unix(c.ExpiresAt, 0))
-
- vErr.Inner = fmt.Errorf("%s by %s", ErrTokenExpired, delta)
-
- vErr.Errors |= ValidationErrorExpired
-
- }
-
- if !c.VerifyIssuedAt(now, false) {
-
- vErr.Inner = ErrTokenUsedBeforeIssued
-
- vErr.Errors |= ValidationErrorIssuedAt
-
- }
-
- if !c.VerifyNotBefore(now, false) {
-
- vErr.Inner = ErrTokenNotValidYet
-
- vErr.Errors |= ValidationErrorNotValidYet
-
- }
-
- if vErr.valid() {
-
- return nil
-
- }
-
- return vErr
-
-}
-
-// VerifyAudience compares the aud claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (c *StandardClaims) VerifyAudience(cmp string, req bool) bool {
-
- return verifyAud([]string{c.Audience}, cmp, req)
-
-}
-
-// VerifyExpiresAt compares the exp claim against cmp (cmp < exp).
-
-// If req is false, it will return true, if exp is unset.
-
-func (c *StandardClaims) VerifyExpiresAt(cmp int64, req bool) bool {
-
- if c.ExpiresAt == 0 {
-
- return verifyExp(nil, time.Unix(cmp, 0), req)
-
- }
-
- t := time.Unix(c.ExpiresAt, 0)
-
- return verifyExp(&t, time.Unix(cmp, 0), req)
-
-}
-
-// VerifyIssuedAt compares the iat claim against cmp (cmp >= iat).
-
-// If req is false, it will return true, if iat is unset.
-
-func (c *StandardClaims) VerifyIssuedAt(cmp int64, req bool) bool {
-
- if c.IssuedAt == 0 {
-
- return verifyIat(nil, time.Unix(cmp, 0), req)
-
- }
-
- t := time.Unix(c.IssuedAt, 0)
-
- return verifyIat(&t, time.Unix(cmp, 0), req)
-
-}
-
-// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf).
-
-// If req is false, it will return true, if nbf is unset.
-
-func (c *StandardClaims) VerifyNotBefore(cmp int64, req bool) bool {
-
- if c.NotBefore == 0 {
-
- return verifyNbf(nil, time.Unix(cmp, 0), req)
-
- }
-
- t := time.Unix(c.NotBefore, 0)
-
- return verifyNbf(&t, time.Unix(cmp, 0), req)
-
-}
-
-// VerifyIssuer compares the iss claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (c *StandardClaims) VerifyIssuer(cmp string, req bool) bool {
-
- return verifyIss(c.Issuer, cmp, req)
-
-}
-
-// ----- helpers
-
-func verifyAud(aud []string, cmp string, required bool) bool {
-
- if len(aud) == 0 {
-
- return !required
-
- }
-
- // use a var here to keep constant time compare when looping over a number of claims
-
- result := false
-
- var stringClaims string
-
- for _, a := range aud {
-
- if subtle.ConstantTimeCompare([]byte(a), []byte(cmp)) != 0 {
-
- result = true
-
- }
-
- stringClaims = stringClaims + a
-
- }
-
- // case where "" is sent in one or many aud claims
-
- if len(stringClaims) == 0 {
-
- return !required
-
- }
-
- return result
-
-}
-
-func verifyExp(exp *time.Time, now time.Time, required bool) bool {
-
- if exp == nil {
-
- return !required
-
- }
-
- return now.Before(*exp)
-
-}
-
-func verifyIat(iat *time.Time, now time.Time, required bool) bool {
-
- if iat == nil {
-
- return !required
-
- }
-
- return now.After(*iat) || now.Equal(*iat)
-
-}
-
-func verifyNbf(nbf *time.Time, now time.Time, required bool) bool {
-
- if nbf == nil {
-
- return !required
-
- }
-
- return now.After(*nbf) || now.Equal(*nbf)
-
-}
-
-func verifyIss(iss string, cmp string, required bool) bool {
-
- if iss == "" {
-
- return !required
-
- }
-
- return subtle.ConstantTimeCompare([]byte(iss), []byte(cmp)) != 0
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/doc.go b/vendor/github.com/golang-jwt/jwt/v4/doc.go
deleted file mode 100644
index a86dc1a..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/doc.go
+++ /dev/null
@@ -1,4 +0,0 @@
-// Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html
-//
-// See README.md for more info.
-package jwt
diff --git a/vendor/github.com/golang-jwt/jwt/v4/ecdsa.go b/vendor/github.com/golang-jwt/jwt/v4/ecdsa.go
deleted file mode 100644
index 11a5542..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/ecdsa.go
+++ /dev/null
@@ -1,224 +0,0 @@
-package jwt
-
-import (
- "crypto"
- "crypto/ecdsa"
- "crypto/rand"
- "errors"
- "math/big"
-)
-
-var (
-
- // Sadly this is missing from crypto/ecdsa compared to crypto/rsa
-
- ErrECDSAVerification = errors.New("crypto/ecdsa: verification error")
-)
-
-// SigningMethodECDSA implements the ECDSA family of signing methods.
-
-// Expects *ecdsa.PrivateKey for signing and *ecdsa.PublicKey for verification
-
-type SigningMethodECDSA struct {
- Name string
-
- Hash crypto.Hash
-
- KeySize int
-
- CurveBits int
-}
-
-// Specific instances for EC256 and company
-
-var (
- SigningMethodES256 *SigningMethodECDSA
-
- SigningMethodES384 *SigningMethodECDSA
-
- SigningMethodES512 *SigningMethodECDSA
-)
-
-func init() {
-
- // ES256
-
- SigningMethodES256 = &SigningMethodECDSA{"ES256", crypto.SHA256, 32, 256}
-
- RegisterSigningMethod(SigningMethodES256.Alg(), func() SigningMethod {
-
- return SigningMethodES256
-
- })
-
- // ES384
-
- SigningMethodES384 = &SigningMethodECDSA{"ES384", crypto.SHA384, 48, 384}
-
- RegisterSigningMethod(SigningMethodES384.Alg(), func() SigningMethod {
-
- return SigningMethodES384
-
- })
-
- // ES512
-
- SigningMethodES512 = &SigningMethodECDSA{"ES512", crypto.SHA512, 66, 521}
-
- RegisterSigningMethod(SigningMethodES512.Alg(), func() SigningMethod {
-
- return SigningMethodES512
-
- })
-
-}
-
-func (m *SigningMethodECDSA) Alg() string {
-
- return m.Name
-
-}
-
-// Verify implements token verification for the SigningMethod.
-
-// For this verify method, key must be an ecdsa.PublicKey struct
-
-func (m *SigningMethodECDSA) Verify(signingString, signature string, key interface{}) error {
-
- var err error
-
- // Decode the signature
-
- var sig []byte
-
- if sig, err = DecodeSegment(signature); err != nil {
-
- return err
-
- }
-
- // Get the key
-
- var ecdsaKey *ecdsa.PublicKey
-
- switch k := key.(type) {
-
- case *ecdsa.PublicKey:
-
- ecdsaKey = k
-
- default:
-
- return ErrInvalidKeyType
-
- }
-
- if len(sig) != 2*m.KeySize {
-
- return ErrECDSAVerification
-
- }
-
- r := big.NewInt(0).SetBytes(sig[:m.KeySize])
-
- s := big.NewInt(0).SetBytes(sig[m.KeySize:])
-
- // Create hasher
-
- if !m.Hash.Available() {
-
- return ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Verify the signature
-
- if verifystatus := ecdsa.Verify(ecdsaKey, hasher.Sum(nil), r, s); verifystatus {
-
- return nil
-
- }
-
- return ErrECDSAVerification
-
-}
-
-// Sign implements token signing for the SigningMethod.
-
-// For this signing method, key must be an ecdsa.PrivateKey struct
-
-func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) (string, error) {
-
- // Get the key
-
- var ecdsaKey *ecdsa.PrivateKey
-
- switch k := key.(type) {
-
- case *ecdsa.PrivateKey:
-
- ecdsaKey = k
-
- default:
-
- return "", ErrInvalidKeyType
-
- }
-
- // Create the hasher
-
- if !m.Hash.Available() {
-
- return "", ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Sign the string and return r, s
-
- if r, s, err := ecdsa.Sign(rand.Reader, ecdsaKey, hasher.Sum(nil)); err == nil {
-
- curveBits := ecdsaKey.Curve.Params().BitSize
-
- if m.CurveBits != curveBits {
-
- return "", ErrInvalidKey
-
- }
-
- keyBytes := curveBits / 8
-
- if curveBits%8 > 0 {
-
- keyBytes += 1
-
- }
-
- // We serialize the outputs (r and s) into big-endian byte arrays
-
- // padded with zeros on the left to make sure the sizes work out.
-
- // Output must be 2*keyBytes long.
-
- out := make([]byte, 2*keyBytes)
-
- r.FillBytes(out[0:keyBytes]) // r is assigned to the first half of output.
-
- s.FillBytes(out[keyBytes:]) // s is assigned to the second half of output.
-
- return EncodeSegment(out), nil
-
- } else {
-
- return "", err
-
- }
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/ecdsa_utils.go b/vendor/github.com/golang-jwt/jwt/v4/ecdsa_utils.go
deleted file mode 100644
index 7254d66..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/ecdsa_utils.go
+++ /dev/null
@@ -1,106 +0,0 @@
-package jwt
-
-import (
- "crypto/ecdsa"
- "crypto/x509"
- "encoding/pem"
- "errors"
-)
-
-var (
- ErrNotECPublicKey = errors.New("key is not a valid ECDSA public key")
-
- ErrNotECPrivateKey = errors.New("key is not a valid ECDSA private key")
-)
-
-// ParseECPrivateKeyFromPEM parses a PEM encoded Elliptic Curve Private Key Structure
-
-func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil {
-
- if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
-
- return nil, err
-
- }
-
- }
-
- var pkey *ecdsa.PrivateKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok {
-
- return nil, ErrNotECPrivateKey
-
- }
-
- return pkey, nil
-
-}
-
-// ParseECPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key
-
-func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
-
- if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
-
- parsedKey = cert.PublicKey
-
- } else {
-
- return nil, err
-
- }
-
- }
-
- var pkey *ecdsa.PublicKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok {
-
- return nil, ErrNotECPublicKey
-
- }
-
- return pkey, nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/ed25519.go b/vendor/github.com/golang-jwt/jwt/v4/ed25519.go
deleted file mode 100644
index 3329287..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/ed25519.go
+++ /dev/null
@@ -1,126 +0,0 @@
-package jwt
-
-import (
- "crypto"
- "crypto/ed25519"
- "crypto/rand"
- "errors"
-)
-
-var (
- ErrEd25519Verification = errors.New("ed25519: verification error")
-)
-
-// SigningMethodEd25519 implements the EdDSA family.
-
-// Expects ed25519.PrivateKey for signing and ed25519.PublicKey for verification
-
-type SigningMethodEd25519 struct{}
-
-// Specific instance for EdDSA
-
-var (
- SigningMethodEdDSA *SigningMethodEd25519
-)
-
-func init() {
-
- SigningMethodEdDSA = &SigningMethodEd25519{}
-
- RegisterSigningMethod(SigningMethodEdDSA.Alg(), func() SigningMethod {
-
- return SigningMethodEdDSA
-
- })
-
-}
-
-func (m *SigningMethodEd25519) Alg() string {
-
- return "EdDSA"
-
-}
-
-// Verify implements token verification for the SigningMethod.
-
-// For this verify method, key must be an ed25519.PublicKey
-
-func (m *SigningMethodEd25519) Verify(signingString, signature string, key interface{}) error {
-
- var err error
-
- var ed25519Key ed25519.PublicKey
-
- var ok bool
-
- if ed25519Key, ok = key.(ed25519.PublicKey); !ok {
-
- return ErrInvalidKeyType
-
- }
-
- if len(ed25519Key) != ed25519.PublicKeySize {
-
- return ErrInvalidKey
-
- }
-
- // Decode the signature
-
- var sig []byte
-
- if sig, err = DecodeSegment(signature); err != nil {
-
- return err
-
- }
-
- // Verify the signature
-
- if !ed25519.Verify(ed25519Key, []byte(signingString), sig) {
-
- return ErrEd25519Verification
-
- }
-
- return nil
-
-}
-
-// Sign implements token signing for the SigningMethod.
-
-// For this signing method, key must be an ed25519.PrivateKey
-
-func (m *SigningMethodEd25519) Sign(signingString string, key interface{}) (string, error) {
-
- var ed25519Key crypto.Signer
-
- var ok bool
-
- if ed25519Key, ok = key.(crypto.Signer); !ok {
-
- return "", ErrInvalidKeyType
-
- }
-
- if _, ok := ed25519Key.Public().(ed25519.PublicKey); !ok {
-
- return "", ErrInvalidKey
-
- }
-
- // Sign the string and return the encoded result
-
- // ed25519 performs a two-pass hash as part of its algorithm. Therefore, we need to pass a non-prehashed message into the Sign function, as indicated by crypto.Hash(0)
-
- sig, err := ed25519Key.Sign(rand.Reader, []byte(signingString), crypto.Hash(0))
-
- if err != nil {
-
- return "", err
-
- }
-
- return EncodeSegment(sig), nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/ed25519_utils.go b/vendor/github.com/golang-jwt/jwt/v4/ed25519_utils.go
deleted file mode 100644
index 58dcc40..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/ed25519_utils.go
+++ /dev/null
@@ -1,95 +0,0 @@
-package jwt
-
-import (
- "crypto"
- "crypto/ed25519"
- "crypto/x509"
- "encoding/pem"
- "errors"
-)
-
-var (
- ErrNotEdPrivateKey = errors.New("key is not a valid Ed25519 private key")
-
- ErrNotEdPublicKey = errors.New("key is not a valid Ed25519 public key")
-)
-
-// ParseEdPrivateKeyFromPEM parses a PEM-encoded Edwards curve private key
-
-func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
-
- return nil, err
-
- }
-
- var pkey ed25519.PrivateKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(ed25519.PrivateKey); !ok {
-
- return nil, ErrNotEdPrivateKey
-
- }
-
- return pkey, nil
-
-}
-
-// ParseEdPublicKeyFromPEM parses a PEM-encoded Edwards curve public key
-
-func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
-
- return nil, err
-
- }
-
- var pkey ed25519.PublicKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(ed25519.PublicKey); !ok {
-
- return nil, ErrNotEdPublicKey
-
- }
-
- return pkey, nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/errors.go b/vendor/github.com/golang-jwt/jwt/v4/errors.go
deleted file mode 100644
index 10ac883..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/errors.go
+++ /dev/null
@@ -1,112 +0,0 @@
-package jwt
-
-import (
- "errors"
-)
-
-// Error constants
-var (
- ErrInvalidKey = errors.New("key is invalid")
- ErrInvalidKeyType = errors.New("key is of invalid type")
- ErrHashUnavailable = errors.New("the requested hash function is unavailable")
-
- ErrTokenMalformed = errors.New("token is malformed")
- ErrTokenUnverifiable = errors.New("token is unverifiable")
- ErrTokenSignatureInvalid = errors.New("token signature is invalid")
-
- ErrTokenInvalidAudience = errors.New("token has invalid audience")
- ErrTokenExpired = errors.New("token is expired")
- ErrTokenUsedBeforeIssued = errors.New("token used before issued")
- ErrTokenInvalidIssuer = errors.New("token has invalid issuer")
- ErrTokenNotValidYet = errors.New("token is not valid yet")
- ErrTokenInvalidId = errors.New("token has invalid id")
- ErrTokenInvalidClaims = errors.New("token has invalid claims")
-)
-
-// The errors that might occur when parsing and validating a token
-const (
- ValidationErrorMalformed uint32 = 1 << iota // Token is malformed
- ValidationErrorUnverifiable // Token could not be verified because of signing problems
- ValidationErrorSignatureInvalid // Signature validation failed
-
- // Standard Claim validation errors
- ValidationErrorAudience // AUD validation failed
- ValidationErrorExpired // EXP validation failed
- ValidationErrorIssuedAt // IAT validation failed
- ValidationErrorIssuer // ISS validation failed
- ValidationErrorNotValidYet // NBF validation failed
- ValidationErrorId // JTI validation failed
- ValidationErrorClaimsInvalid // Generic claims validation error
-)
-
-// NewValidationError is a helper for constructing a ValidationError with a string error message
-func NewValidationError(errorText string, errorFlags uint32) *ValidationError {
- return &ValidationError{
- text: errorText,
- Errors: errorFlags,
- }
-}
-
-// ValidationError represents an error from Parse if token is not valid
-type ValidationError struct {
- Inner error // stores the error returned by external dependencies, i.e.: KeyFunc
- Errors uint32 // bitfield. see ValidationError... constants
- text string // errors that do not have a valid error just have text
-}
-
-// Error is the implementation of the err interface.
-func (e ValidationError) Error() string {
- if e.Inner != nil {
- return e.Inner.Error()
- } else if e.text != "" {
- return e.text
- } else {
- return "token is invalid"
- }
-}
-
-// Unwrap gives errors.Is and errors.As access to the inner error.
-func (e *ValidationError) Unwrap() error {
- return e.Inner
-}
-
-// No errors
-func (e *ValidationError) valid() bool {
- return e.Errors == 0
-}
-
-// Is checks if this ValidationError is of the supplied error. We are first checking for the exact error message
-// by comparing the inner error message. If that fails, we compare using the error flags. This way we can use
-// custom error messages (mainly for backwards compatability) and still leverage errors.Is using the global error variables.
-func (e *ValidationError) Is(err error) bool {
- // Check, if our inner error is a direct match
- if errors.Is(errors.Unwrap(e), err) {
- return true
- }
-
- // Otherwise, we need to match using our error flags
- switch err {
- case ErrTokenMalformed:
- return e.Errors&ValidationErrorMalformed != 0
- case ErrTokenUnverifiable:
- return e.Errors&ValidationErrorUnverifiable != 0
- case ErrTokenSignatureInvalid:
- return e.Errors&ValidationErrorSignatureInvalid != 0
- case ErrTokenInvalidAudience:
- return e.Errors&ValidationErrorAudience != 0
- case ErrTokenExpired:
- return e.Errors&ValidationErrorExpired != 0
- case ErrTokenUsedBeforeIssued:
- return e.Errors&ValidationErrorIssuedAt != 0
- case ErrTokenInvalidIssuer:
- return e.Errors&ValidationErrorIssuer != 0
- case ErrTokenNotValidYet:
- return e.Errors&ValidationErrorNotValidYet != 0
- case ErrTokenInvalidId:
- return e.Errors&ValidationErrorId != 0
- case ErrTokenInvalidClaims:
- return e.Errors&ValidationErrorClaimsInvalid != 0
- }
-
- return false
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/hmac.go b/vendor/github.com/golang-jwt/jwt/v4/hmac.go
deleted file mode 100644
index de246a3..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/hmac.go
+++ /dev/null
@@ -1,149 +0,0 @@
-package jwt
-
-import (
- "crypto"
- "crypto/hmac"
- "errors"
-)
-
-// SigningMethodHMAC implements the HMAC-SHA family of signing methods.
-
-// Expects key type of []byte for both signing and validation
-
-type SigningMethodHMAC struct {
- Name string
-
- Hash crypto.Hash
-}
-
-// Specific instances for HS256 and company
-
-var (
- SigningMethodHS256 *SigningMethodHMAC
-
- SigningMethodHS384 *SigningMethodHMAC
-
- SigningMethodHS512 *SigningMethodHMAC
-
- ErrSignatureInvalid = errors.New("signature is invalid")
-)
-
-func init() {
-
- // HS256
-
- SigningMethodHS256 = &SigningMethodHMAC{"HS256", crypto.SHA256}
-
- RegisterSigningMethod(SigningMethodHS256.Alg(), func() SigningMethod {
-
- return SigningMethodHS256
-
- })
-
- // HS384
-
- SigningMethodHS384 = &SigningMethodHMAC{"HS384", crypto.SHA384}
-
- RegisterSigningMethod(SigningMethodHS384.Alg(), func() SigningMethod {
-
- return SigningMethodHS384
-
- })
-
- // HS512
-
- SigningMethodHS512 = &SigningMethodHMAC{"HS512", crypto.SHA512}
-
- RegisterSigningMethod(SigningMethodHS512.Alg(), func() SigningMethod {
-
- return SigningMethodHS512
-
- })
-
-}
-
-func (m *SigningMethodHMAC) Alg() string {
-
- return m.Name
-
-}
-
-// Verify implements token verification for the SigningMethod. Returns nil if the signature is valid.
-
-func (m *SigningMethodHMAC) Verify(signingString, signature string, key interface{}) error {
-
- // Verify the key is the right type
-
- keyBytes, ok := key.([]byte)
-
- if !ok {
-
- return ErrInvalidKeyType
-
- }
-
- // Decode signature, for comparison
-
- sig, err := DecodeSegment(signature)
-
- if err != nil {
-
- return err
-
- }
-
- // Can we use the specified hashing method?
-
- if !m.Hash.Available() {
-
- return ErrHashUnavailable
-
- }
-
- // This signing method is symmetric, so we validate the signature
-
- // by reproducing the signature from the signing string and key, then
-
- // comparing that against the provided signature.
-
- hasher := hmac.New(m.Hash.New, keyBytes)
-
- hasher.Write([]byte(signingString))
-
- if !hmac.Equal(sig, hasher.Sum(nil)) {
-
- return ErrSignatureInvalid
-
- }
-
- // No validation errors. Signature is good.
-
- return nil
-
-}
-
-// Sign implements token signing for the SigningMethod.
-
-// Key must be []byte
-
-func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) (string, error) {
-
- if keyBytes, ok := key.([]byte); ok {
-
- if !m.Hash.Available() {
-
- return "", ErrHashUnavailable
-
- }
-
- hasher := hmac.New(m.Hash.New, keyBytes)
-
- hasher.Write([]byte(signingString))
-
- return EncodeSegment(hasher.Sum(nil)), nil
-
- }
-
- return "", ErrInvalidKeyType
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/map_claims.go b/vendor/github.com/golang-jwt/jwt/v4/map_claims.go
deleted file mode 100644
index 5529da4..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/map_claims.go
+++ /dev/null
@@ -1,239 +0,0 @@
-package jwt
-
-import (
- "encoding/json"
- "errors"
- "time"
-)
-
-// MapClaims is a claims type that uses the map[string]interface{} for JSON decoding.
-
-// This is the default claims type if you don't supply one
-
-type MapClaims map[string]interface{}
-
-// VerifyAudience Compares the aud claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (m MapClaims) VerifyAudience(cmp string, req bool) bool {
-
- var aud []string
-
- switch v := m["aud"].(type) {
-
- case string:
-
- aud = append(aud, v)
-
- case []string:
-
- aud = v
-
- case []interface{}:
-
- for _, a := range v {
-
- vs, ok := a.(string)
-
- if !ok {
-
- return false
-
- }
-
- aud = append(aud, vs)
-
- }
-
- }
-
- return verifyAud(aud, cmp, req)
-
-}
-
-// VerifyExpiresAt compares the exp claim against cmp (cmp <= exp).
-
-// If req is false, it will return true, if exp is unset.
-
-func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool {
-
- cmpTime := time.Unix(cmp, 0)
-
- v, ok := m["exp"]
-
- if !ok {
-
- return !req
-
- }
-
- switch exp := v.(type) {
-
- case float64:
-
- if exp == 0 {
-
- return verifyExp(nil, cmpTime, req)
-
- }
-
- return verifyExp(&newNumericDateFromSeconds(exp).Time, cmpTime, req)
-
- case json.Number:
-
- v, _ := exp.Float64()
-
- return verifyExp(&newNumericDateFromSeconds(v).Time, cmpTime, req)
-
- }
-
- return false
-
-}
-
-// VerifyIssuedAt compares the exp claim against cmp (cmp >= iat).
-
-// If req is false, it will return true, if iat is unset.
-
-func (m MapClaims) VerifyIssuedAt(cmp int64, req bool) bool {
-
- cmpTime := time.Unix(cmp, 0)
-
- v, ok := m["iat"]
-
- if !ok {
-
- return !req
-
- }
-
- switch iat := v.(type) {
-
- case float64:
-
- if iat == 0 {
-
- return verifyIat(nil, cmpTime, req)
-
- }
-
- return verifyIat(&newNumericDateFromSeconds(iat).Time, cmpTime, req)
-
- case json.Number:
-
- v, _ := iat.Float64()
-
- return verifyIat(&newNumericDateFromSeconds(v).Time, cmpTime, req)
-
- }
-
- return false
-
-}
-
-// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf).
-
-// If req is false, it will return true, if nbf is unset.
-
-func (m MapClaims) VerifyNotBefore(cmp int64, req bool) bool {
-
- cmpTime := time.Unix(cmp, 0)
-
- v, ok := m["nbf"]
-
- if !ok {
-
- return !req
-
- }
-
- switch nbf := v.(type) {
-
- case float64:
-
- if nbf == 0 {
-
- return verifyNbf(nil, cmpTime, req)
-
- }
-
- return verifyNbf(&newNumericDateFromSeconds(nbf).Time, cmpTime, req)
-
- case json.Number:
-
- v, _ := nbf.Float64()
-
- return verifyNbf(&newNumericDateFromSeconds(v).Time, cmpTime, req)
-
- }
-
- return false
-
-}
-
-// VerifyIssuer compares the iss claim against cmp.
-
-// If required is false, this method will return true if the value matches or is unset
-
-func (m MapClaims) VerifyIssuer(cmp string, req bool) bool {
-
- iss, _ := m["iss"].(string)
-
- return verifyIss(iss, cmp, req)
-
-}
-
-// Valid validates time based claims "exp, iat, nbf".
-
-// There is no accounting for clock skew.
-
-// As well, if any of the above claims are not in the token, it will still
-
-// be considered a valid claim.
-
-func (m MapClaims) Valid() error {
-
- vErr := new(ValidationError)
-
- now := TimeFunc().Unix()
-
- if !m.VerifyExpiresAt(now, false) {
-
- // TODO(oxisto): this should be replaced with ErrTokenExpired
-
- vErr.Inner = errors.New("Token is expired")
-
- vErr.Errors |= ValidationErrorExpired
-
- }
-
- if !m.VerifyIssuedAt(now, false) {
-
- // TODO(oxisto): this should be replaced with ErrTokenUsedBeforeIssued
-
- vErr.Inner = errors.New("Token used before issued")
-
- vErr.Errors |= ValidationErrorIssuedAt
-
- }
-
- if !m.VerifyNotBefore(now, false) {
-
- // TODO(oxisto): this should be replaced with ErrTokenNotValidYet
-
- vErr.Inner = errors.New("Token is not valid yet")
-
- vErr.Errors |= ValidationErrorNotValidYet
-
- }
-
- if vErr.valid() {
-
- return nil
-
- }
-
- return vErr
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/none.go b/vendor/github.com/golang-jwt/jwt/v4/none.go
deleted file mode 100644
index f19835d..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/none.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package jwt
-
-// SigningMethodNone implements the none signing method. This is required by the spec
-// but you probably should never use it.
-var SigningMethodNone *signingMethodNone
-
-const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed"
-
-var NoneSignatureTypeDisallowedError error
-
-type signingMethodNone struct{}
-type unsafeNoneMagicConstant string
-
-func init() {
- SigningMethodNone = &signingMethodNone{}
- NoneSignatureTypeDisallowedError = NewValidationError("'none' signature type is not allowed", ValidationErrorSignatureInvalid)
-
- RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod {
- return SigningMethodNone
- })
-}
-
-func (m *signingMethodNone) Alg() string {
- return "none"
-}
-
-// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key
-func (m *signingMethodNone) Verify(signingString, signature string, key interface{}) (err error) {
- // Key must be UnsafeAllowNoneSignatureType to prevent accidentally
- // accepting 'none' signing method
- if _, ok := key.(unsafeNoneMagicConstant); !ok {
- return NoneSignatureTypeDisallowedError
- }
- // If signing method is none, signature must be an empty string
- if signature != "" {
- return NewValidationError(
- "'none' signing method with non-empty signature",
- ValidationErrorSignatureInvalid,
- )
- }
-
- // Accept 'none' signing method.
- return nil
-}
-
-// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key
-func (m *signingMethodNone) Sign(signingString string, key interface{}) (string, error) {
- if _, ok := key.(unsafeNoneMagicConstant); ok {
- return "", nil
- }
- return "", NoneSignatureTypeDisallowedError
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/parser.go b/vendor/github.com/golang-jwt/jwt/v4/parser.go
deleted file mode 100644
index dffbefc..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/parser.go
+++ /dev/null
@@ -1,299 +0,0 @@
-package jwt
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "strings"
-)
-
-type Parser struct {
-
- // If populated, only these methods will be considered valid.
-
- //
-
- // Deprecated: In future releases, this field will not be exported anymore and should be set with an option to NewParser instead.
-
- ValidMethods []string
-
- // Use JSON Number format in JSON decoder.
-
- //
-
- // Deprecated: In future releases, this field will not be exported anymore and should be set with an option to NewParser instead.
-
- UseJSONNumber bool
-
- // Skip claims validation during token parsing.
-
- //
-
- // Deprecated: In future releases, this field will not be exported anymore and should be set with an option to NewParser instead.
-
- SkipClaimsValidation bool
-}
-
-// NewParser creates a new Parser with the specified options
-
-func NewParser(options ...ParserOption) *Parser {
-
- p := &Parser{}
-
- // loop through our parsing options and apply them
-
- for _, option := range options {
-
- option(p)
-
- }
-
- return p
-
-}
-
-// Parse parses, validates, verifies the signature and returns the parsed token.
-
-// keyFunc will receive the parsed token and should return the key for validating.
-
-func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
-
- return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc)
-
-}
-
-// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object implementing the Claims
-
-// interface. This provides default values which can be overridden and allows a caller to use their own type, rather
-
-// than the default MapClaims implementation of Claims.
-
-//
-
-// Note: If you provide a custom claim implementation that embeds one of the standard claims (such as RegisteredClaims),
-
-// make sure that a) you either embed a non-pointer version of the claims or b) if you are using a pointer, allocate the
-
-// proper memory for it before passing in the overall claims, otherwise you might run into a panic.
-
-func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) {
-
- token, parts, err := p.ParseUnverified(tokenString, claims)
-
- if err != nil {
-
- return token, err
-
- }
-
- // Verify signing method is in the required set
-
- if p.ValidMethods != nil {
-
- var signingMethodValid = false
-
- var alg = token.Method.Alg()
-
- for _, m := range p.ValidMethods {
-
- if m == alg {
-
- signingMethodValid = true
-
- break
-
- }
-
- }
-
- if !signingMethodValid {
-
- // signing method is not in the listed set
-
- return token, NewValidationError(fmt.Sprintf("signing method %v is invalid", alg), ValidationErrorSignatureInvalid)
-
- }
-
- }
-
- // Lookup key
-
- var key interface{}
-
- if keyFunc == nil {
-
- // keyFunc was not provided. short circuiting validation
-
- return token, NewValidationError("no Keyfunc was provided.", ValidationErrorUnverifiable)
-
- }
-
- if key, err = keyFunc(token); err != nil {
-
- // keyFunc returned an error
-
- if ve, ok := err.(*ValidationError); ok {
-
- return token, ve
-
- }
-
- return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable}
-
- }
-
- vErr := &ValidationError{}
-
- // Validate Claims
-
- if !p.SkipClaimsValidation {
-
- if err := token.Claims.Valid(); err != nil {
-
- // If the Claims Valid returned an error, check if it is a validation error,
-
- // If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set
-
- if e, ok := err.(*ValidationError); !ok {
-
- vErr = &ValidationError{Inner: err, Errors: ValidationErrorClaimsInvalid}
-
- } else {
-
- vErr = e
-
- }
-
- }
-
- }
-
- // Perform validation
-
- token.Signature = parts[2]
-
- if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
-
- vErr.Inner = err
-
- vErr.Errors |= ValidationErrorSignatureInvalid
-
- }
-
- if vErr.valid() {
-
- token.Valid = true
-
- return token, nil
-
- }
-
- return token, vErr
-
-}
-
-// ParseUnverified parses the token but doesn't validate the signature.
-
-//
-
-// WARNING: Don't use this method unless you know what you're doing.
-
-//
-
-// It's only ever useful in cases where you know the signature is valid (because it has
-
-// been checked previously in the stack) and you want to extract values from it.
-
-func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error) {
-
- parts = strings.Split(tokenString, ".")
-
- if len(parts) != 3 {
-
- return nil, parts, NewValidationError("token contains an invalid number of segments", ValidationErrorMalformed)
-
- }
-
- token = &Token{Raw: tokenString}
-
- // parse Header
-
- var headerBytes []byte
-
- if headerBytes, err = DecodeSegment(parts[0]); err != nil {
-
- if strings.HasPrefix(strings.ToLower(tokenString), "bearer ") {
-
- return token, parts, NewValidationError("tokenstring should not contain 'bearer '", ValidationErrorMalformed)
-
- }
-
- return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
-
- }
-
- if err = json.Unmarshal(headerBytes, &token.Header); err != nil {
-
- return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
-
- }
-
- // parse Claims
-
- var claimBytes []byte
-
- token.Claims = claims
-
- if claimBytes, err = DecodeSegment(parts[1]); err != nil {
-
- return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
-
- }
-
- dec := json.NewDecoder(bytes.NewBuffer(claimBytes))
-
- if p.UseJSONNumber {
-
- dec.UseNumber()
-
- }
-
- // JSON Decode. Special case for map type to avoid weird pointer behavior
-
- if c, ok := token.Claims.(MapClaims); ok {
-
- err = dec.Decode(&c)
-
- } else {
-
- err = dec.Decode(&claims)
-
- }
-
- // Handle decode error
-
- if err != nil {
-
- return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
-
- }
-
- // Lookup signature method
-
- if method, ok := token.Header["alg"].(string); ok {
-
- if token.Method = GetSigningMethod(method); token.Method == nil {
-
- return token, parts, NewValidationError("signing method (alg) is unavailable.", ValidationErrorUnverifiable)
-
- }
-
- } else {
-
- return token, parts, NewValidationError("signing method (alg) is unspecified.", ValidationErrorUnverifiable)
-
- }
-
- return token, parts, nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/parser_option.go b/vendor/github.com/golang-jwt/jwt/v4/parser_option.go
deleted file mode 100644
index 6ea6f95..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/parser_option.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package jwt
-
-// ParserOption is used to implement functional-style options that modify the behavior of the parser. To add
-// new options, just create a function (ideally beginning with With or Without) that returns an anonymous function that
-// takes a *Parser type as input and manipulates its configuration accordingly.
-type ParserOption func(*Parser)
-
-// WithValidMethods is an option to supply algorithm methods that the parser will check. Only those methods will be considered valid.
-// It is heavily encouraged to use this option in order to prevent attacks such as https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/.
-func WithValidMethods(methods []string) ParserOption {
- return func(p *Parser) {
- p.ValidMethods = methods
- }
-}
-
-// WithJSONNumber is an option to configure the underlying JSON parser with UseNumber
-func WithJSONNumber() ParserOption {
- return func(p *Parser) {
- p.UseJSONNumber = true
- }
-}
-
-// WithoutClaimsValidation is an option to disable claims validation. This option should only be used if you exactly know
-// what you are doing.
-func WithoutClaimsValidation() ParserOption {
- return func(p *Parser) {
- p.SkipClaimsValidation = true
- }
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/rsa.go b/vendor/github.com/golang-jwt/jwt/v4/rsa.go
deleted file mode 100644
index e062427..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/rsa.go
+++ /dev/null
@@ -1,157 +0,0 @@
-package jwt
-
-import (
- "crypto"
- "crypto/rand"
- "crypto/rsa"
-)
-
-// SigningMethodRSA implements the RSA family of signing methods.
-
-// Expects *rsa.PrivateKey for signing and *rsa.PublicKey for validation
-
-type SigningMethodRSA struct {
- Name string
-
- Hash crypto.Hash
-}
-
-// Specific instances for RS256 and company
-
-var (
- SigningMethodRS256 *SigningMethodRSA
-
- SigningMethodRS384 *SigningMethodRSA
-
- SigningMethodRS512 *SigningMethodRSA
-)
-
-func init() {
-
- // RS256
-
- SigningMethodRS256 = &SigningMethodRSA{"RS256", crypto.SHA256}
-
- RegisterSigningMethod(SigningMethodRS256.Alg(), func() SigningMethod {
-
- return SigningMethodRS256
-
- })
-
- // RS384
-
- SigningMethodRS384 = &SigningMethodRSA{"RS384", crypto.SHA384}
-
- RegisterSigningMethod(SigningMethodRS384.Alg(), func() SigningMethod {
-
- return SigningMethodRS384
-
- })
-
- // RS512
-
- SigningMethodRS512 = &SigningMethodRSA{"RS512", crypto.SHA512}
-
- RegisterSigningMethod(SigningMethodRS512.Alg(), func() SigningMethod {
-
- return SigningMethodRS512
-
- })
-
-}
-
-func (m *SigningMethodRSA) Alg() string {
-
- return m.Name
-
-}
-
-// Verify implements token verification for the SigningMethod
-
-// For this signing method, must be an *rsa.PublicKey structure.
-
-func (m *SigningMethodRSA) Verify(signingString, signature string, key interface{}) error {
-
- var err error
-
- // Decode the signature
-
- var sig []byte
-
- if sig, err = DecodeSegment(signature); err != nil {
-
- return err
-
- }
-
- var rsaKey *rsa.PublicKey
-
- var ok bool
-
- if rsaKey, ok = key.(*rsa.PublicKey); !ok {
-
- return ErrInvalidKeyType
-
- }
-
- // Create hasher
-
- if !m.Hash.Available() {
-
- return ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Verify the signature
-
- return rsa.VerifyPKCS1v15(rsaKey, m.Hash, hasher.Sum(nil), sig)
-
-}
-
-// Sign implements token signing for the SigningMethod
-
-// For this signing method, must be an *rsa.PrivateKey structure.
-
-func (m *SigningMethodRSA) Sign(signingString string, key interface{}) (string, error) {
-
- var rsaKey *rsa.PrivateKey
-
- var ok bool
-
- // Validate type of key
-
- if rsaKey, ok = key.(*rsa.PrivateKey); !ok {
-
- return "", ErrInvalidKey
-
- }
-
- // Create the hasher
-
- if !m.Hash.Available() {
-
- return "", ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Sign the string and return the encoded bytes
-
- if sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil {
-
- return EncodeSegment(sigBytes), nil
-
- } else {
-
- return "", err
-
- }
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go b/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go
deleted file mode 100644
index a7a5c79..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go
+++ /dev/null
@@ -1,228 +0,0 @@
-//go:build go1.4
-// +build go1.4
-
-package jwt
-
-import (
- "crypto"
- "crypto/rand"
- "crypto/rsa"
-)
-
-// SigningMethodRSAPSS implements the RSAPSS family of signing methods signing methods
-
-type SigningMethodRSAPSS struct {
- *SigningMethodRSA
-
- Options *rsa.PSSOptions
-
- // VerifyOptions is optional. If set overrides Options for rsa.VerifyPPS.
-
- // Used to accept tokens signed with rsa.PSSSaltLengthAuto, what doesn't follow
-
- // https://tools.ietf.org/html/rfc7518#section-3.5 but was used previously.
-
- // See https://github.com/dgrijalva/jwt-go/issues/285#issuecomment-437451244 for details.
-
- VerifyOptions *rsa.PSSOptions
-}
-
-// Specific instances for RS/PS and company.
-
-var (
- SigningMethodPS256 *SigningMethodRSAPSS
-
- SigningMethodPS384 *SigningMethodRSAPSS
-
- SigningMethodPS512 *SigningMethodRSAPSS
-)
-
-func init() {
-
- // PS256
-
- SigningMethodPS256 = &SigningMethodRSAPSS{
-
- SigningMethodRSA: &SigningMethodRSA{
-
- Name: "PS256",
-
- Hash: crypto.SHA256,
- },
-
- Options: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthEqualsHash,
- },
-
- VerifyOptions: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthAuto,
- },
- }
-
- RegisterSigningMethod(SigningMethodPS256.Alg(), func() SigningMethod {
-
- return SigningMethodPS256
-
- })
-
- // PS384
-
- SigningMethodPS384 = &SigningMethodRSAPSS{
-
- SigningMethodRSA: &SigningMethodRSA{
-
- Name: "PS384",
-
- Hash: crypto.SHA384,
- },
-
- Options: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthEqualsHash,
- },
-
- VerifyOptions: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthAuto,
- },
- }
-
- RegisterSigningMethod(SigningMethodPS384.Alg(), func() SigningMethod {
-
- return SigningMethodPS384
-
- })
-
- // PS512
-
- SigningMethodPS512 = &SigningMethodRSAPSS{
-
- SigningMethodRSA: &SigningMethodRSA{
-
- Name: "PS512",
-
- Hash: crypto.SHA512,
- },
-
- Options: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthEqualsHash,
- },
-
- VerifyOptions: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthAuto,
- },
- }
-
- RegisterSigningMethod(SigningMethodPS512.Alg(), func() SigningMethod {
-
- return SigningMethodPS512
-
- })
-
-}
-
-// Verify implements token verification for the SigningMethod.
-
-// For this verify method, key must be an rsa.PublicKey struct
-
-func (m *SigningMethodRSAPSS) Verify(signingString, signature string, key interface{}) error {
-
- var err error
-
- // Decode the signature
-
- var sig []byte
-
- if sig, err = DecodeSegment(signature); err != nil {
-
- return err
-
- }
-
- var rsaKey *rsa.PublicKey
-
- switch k := key.(type) {
-
- case *rsa.PublicKey:
-
- rsaKey = k
-
- default:
-
- return ErrInvalidKey
-
- }
-
- // Create hasher
-
- if !m.Hash.Available() {
-
- return ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- opts := m.Options
-
- if m.VerifyOptions != nil {
-
- opts = m.VerifyOptions
-
- }
-
- return rsa.VerifyPSS(rsaKey, m.Hash, hasher.Sum(nil), sig, opts)
-
-}
-
-// Sign implements token signing for the SigningMethod.
-
-// For this signing method, key must be an rsa.PrivateKey struct
-
-func (m *SigningMethodRSAPSS) Sign(signingString string, key interface{}) (string, error) {
-
- var rsaKey *rsa.PrivateKey
-
- switch k := key.(type) {
-
- case *rsa.PrivateKey:
-
- rsaKey = k
-
- default:
-
- return "", ErrInvalidKeyType
-
- }
-
- // Create the hasher
-
- if !m.Hash.Available() {
-
- return "", ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Sign the string and return the encoded bytes
-
- if sigBytes, err := rsa.SignPSS(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil), m.Options); err == nil {
-
- return EncodeSegment(sigBytes), nil
-
- } else {
-
- return "", err
-
- }
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/rsa_utils.go b/vendor/github.com/golang-jwt/jwt/v4/rsa_utils.go
deleted file mode 100644
index d574e76..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/rsa_utils.go
+++ /dev/null
@@ -1,164 +0,0 @@
-package jwt
-
-import (
- "crypto/rsa"
- "crypto/x509"
- "encoding/pem"
- "errors"
-)
-
-var (
- ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key")
-
- ErrNotRSAPrivateKey = errors.New("key is not a valid RSA private key")
-
- ErrNotRSAPublicKey = errors.New("key is not a valid RSA public key")
-)
-
-// ParseRSAPrivateKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 private key
-
-func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil {
-
- if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
-
- return nil, err
-
- }
-
- }
-
- var pkey *rsa.PrivateKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok {
-
- return nil, ErrNotRSAPrivateKey
-
- }
-
- return pkey, nil
-
-}
-
-// ParseRSAPrivateKeyFromPEMWithPassword parses a PEM encoded PKCS1 or PKCS8 private key protected with password
-
-//
-
-// Deprecated: This function is deprecated and should not be used anymore. It uses the deprecated x509.DecryptPEMBlock
-
-// function, which was deprecated since RFC 1423 is regarded insecure by design. Unfortunately, there is no alternative
-
-// in the Go standard library for now. See https://github.com/golang/go/issues/8860.
-
-func ParseRSAPrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- var parsedKey interface{}
-
- var blockDecrypted []byte
-
- if blockDecrypted, err = x509.DecryptPEMBlock(block, []byte(password)); err != nil {
-
- return nil, err
-
- }
-
- if parsedKey, err = x509.ParsePKCS1PrivateKey(blockDecrypted); err != nil {
-
- if parsedKey, err = x509.ParsePKCS8PrivateKey(blockDecrypted); err != nil {
-
- return nil, err
-
- }
-
- }
-
- var pkey *rsa.PrivateKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok {
-
- return nil, ErrNotRSAPrivateKey
-
- }
-
- return pkey, nil
-
-}
-
-// ParseRSAPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key
-
-func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
-
- if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
-
- parsedKey = cert.PublicKey
-
- } else {
-
- return nil, err
-
- }
-
- }
-
- var pkey *rsa.PublicKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*rsa.PublicKey); !ok {
-
- return nil, ErrNotRSAPublicKey
-
- }
-
- return pkey, nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/signing_method.go b/vendor/github.com/golang-jwt/jwt/v4/signing_method.go
deleted file mode 100644
index 241ae9c..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/signing_method.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package jwt
-
-import (
- "sync"
-)
-
-var signingMethods = map[string]func() SigningMethod{}
-var signingMethodLock = new(sync.RWMutex)
-
-// SigningMethod can be used add new methods for signing or verifying tokens.
-type SigningMethod interface {
- Verify(signingString, signature string, key interface{}) error // Returns nil if signature is valid
- Sign(signingString string, key interface{}) (string, error) // Returns encoded signature or error
- Alg() string // returns the alg identifier for this method (example: 'HS256')
-}
-
-// RegisterSigningMethod registers the "alg" name and a factory function for signing method.
-// This is typically done during init() in the method's implementation
-func RegisterSigningMethod(alg string, f func() SigningMethod) {
- signingMethodLock.Lock()
- defer signingMethodLock.Unlock()
-
- signingMethods[alg] = f
-}
-
-// GetSigningMethod retrieves a signing method from an "alg" string
-func GetSigningMethod(alg string) (method SigningMethod) {
- signingMethodLock.RLock()
- defer signingMethodLock.RUnlock()
-
- if methodF, ok := signingMethods[alg]; ok {
- method = methodF()
- }
- return
-}
-
-// GetAlgorithms returns a list of registered "alg" names
-func GetAlgorithms() (algs []string) {
- signingMethodLock.RLock()
- defer signingMethodLock.RUnlock()
-
- for alg := range signingMethods {
- algs = append(algs, alg)
- }
- return
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/staticcheck.conf b/vendor/github.com/golang-jwt/jwt/v4/staticcheck.conf
deleted file mode 100644
index 53745d5..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/staticcheck.conf
+++ /dev/null
@@ -1 +0,0 @@
-checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1023"]
diff --git a/vendor/github.com/golang-jwt/jwt/v4/token.go b/vendor/github.com/golang-jwt/jwt/v4/token.go
deleted file mode 100644
index d9e82b1..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/token.go
+++ /dev/null
@@ -1,239 +0,0 @@
-package jwt
-
-import (
- "encoding/base64"
- "encoding/json"
- "strings"
- "time"
-)
-
-// DecodePaddingAllowed will switch the codec used for decoding JWTs respectively. Note that the JWS RFC7515
-
-// states that the tokens will utilize a Base64url encoding with no padding. Unfortunately, some implementations
-
-// of JWT are producing non-standard tokens, and thus require support for decoding. Note that this is a global
-
-// variable, and updating it will change the behavior on a package level, and is also NOT go-routine safe.
-
-// To use the non-recommended decoding, set this boolean to `true` prior to using this package.
-
-var DecodePaddingAllowed bool
-
-// DecodeStrict will switch the codec used for decoding JWTs into strict mode.
-
-// In this mode, the decoder requires that trailing padding bits are zero, as described in RFC 4648 section 3.5.
-
-// Note that this is a global variable, and updating it will change the behavior on a package level, and is also NOT go-routine safe.
-
-// To use strict decoding, set this boolean to `true` prior to using this package.
-
-var DecodeStrict bool
-
-// TimeFunc provides the current time when parsing token to validate "exp" claim (expiration time).
-
-// You can override it to use another time value. This is useful for testing or if your
-
-// server uses a different time zone than your tokens.
-
-var TimeFunc = time.Now
-
-// Keyfunc will be used by the Parse methods as a callback function to supply
-
-// the key for verification. The function receives the parsed,
-
-// but unverified Token. This allows you to use properties in the
-
-// Header of the token (such as `kid`) to identify which key to use.
-
-type Keyfunc func(*Token) (interface{}, error)
-
-// Token represents a JWT Token. Different fields will be used depending on whether you're
-
-// creating or parsing/verifying a token.
-
-type Token struct {
- Raw string // The raw token. Populated when you Parse a token
-
- Method SigningMethod // The signing method used or to be used
-
- Header map[string]interface{} // The first segment of the token
-
- Claims Claims // The second segment of the token
-
- Signature string // The third segment of the token. Populated when you Parse a token
-
- Valid bool // Is the token valid? Populated when you Parse/Verify a token
-
-}
-
-// New creates a new Token with the specified signing method and an empty map of claims.
-
-func New(method SigningMethod) *Token {
-
- return NewWithClaims(method, MapClaims{})
-
-}
-
-// NewWithClaims creates a new Token with the specified signing method and claims.
-
-func NewWithClaims(method SigningMethod, claims Claims) *Token {
-
- return &Token{
-
- Header: map[string]interface{}{
-
- "typ": "JWT",
-
- "alg": method.Alg(),
- },
-
- Claims: claims,
-
- Method: method,
- }
-
-}
-
-// SignedString creates and returns a complete, signed JWT.
-
-// The token is signed using the SigningMethod specified in the token.
-
-func (t *Token) SignedString(key interface{}) (string, error) {
-
- var sig, sstr string
-
- var err error
-
- if sstr, err = t.SigningString(); err != nil {
-
- return "", err
-
- }
-
- if sig, err = t.Method.Sign(sstr, key); err != nil {
-
- return "", err
-
- }
-
- return strings.Join([]string{sstr, sig}, "."), nil
-
-}
-
-// SigningString generates the signing string. This is the
-
-// most expensive part of the whole deal. Unless you
-
-// need this for something special, just go straight for
-
-// the SignedString.
-
-func (t *Token) SigningString() (string, error) {
-
- var err error
-
- var jsonValue []byte
-
- if jsonValue, err = json.Marshal(t.Header); err != nil {
-
- return "", err
-
- }
-
- header := EncodeSegment(jsonValue)
-
- if jsonValue, err = json.Marshal(t.Claims); err != nil {
-
- return "", err
-
- }
-
- claim := EncodeSegment(jsonValue)
-
- return strings.Join([]string{header, claim}, "."), nil
-
-}
-
-// Parse parses, validates, verifies the signature and returns the parsed token.
-
-// keyFunc will receive the parsed token and should return the cryptographic key
-
-// for verifying the signature.
-
-// The caller is strongly encouraged to set the WithValidMethods option to
-
-// validate the 'alg' claim in the token matches the expected algorithm.
-
-// For more details about the importance of validating the 'alg' claim,
-
-// see https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/
-
-func Parse(tokenString string, keyFunc Keyfunc, options ...ParserOption) (*Token, error) {
-
- return NewParser(options...).Parse(tokenString, keyFunc)
-
-}
-
-// ParseWithClaims is a shortcut for NewParser().ParseWithClaims().
-
-//
-
-// Note: If you provide a custom claim implementation that embeds one of the standard claims (such as RegisteredClaims),
-
-// make sure that a) you either embed a non-pointer version of the claims or b) if you are using a pointer, allocate the
-
-// proper memory for it before passing in the overall claims, otherwise you might run into a panic.
-
-func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc, options ...ParserOption) (*Token, error) {
-
- return NewParser(options...).ParseWithClaims(tokenString, claims, keyFunc)
-
-}
-
-// EncodeSegment encodes a JWT specific base64url encoding with padding stripped
-
-//
-
-// Deprecated: In a future release, we will demote this function to a non-exported function, since it
-
-// should only be used internally
-
-func EncodeSegment(seg []byte) string {
-
- return base64.RawURLEncoding.EncodeToString(seg)
-
-}
-
-// DecodeSegment decodes a JWT specific base64url encoding with padding stripped
-
-//
-
-// Deprecated: In a future release, we will demote this function to a non-exported function, since it
-
-// should only be used internally
-
-func DecodeSegment(seg string) ([]byte, error) {
-
- encoding := base64.RawURLEncoding
-
- if DecodePaddingAllowed {
-
- if l := len(seg) % 4; l > 0 {
-
- seg += strings.Repeat("=", 4-l)
-
- }
-
- encoding = base64.URLEncoding
-
- }
-
- if DecodeStrict {
-
- encoding = encoding.Strict()
-
- }
-
- return encoding.DecodeString(seg)
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v4/types.go b/vendor/github.com/golang-jwt/jwt/v4/types.go
deleted file mode 100644
index 30bdd5d..0000000
--- a/vendor/github.com/golang-jwt/jwt/v4/types.go
+++ /dev/null
@@ -1,230 +0,0 @@
-package jwt
-
-import (
- "encoding/json"
- "fmt"
- "math"
- "reflect"
- "strconv"
- "time"
-)
-
-// TimePrecision sets the precision of times and dates within this library.
-
-// This has an influence on the precision of times when comparing expiry or
-
-// other related time fields. Furthermore, it is also the precision of times
-
-// when serializing.
-
-//
-
-// For backwards compatibility the default precision is set to seconds, so that
-
-// no fractional timestamps are generated.
-
-var TimePrecision = time.Second
-
-// MarshalSingleStringAsArray modifies the behaviour of the ClaimStrings type, especially
-
-// its MarshalJSON function.
-
-//
-
-// If it is set to true (the default), it will always serialize the type as an
-
-// array of strings, even if it just contains one element, defaulting to the behaviour
-
-// of the underlying []string. If it is set to false, it will serialize to a single
-
-// string, if it contains one element. Otherwise, it will serialize to an array of strings.
-
-var MarshalSingleStringAsArray = true
-
-// NumericDate represents a JSON numeric date value, as referenced at
-
-// https://datatracker.ietf.org/doc/html/rfc7519#section-2.
-
-type NumericDate struct {
- time.Time
-}
-
-// NewNumericDate constructs a new *NumericDate from a standard library time.Time struct.
-
-// It will truncate the timestamp according to the precision specified in TimePrecision.
-
-func NewNumericDate(t time.Time) *NumericDate {
-
- return &NumericDate{t.Truncate(TimePrecision)}
-
-}
-
-// newNumericDateFromSeconds creates a new *NumericDate out of a float64 representing a
-
-// UNIX epoch with the float fraction representing non-integer seconds.
-
-func newNumericDateFromSeconds(f float64) *NumericDate {
-
- round, frac := math.Modf(f)
-
- return NewNumericDate(time.Unix(int64(round), int64(frac*1e9)))
-
-}
-
-// MarshalJSON is an implementation of the json.RawMessage interface and serializes the UNIX epoch
-
-// represented in NumericDate to a byte array, using the precision specified in TimePrecision.
-
-func (date NumericDate) MarshalJSON() (b []byte, err error) {
-
- var prec int
-
- if TimePrecision < time.Second {
-
- prec = int(math.Log10(float64(time.Second) / float64(TimePrecision)))
-
- }
-
- truncatedDate := date.Truncate(TimePrecision)
-
- // For very large timestamps, UnixNano would overflow an int64, but this
-
- // function requires nanosecond level precision, so we have to use the
-
- // following technique to get round the issue:
-
- // 1. Take the normal unix timestamp to form the whole number part of the
-
- // output,
-
- // 2. Take the result of the Nanosecond function, which retuns the offset
-
- // within the second of the particular unix time instance, to form the
-
- // decimal part of the output
-
- // 3. Concatenate them to produce the final result
-
- seconds := strconv.FormatInt(truncatedDate.Unix(), 10)
-
- nanosecondsOffset := strconv.FormatFloat(float64(truncatedDate.Nanosecond())/float64(time.Second), 'f', prec, 64)
-
- output := append([]byte(seconds), []byte(nanosecondsOffset)[1:]...)
-
- return output, nil
-
-}
-
-// UnmarshalJSON is an implementation of the json.RawMessage interface and deserializses a
-
-// NumericDate from a JSON representation, i.e. a json.Number. This number represents an UNIX epoch
-
-// with either integer or non-integer seconds.
-
-func (date *NumericDate) UnmarshalJSON(b []byte) (err error) {
-
- var (
- number json.Number
-
- f float64
- )
-
- if err = json.Unmarshal(b, &number); err != nil {
-
- return fmt.Errorf("could not parse NumericData: %w", err)
-
- }
-
- if f, err = number.Float64(); err != nil {
-
- return fmt.Errorf("could not convert json number value to float: %w", err)
-
- }
-
- n := newNumericDateFromSeconds(f)
-
- *date = *n
-
- return nil
-
-}
-
-// ClaimStrings is basically just a slice of strings, but it can be either serialized from a string array or just a string.
-
-// This type is necessary, since the "aud" claim can either be a single string or an array.
-
-type ClaimStrings []string
-
-func (s *ClaimStrings) UnmarshalJSON(data []byte) (err error) {
-
- var value interface{}
-
- if err = json.Unmarshal(data, &value); err != nil {
-
- return err
-
- }
-
- var aud []string
-
- switch v := value.(type) {
-
- case string:
-
- aud = append(aud, v)
-
- case []string:
-
- aud = ClaimStrings(v)
-
- case []interface{}:
-
- for _, vv := range v {
-
- vs, ok := vv.(string)
-
- if !ok {
-
- return &json.UnsupportedTypeError{Type: reflect.TypeOf(vv)}
-
- }
-
- aud = append(aud, vs)
-
- }
-
- case nil:
-
- return nil
-
- default:
-
- return &json.UnsupportedTypeError{Type: reflect.TypeOf(v)}
-
- }
-
- *s = aud
-
- return
-
-}
-
-func (s ClaimStrings) MarshalJSON() (b []byte, err error) {
-
- // This handles a special case in the JWT RFC. If the string array, e.g. used by the "aud" field,
-
- // only contains one element, it MAY be serialized as a single string. This may or may not be
-
- // desired based on the ecosystem of other JWT library used, so we make it configurable by the
-
- // variable MarshalSingleStringAsArray.
-
- if len(s) == 1 && !MarshalSingleStringAsArray {
-
- return json.Marshal(s[0])
-
- }
-
- return json.Marshal([]string(s))
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/.gitignore b/vendor/github.com/golang-jwt/jwt/v5/.gitignore
deleted file mode 100644
index 09573e0..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.DS_Store
-bin
-.idea/
-
diff --git a/vendor/github.com/golang-jwt/jwt/v5/LICENSE b/vendor/github.com/golang-jwt/jwt/v5/LICENSE
deleted file mode 100644
index 35dbc25..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/LICENSE
+++ /dev/null
@@ -1,9 +0,0 @@
-Copyright (c) 2012 Dave Grijalva
-Copyright (c) 2021 golang-jwt maintainers
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
diff --git a/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md b/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md
deleted file mode 100644
index 6ad1c22..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md
+++ /dev/null
@@ -1,185 +0,0 @@
-# Migration Guide (v5.0.0)
-
-Version `v5` contains a major rework of core functionalities in the `jwt-go`
-library. This includes support for several validation options as well as a
-re-design of the `Claims` interface. Lastly, we reworked how errors work under
-the hood, which should provide a better overall developer experience.
-
-Starting from [v5.0.0](https://github.com/golang-jwt/jwt/releases/tag/v5.0.0),
-the import path will be:
-
- "github.com/golang-jwt/jwt/v5"
-
-For most users, changing the import path *should* suffice. However, since we
-intentionally changed and cleaned some of the public API, existing programs
-might need to be updated. The following sections describe significant changes
-and corresponding updates for existing programs.
-
-## Parsing and Validation Options
-
-Under the hood, a new `validator` struct takes care of validating the claims. A
-long awaited feature has been the option to fine-tune the validation of tokens.
-This is now possible with several `ParserOption` functions that can be appended
-to most `Parse` functions, such as `ParseWithClaims`. The most important options
-and changes are:
- * Added `WithLeeway` to support specifying the leeway that is allowed when
- validating time-based claims, such as `exp` or `nbf`.
- * Changed default behavior to not check the `iat` claim. Usage of this claim
- is OPTIONAL according to the JWT RFC. The claim itself is also purely
- informational according to the RFC, so a strict validation failure is not
- recommended. If you want to check for sensible values in these claims,
- please use the `WithIssuedAt` parser option.
- * Added `WithAudience`, `WithSubject` and `WithIssuer` to support checking for
- expected `aud`, `sub` and `iss`.
- * Added `WithStrictDecoding` and `WithPaddingAllowed` options to allow
- previously global settings to enable base64 strict encoding and the parsing
- of base64 strings with padding. The latter is strictly speaking against the
- standard, but unfortunately some of the major identity providers issue some
- of these incorrect tokens. Both options are disabled by default.
-
-## Changes to the `Claims` interface
-
-### Complete Restructuring
-
-Previously, the claims interface was satisfied with an implementation of a
-`Valid() error` function. This had several issues:
- * The different claim types (struct claims, map claims, etc.) then contained
- similar (but not 100 % identical) code of how this validation was done. This
- lead to a lot of (almost) duplicate code and was hard to maintain
- * It was not really semantically close to what a "claim" (or a set of claims)
- really is; which is a list of defined key/value pairs with a certain
- semantic meaning.
-
-Since all the validation functionality is now extracted into the validator, all
-`VerifyXXX` and `Valid` functions have been removed from the `Claims` interface.
-Instead, the interface now represents a list of getters to retrieve values with
-a specific meaning. This allows us to completely decouple the validation logic
-with the underlying storage representation of the claim, which could be a
-struct, a map or even something stored in a database.
-
-```go
-type Claims interface {
- GetExpirationTime() (*NumericDate, error)
- GetIssuedAt() (*NumericDate, error)
- GetNotBefore() (*NumericDate, error)
- GetIssuer() (string, error)
- GetSubject() (string, error)
- GetAudience() (ClaimStrings, error)
-}
-```
-
-### Supported Claim Types and Removal of `StandardClaims`
-
-The two standard claim types supported by this library, `MapClaims` and
-`RegisteredClaims` both implement the necessary functions of this interface. The
-old `StandardClaims` struct, which has already been deprecated in `v4` is now
-removed.
-
-Users using custom claims, in most cases, will not experience any changes in the
-behavior as long as they embedded `RegisteredClaims`. If they created a new
-claim type from scratch, they now need to implemented the proper getter
-functions.
-
-### Migrating Application Specific Logic of the old `Valid`
-
-Previously, users could override the `Valid` method in a custom claim, for
-example to extend the validation with application-specific claims. However, this
-was always very dangerous, since once could easily disable the standard
-validation and signature checking.
-
-In order to avoid that, while still supporting the use-case, a new
-`ClaimsValidator` interface has been introduced. This interface consists of the
-`Validate() error` function. If the validator sees, that a `Claims` struct
-implements this interface, the errors returned to the `Validate` function will
-be *appended* to the regular standard validation. It is not possible to disable
-the standard validation anymore (even only by accident).
-
-Usage examples can be found in [example_test.go](./example_test.go), to build
-claims structs like the following.
-
-```go
-// MyCustomClaims includes all registered claims, plus Foo.
-type MyCustomClaims struct {
- Foo string `json:"foo"`
- jwt.RegisteredClaims
-}
-
-// Validate can be used to execute additional application-specific claims
-// validation.
-func (m MyCustomClaims) Validate() error {
- if m.Foo != "bar" {
- return errors.New("must be foobar")
- }
-
- return nil
-}
-```
-
-## Changes to the `Token` and `Parser` struct
-
-The previously global functions `DecodeSegment` and `EncodeSegment` were moved
-to the `Parser` and `Token` struct respectively. This will allow us in the
-future to configure the behavior of these two based on options supplied on the
-parser or the token (creation). This also removes two previously global
-variables and moves them to parser options `WithStrictDecoding` and
-`WithPaddingAllowed`.
-
-In order to do that, we had to adjust the way signing methods work. Previously
-they were given a base64 encoded signature in `Verify` and were expected to
-return a base64 encoded version of the signature in `Sign`, both as a `string`.
-However, this made it necessary to have `DecodeSegment` and `EncodeSegment`
-global and was a less than perfect design because we were repeating
-encoding/decoding steps for all signing methods. Now, `Sign` and `Verify`
-operate on a decoded signature as a `[]byte`, which feels more natural for a
-cryptographic operation anyway. Lastly, `Parse` and `SignedString` take care of
-the final encoding/decoding part.
-
-In addition to that, we also changed the `Signature` field on `Token` from a
-`string` to `[]byte` and this is also now populated with the decoded form. This
-is also more consistent, because the other parts of the JWT, mainly `Header` and
-`Claims` were already stored in decoded form in `Token`. Only the signature was
-stored in base64 encoded form, which was redundant with the information in the
-`Raw` field, which contains the complete token as base64.
-
-```go
-type Token struct {
- Raw string // Raw contains the raw token
- Method SigningMethod // Method is the signing method used or to be used
- Header map[string]interface{} // Header is the first segment of the token in decoded form
- Claims Claims // Claims is the second segment of the token in decoded form
- Signature []byte // Signature is the third segment of the token in decoded form
- Valid bool // Valid specifies if the token is valid
-}
-```
-
-Most (if not all) of these changes should not impact the normal usage of this
-library. Only users directly accessing the `Signature` field as well as
-developers of custom signing methods should be affected.
-
-# Migration Guide (v4.0.0)
-
-Starting from [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0),
-the import path will be:
-
- "github.com/golang-jwt/jwt/v4"
-
-The `/v4` version will be backwards compatible with existing `v3.x.y` tags in
-this repo, as well as `github.com/dgrijalva/jwt-go`. For most users this should
-be a drop-in replacement, if you're having troubles migrating, please open an
-issue.
-
-You can replace all occurrences of `github.com/dgrijalva/jwt-go` or
-`github.com/golang-jwt/jwt` with `github.com/golang-jwt/jwt/v5`, either manually
-or by using tools such as `sed` or `gofmt`.
-
-And then you'd typically run:
-
-```
-go get github.com/golang-jwt/jwt/v4
-go mod tidy
-```
-
-# Older releases (before v3.2.0)
-
-The original migration guide for older releases can be found at
-https://github.com/dgrijalva/jwt-go/blob/master/MIGRATION_GUIDE.md.
diff --git a/vendor/github.com/golang-jwt/jwt/v5/README.md b/vendor/github.com/golang-jwt/jwt/v5/README.md
deleted file mode 100644
index 964598a..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/README.md
+++ /dev/null
@@ -1,167 +0,0 @@
-# jwt-go
-
-[![build](https://github.com/golang-jwt/jwt/actions/workflows/build.yml/badge.svg)](https://github.com/golang-jwt/jwt/actions/workflows/build.yml)
-[![Go
-Reference](https://pkg.go.dev/badge/github.com/golang-jwt/jwt/v5.svg)](https://pkg.go.dev/github.com/golang-jwt/jwt/v5)
-[![Coverage Status](https://coveralls.io/repos/github/golang-jwt/jwt/badge.svg?branch=main)](https://coveralls.io/github/golang-jwt/jwt?branch=main)
-
-A [go](http://www.golang.org) (or 'golang' for search engine friendliness)
-implementation of [JSON Web
-Tokens](https://datatracker.ietf.org/doc/html/rfc7519).
-
-Starting with [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0)
-this project adds Go module support, but maintains backwards compatibility with
-older `v3.x.y` tags and upstream `github.com/dgrijalva/jwt-go`. See the
-[`MIGRATION_GUIDE.md`](./MIGRATION_GUIDE.md) for more information. Version
-v5.0.0 introduces major improvements to the validation of tokens, but is not
-entirely backwards compatible.
-
-> After the original author of the library suggested migrating the maintenance
-> of `jwt-go`, a dedicated team of open source maintainers decided to clone the
-> existing library into this repository. See
-> [dgrijalva/jwt-go#462](https://github.com/dgrijalva/jwt-go/issues/462) for a
-> detailed discussion on this topic.
-
-
-**SECURITY NOTICE:** Some older versions of Go have a security issue in the
-crypto/elliptic. Recommendation is to upgrade to at least 1.15 See issue
-[dgrijalva/jwt-go#216](https://github.com/dgrijalva/jwt-go/issues/216) for more
-detail.
-
-**SECURITY NOTICE:** It's important that you [validate the `alg` presented is
-what you
-expect](https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/).
-This library attempts to make it easy to do the right thing by requiring key
-types match the expected alg, but you should take the extra step to verify it in
-your usage. See the examples provided.
-
-### Supported Go versions
-
-Our support of Go versions is aligned with Go's [version release
-policy](https://golang.org/doc/devel/release#policy). So we will support a major
-version of Go until there are two newer major releases. We no longer support
-building jwt-go with unsupported Go versions, as these contain security
-vulnerabilities which will not be fixed.
-
-## What the heck is a JWT?
-
-JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web
-Tokens.
-
-In short, it's a signed JSON object that does something useful (for example,
-authentication). It's commonly used for `Bearer` tokens in Oauth 2. A token is
-made of three parts, separated by `.`'s. The first two parts are JSON objects,
-that have been [base64url](https://datatracker.ietf.org/doc/html/rfc4648)
-encoded. The last part is the signature, encoded the same way.
-
-The first part is called the header. It contains the necessary information for
-verifying the last part, the signature. For example, which encryption method
-was used for signing and what key was used.
-
-The part in the middle is the interesting bit. It's called the Claims and
-contains the actual stuff you care about. Refer to [RFC
-7519](https://datatracker.ietf.org/doc/html/rfc7519) for information about
-reserved keys and the proper way to add your own.
-
-## What's in the box?
-
-This library supports the parsing and verification as well as the generation and
-signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA,
-RSA-PSS, and ECDSA, though hooks are present for adding your own.
-
-## Installation Guidelines
-
-1. To install the jwt package, you first need to have
- [Go](https://go.dev/doc/install) installed, then you can use the command
- below to add `jwt-go` as a dependency in your Go program.
-
-```sh
-go get -u github.com/golang-jwt/jwt/v5
-```
-
-2. Import it in your code:
-
-```go
-import "github.com/golang-jwt/jwt/v5"
-```
-
-## Usage
-
-A detailed usage guide, including how to sign and verify tokens can be found on
-our [documentation website](https://golang-jwt.github.io/jwt/usage/create/).
-
-## Examples
-
-See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt/v5)
-for examples of usage:
-
-* [Simple example of parsing and validating a
- token](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#example-Parse-Hmac)
-* [Simple example of building and signing a
- token](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#example-New-Hmac)
-* [Directory of
- Examples](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#pkg-examples)
-
-## Compliance
-
-This library was last reviewed to comply with [RFC
-7519](https://datatracker.ietf.org/doc/html/rfc7519) dated May 2015 with a few
-notable differences:
-
-* In order to protect against accidental use of [Unsecured
- JWTs](https://datatracker.ietf.org/doc/html/rfc7519#section-6), tokens using
- `alg=none` will only be accepted if the constant
- `jwt.UnsafeAllowNoneSignatureType` is provided as the key.
-
-## Project Status & Versioning
-
-This library is considered production ready. Feedback and feature requests are
-appreciated. The API should be considered stable. There should be very few
-backwards-incompatible changes outside of major version updates (and only with
-good reason).
-
-This project uses [Semantic Versioning 2.0.0](http://semver.org). Accepted pull
-requests will land on `main`. Periodically, versions will be tagged from
-`main`. You can find all the releases on [the project releases
-page](https://github.com/golang-jwt/jwt/releases).
-
-**BREAKING CHANGES:*** A full list of breaking changes is available in
-`VERSION_HISTORY.md`. See `MIGRATION_GUIDE.md` for more information on updating
-your code.
-
-## Extensions
-
-This library publishes all the necessary components for adding your own signing
-methods or key functions. Simply implement the `SigningMethod` interface and
-register a factory method using `RegisterSigningMethod` or provide a
-`jwt.Keyfunc`.
-
-A common use case would be integrating with different 3rd party signature
-providers, like key management services from various cloud providers or Hardware
-Security Modules (HSMs) or to implement additional standards.
-
-| Extension | Purpose | Repo |
-| --------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
-| GCP | Integrates with multiple Google Cloud Platform signing tools (AppEngine, IAM API, Cloud KMS) | https://github.com/someone1/gcp-jwt-go |
-| AWS | Integrates with AWS Key Management Service, KMS | https://github.com/matelang/jwt-go-aws-kms |
-| JWKS | Provides support for JWKS ([RFC 7517](https://datatracker.ietf.org/doc/html/rfc7517)) as a `jwt.Keyfunc` | https://github.com/MicahParks/keyfunc |
-
-*Disclaimer*: Unless otherwise specified, these integrations are maintained by
-third parties and should not be considered as a primary offer by any of the
-mentioned cloud providers
-
-## More
-
-Go package documentation can be found [on
-pkg.go.dev](https://pkg.go.dev/github.com/golang-jwt/jwt/v5). Additional
-documentation can be found on [our project
-page](https://golang-jwt.github.io/jwt/).
-
-The command line utility included in this project (cmd/jwt) provides a
-straightforward example of token creation and parsing as well as a useful tool
-for debugging your own integration. You'll also find several implementation
-examples in the documentation.
-
-[golang-jwt](https://github.com/orgs/golang-jwt) incorporates a modified version
-of the JWT logo, which is distributed under the terms of the [MIT
-License](https://github.com/jsonwebtoken/jsonwebtoken.github.io/blob/master/LICENSE.txt).
diff --git a/vendor/github.com/golang-jwt/jwt/v5/SECURITY.md b/vendor/github.com/golang-jwt/jwt/v5/SECURITY.md
deleted file mode 100644
index b08402c..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/SECURITY.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# Security Policy
-
-## Supported Versions
-
-As of February 2022 (and until this document is updated), the latest version `v4` is supported.
-
-## Reporting a Vulnerability
-
-If you think you found a vulnerability, and even if you are not sure, please report it to jwt-go-security@googlegroups.com or one of the other [golang-jwt maintainers](https://github.com/orgs/golang-jwt/people). Please try be explicit, describe steps to reproduce the security issue with code example(s).
-
-You will receive a response within a timely manner. If the issue is confirmed, we will do our best to release a patch as soon as possible given the complexity of the problem.
-
-## Public Discussions
-
-Please avoid publicly discussing a potential security vulnerability.
-
-Let's take this offline and find a solution first, this limits the potential impact as much as possible.
-
-We appreciate your help!
diff --git a/vendor/github.com/golang-jwt/jwt/v5/VERSION_HISTORY.md b/vendor/github.com/golang-jwt/jwt/v5/VERSION_HISTORY.md
deleted file mode 100644
index b5039e4..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/VERSION_HISTORY.md
+++ /dev/null
@@ -1,137 +0,0 @@
-# `jwt-go` Version History
-
-The following version history is kept for historic purposes. To retrieve the current changes of each version, please refer to the change-log of the specific release versions on https://github.com/golang-jwt/jwt/releases.
-
-## 4.0.0
-
-* Introduces support for Go modules. The `v4` version will be backwards compatible with `v3.x.y`.
-
-## 3.2.2
-
-* Starting from this release, we are adopting the policy to support the most 2 recent versions of Go currently available. By the time of this release, this is Go 1.15 and 1.16 ([#28](https://github.com/golang-jwt/jwt/pull/28)).
-* Fixed a potential issue that could occur when the verification of `exp`, `iat` or `nbf` was not required and contained invalid contents, i.e. non-numeric/date. Thanks for @thaJeztah for making us aware of that and @giorgos-f3 for originally reporting it to the formtech fork ([#40](https://github.com/golang-jwt/jwt/pull/40)).
-* Added support for EdDSA / ED25519 ([#36](https://github.com/golang-jwt/jwt/pull/36)).
-* Optimized allocations ([#33](https://github.com/golang-jwt/jwt/pull/33)).
-
-## 3.2.1
-
-* **Import Path Change**: See MIGRATION_GUIDE.md for tips on updating your code
- * Changed the import path from `github.com/dgrijalva/jwt-go` to `github.com/golang-jwt/jwt`
-* Fixed type confusing issue between `string` and `[]string` in `VerifyAudience` ([#12](https://github.com/golang-jwt/jwt/pull/12)). This fixes CVE-2020-26160
-
-#### 3.2.0
-
-* Added method `ParseUnverified` to allow users to split up the tasks of parsing and validation
-* HMAC signing method returns `ErrInvalidKeyType` instead of `ErrInvalidKey` where appropriate
-* Added options to `request.ParseFromRequest`, which allows for an arbitrary list of modifiers to parsing behavior. Initial set include `WithClaims` and `WithParser`. Existing usage of this function will continue to work as before.
-* Deprecated `ParseFromRequestWithClaims` to simplify API in the future.
-
-#### 3.1.0
-
-* Improvements to `jwt` command line tool
-* Added `SkipClaimsValidation` option to `Parser`
-* Documentation updates
-
-#### 3.0.0
-
-* **Compatibility Breaking Changes**: See MIGRATION_GUIDE.md for tips on updating your code
- * Dropped support for `[]byte` keys when using RSA signing methods. This convenience feature could contribute to security vulnerabilities involving mismatched key types with signing methods.
- * `ParseFromRequest` has been moved to `request` subpackage and usage has changed
- * The `Claims` property on `Token` is now type `Claims` instead of `map[string]interface{}`. The default value is type `MapClaims`, which is an alias to `map[string]interface{}`. This makes it possible to use a custom type when decoding claims.
-* Other Additions and Changes
- * Added `Claims` interface type to allow users to decode the claims into a custom type
- * Added `ParseWithClaims`, which takes a third argument of type `Claims`. Use this function instead of `Parse` if you have a custom type you'd like to decode into.
- * Dramatically improved the functionality and flexibility of `ParseFromRequest`, which is now in the `request` subpackage
- * Added `ParseFromRequestWithClaims` which is the `FromRequest` equivalent of `ParseWithClaims`
- * Added new interface type `Extractor`, which is used for extracting JWT strings from http requests. Used with `ParseFromRequest` and `ParseFromRequestWithClaims`.
- * Added several new, more specific, validation errors to error type bitmask
- * Moved examples from README to executable example files
- * Signing method registry is now thread safe
- * Added new property to `ValidationError`, which contains the raw error returned by calls made by parse/verify (such as those returned by keyfunc or json parser)
-
-#### 2.7.0
-
-This will likely be the last backwards compatible release before 3.0.0, excluding essential bug fixes.
-
-* Added new option `-show` to the `jwt` command that will just output the decoded token without verifying
-* Error text for expired tokens includes how long it's been expired
-* Fixed incorrect error returned from `ParseRSAPublicKeyFromPEM`
-* Documentation updates
-
-#### 2.6.0
-
-* Exposed inner error within ValidationError
-* Fixed validation errors when using UseJSONNumber flag
-* Added several unit tests
-
-#### 2.5.0
-
-* Added support for signing method none. You shouldn't use this. The API tries to make this clear.
-* Updated/fixed some documentation
-* Added more helpful error message when trying to parse tokens that begin with `BEARER `
-
-#### 2.4.0
-
-* Added new type, Parser, to allow for configuration of various parsing parameters
- * You can now specify a list of valid signing methods. Anything outside this set will be rejected.
- * You can now opt to use the `json.Number` type instead of `float64` when parsing token JSON
-* Added support for [Travis CI](https://travis-ci.org/dgrijalva/jwt-go)
-* Fixed some bugs with ECDSA parsing
-
-#### 2.3.0
-
-* Added support for ECDSA signing methods
-* Added support for RSA PSS signing methods (requires go v1.4)
-
-#### 2.2.0
-
-* Gracefully handle a `nil` `Keyfunc` being passed to `Parse`. Result will now be the parsed token and an error, instead of a panic.
-
-#### 2.1.0
-
-Backwards compatible API change that was missed in 2.0.0.
-
-* The `SignedString` method on `Token` now takes `interface{}` instead of `[]byte`
-
-#### 2.0.0
-
-There were two major reasons for breaking backwards compatibility with this update. The first was a refactor required to expand the width of the RSA and HMAC-SHA signing implementations. There will likely be no required code changes to support this change.
-
-The second update, while unfortunately requiring a small change in integration, is required to open up this library to other signing methods. Not all keys used for all signing methods have a single standard on-disk representation. Requiring `[]byte` as the type for all keys proved too limiting. Additionally, this implementation allows for pre-parsed tokens to be reused, which might matter in an application that parses a high volume of tokens with a small set of keys. Backwards compatibilty has been maintained for passing `[]byte` to the RSA signing methods, but they will also accept `*rsa.PublicKey` and `*rsa.PrivateKey`.
-
-It is likely the only integration change required here will be to change `func(t *jwt.Token) ([]byte, error)` to `func(t *jwt.Token) (interface{}, error)` when calling `Parse`.
-
-* **Compatibility Breaking Changes**
- * `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct`
- * `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct`
- * `KeyFunc` now returns `interface{}` instead of `[]byte`
- * `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key
- * `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key
-* Renamed type `SigningMethodHS256` to `SigningMethodHMAC`. Specific sizes are now just instances of this type.
- * Added public package global `SigningMethodHS256`
- * Added public package global `SigningMethodHS384`
- * Added public package global `SigningMethodHS512`
-* Renamed type `SigningMethodRS256` to `SigningMethodRSA`. Specific sizes are now just instances of this type.
- * Added public package global `SigningMethodRS256`
- * Added public package global `SigningMethodRS384`
- * Added public package global `SigningMethodRS512`
-* Moved sample private key for HMAC tests from an inline value to a file on disk. Value is unchanged.
-* Refactored the RSA implementation to be easier to read
-* Exposed helper methods `ParseRSAPrivateKeyFromPEM` and `ParseRSAPublicKeyFromPEM`
-
-## 1.0.2
-
-* Fixed bug in parsing public keys from certificates
-* Added more tests around the parsing of keys for RS256
-* Code refactoring in RS256 implementation. No functional changes
-
-## 1.0.1
-
-* Fixed panic if RS256 signing method was passed an invalid key
-
-## 1.0.0
-
-* First versioned release
-* API stabilized
-* Supports creating, signing, parsing, and validating JWT tokens
-* Supports RS256 and HS256 signing methods
diff --git a/vendor/github.com/golang-jwt/jwt/v5/claims.go b/vendor/github.com/golang-jwt/jwt/v5/claims.go
deleted file mode 100644
index d50ff3d..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/claims.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package jwt
-
-// Claims represent any form of a JWT Claims Set according to
-// https://datatracker.ietf.org/doc/html/rfc7519#section-4. In order to have a
-// common basis for validation, it is required that an implementation is able to
-// supply at least the claim names provided in
-// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1 namely `exp`,
-// `iat`, `nbf`, `iss`, `sub` and `aud`.
-type Claims interface {
- GetExpirationTime() (*NumericDate, error)
- GetIssuedAt() (*NumericDate, error)
- GetNotBefore() (*NumericDate, error)
- GetIssuer() (string, error)
- GetSubject() (string, error)
- GetAudience() (ClaimStrings, error)
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/doc.go b/vendor/github.com/golang-jwt/jwt/v5/doc.go
deleted file mode 100644
index a86dc1a..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/doc.go
+++ /dev/null
@@ -1,4 +0,0 @@
-// Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html
-//
-// See README.md for more info.
-package jwt
diff --git a/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go b/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go
deleted file mode 100644
index 9e60f3e..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go
+++ /dev/null
@@ -1,212 +0,0 @@
-package jwt
-
-import (
- "crypto"
- "crypto/ecdsa"
- "crypto/rand"
- "errors"
- "math/big"
-)
-
-var (
-
- // Sadly this is missing from crypto/ecdsa compared to crypto/rsa
-
- ErrECDSAVerification = errors.New("crypto/ecdsa: verification error")
-)
-
-// SigningMethodECDSA implements the ECDSA family of signing methods.
-
-// Expects *ecdsa.PrivateKey for signing and *ecdsa.PublicKey for verification
-
-type SigningMethodECDSA struct {
- Name string
-
- Hash crypto.Hash
-
- KeySize int
-
- CurveBits int
-}
-
-// Specific instances for EC256 and company
-
-var (
- SigningMethodES256 *SigningMethodECDSA
-
- SigningMethodES384 *SigningMethodECDSA
-
- SigningMethodES512 *SigningMethodECDSA
-)
-
-func init() {
-
- // ES256
-
- SigningMethodES256 = &SigningMethodECDSA{"ES256", crypto.SHA256, 32, 256}
-
- RegisterSigningMethod(SigningMethodES256.Alg(), func() SigningMethod {
-
- return SigningMethodES256
-
- })
-
- // ES384
-
- SigningMethodES384 = &SigningMethodECDSA{"ES384", crypto.SHA384, 48, 384}
-
- RegisterSigningMethod(SigningMethodES384.Alg(), func() SigningMethod {
-
- return SigningMethodES384
-
- })
-
- // ES512
-
- SigningMethodES512 = &SigningMethodECDSA{"ES512", crypto.SHA512, 66, 521}
-
- RegisterSigningMethod(SigningMethodES512.Alg(), func() SigningMethod {
-
- return SigningMethodES512
-
- })
-
-}
-
-func (m *SigningMethodECDSA) Alg() string {
-
- return m.Name
-
-}
-
-// Verify implements token verification for the SigningMethod.
-
-// For this verify method, key must be an ecdsa.PublicKey struct
-
-func (m *SigningMethodECDSA) Verify(signingString string, sig []byte, key interface{}) error {
-
- // Get the key
-
- var ecdsaKey *ecdsa.PublicKey
-
- switch k := key.(type) {
-
- case *ecdsa.PublicKey:
-
- ecdsaKey = k
-
- default:
-
- return ErrInvalidKeyType
-
- }
-
- if len(sig) != 2*m.KeySize {
-
- return ErrECDSAVerification
-
- }
-
- r := big.NewInt(0).SetBytes(sig[:m.KeySize])
-
- s := big.NewInt(0).SetBytes(sig[m.KeySize:])
-
- // Create hasher
-
- if !m.Hash.Available() {
-
- return ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Verify the signature
-
- if verifystatus := ecdsa.Verify(ecdsaKey, hasher.Sum(nil), r, s); verifystatus {
-
- return nil
-
- }
-
- return ErrECDSAVerification
-
-}
-
-// Sign implements token signing for the SigningMethod.
-
-// For this signing method, key must be an ecdsa.PrivateKey struct
-
-func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) ([]byte, error) {
-
- // Get the key
-
- var ecdsaKey *ecdsa.PrivateKey
-
- switch k := key.(type) {
-
- case *ecdsa.PrivateKey:
-
- ecdsaKey = k
-
- default:
-
- return nil, ErrInvalidKeyType
-
- }
-
- // Create the hasher
-
- if !m.Hash.Available() {
-
- return nil, ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Sign the string and return r, s
-
- if r, s, err := ecdsa.Sign(rand.Reader, ecdsaKey, hasher.Sum(nil)); err == nil {
-
- curveBits := ecdsaKey.Curve.Params().BitSize
-
- if m.CurveBits != curveBits {
-
- return nil, ErrInvalidKey
-
- }
-
- keyBytes := curveBits / 8
-
- if curveBits%8 > 0 {
-
- keyBytes += 1
-
- }
-
- // We serialize the outputs (r and s) into big-endian byte arrays
-
- // padded with zeros on the left to make sure the sizes work out.
-
- // Output must be 2*keyBytes long.
-
- out := make([]byte, 2*keyBytes)
-
- r.FillBytes(out[0:keyBytes]) // r is assigned to the first half of output.
-
- s.FillBytes(out[keyBytes:]) // s is assigned to the second half of output.
-
- return out, nil
-
- } else {
-
- return nil, err
-
- }
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go b/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go
deleted file mode 100644
index 7254d66..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go
+++ /dev/null
@@ -1,106 +0,0 @@
-package jwt
-
-import (
- "crypto/ecdsa"
- "crypto/x509"
- "encoding/pem"
- "errors"
-)
-
-var (
- ErrNotECPublicKey = errors.New("key is not a valid ECDSA public key")
-
- ErrNotECPrivateKey = errors.New("key is not a valid ECDSA private key")
-)
-
-// ParseECPrivateKeyFromPEM parses a PEM encoded Elliptic Curve Private Key Structure
-
-func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil {
-
- if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
-
- return nil, err
-
- }
-
- }
-
- var pkey *ecdsa.PrivateKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok {
-
- return nil, ErrNotECPrivateKey
-
- }
-
- return pkey, nil
-
-}
-
-// ParseECPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key
-
-func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
-
- if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
-
- parsedKey = cert.PublicKey
-
- } else {
-
- return nil, err
-
- }
-
- }
-
- var pkey *ecdsa.PublicKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok {
-
- return nil, ErrNotECPublicKey
-
- }
-
- return pkey, nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/ed25519.go b/vendor/github.com/golang-jwt/jwt/v5/ed25519.go
deleted file mode 100644
index 943b68c..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/ed25519.go
+++ /dev/null
@@ -1,116 +0,0 @@
-package jwt
-
-import (
- "crypto"
- "crypto/ed25519"
- "crypto/rand"
- "errors"
-)
-
-var (
- ErrEd25519Verification = errors.New("ed25519: verification error")
-)
-
-// SigningMethodEd25519 implements the EdDSA family.
-
-// Expects ed25519.PrivateKey for signing and ed25519.PublicKey for verification
-
-type SigningMethodEd25519 struct{}
-
-// Specific instance for EdDSA
-
-var (
- SigningMethodEdDSA *SigningMethodEd25519
-)
-
-func init() {
-
- SigningMethodEdDSA = &SigningMethodEd25519{}
-
- RegisterSigningMethod(SigningMethodEdDSA.Alg(), func() SigningMethod {
-
- return SigningMethodEdDSA
-
- })
-
-}
-
-func (m *SigningMethodEd25519) Alg() string {
-
- return "EdDSA"
-
-}
-
-// Verify implements token verification for the SigningMethod.
-
-// For this verify method, key must be an ed25519.PublicKey
-
-func (m *SigningMethodEd25519) Verify(signingString string, sig []byte, key interface{}) error {
-
- var ed25519Key ed25519.PublicKey
-
- var ok bool
-
- if ed25519Key, ok = key.(ed25519.PublicKey); !ok {
-
- return ErrInvalidKeyType
-
- }
-
- if len(ed25519Key) != ed25519.PublicKeySize {
-
- return ErrInvalidKey
-
- }
-
- // Verify the signature
-
- if !ed25519.Verify(ed25519Key, []byte(signingString), sig) {
-
- return ErrEd25519Verification
-
- }
-
- return nil
-
-}
-
-// Sign implements token signing for the SigningMethod.
-
-// For this signing method, key must be an ed25519.PrivateKey
-
-func (m *SigningMethodEd25519) Sign(signingString string, key interface{}) ([]byte, error) {
-
- var ed25519Key crypto.Signer
-
- var ok bool
-
- if ed25519Key, ok = key.(crypto.Signer); !ok {
-
- return nil, ErrInvalidKeyType
-
- }
-
- if _, ok := ed25519Key.Public().(ed25519.PublicKey); !ok {
-
- return nil, ErrInvalidKey
-
- }
-
- // Sign the string and return the result. ed25519 performs a two-pass hash
-
- // as part of its algorithm. Therefore, we need to pass a non-prehashed
-
- // message into the Sign function, as indicated by crypto.Hash(0)
-
- sig, err := ed25519Key.Sign(rand.Reader, []byte(signingString), crypto.Hash(0))
-
- if err != nil {
-
- return nil, err
-
- }
-
- return sig, nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go b/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go
deleted file mode 100644
index 58dcc40..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go
+++ /dev/null
@@ -1,95 +0,0 @@
-package jwt
-
-import (
- "crypto"
- "crypto/ed25519"
- "crypto/x509"
- "encoding/pem"
- "errors"
-)
-
-var (
- ErrNotEdPrivateKey = errors.New("key is not a valid Ed25519 private key")
-
- ErrNotEdPublicKey = errors.New("key is not a valid Ed25519 public key")
-)
-
-// ParseEdPrivateKeyFromPEM parses a PEM-encoded Edwards curve private key
-
-func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
-
- return nil, err
-
- }
-
- var pkey ed25519.PrivateKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(ed25519.PrivateKey); !ok {
-
- return nil, ErrNotEdPrivateKey
-
- }
-
- return pkey, nil
-
-}
-
-// ParseEdPublicKeyFromPEM parses a PEM-encoded Edwards curve public key
-
-func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
-
- return nil, err
-
- }
-
- var pkey ed25519.PublicKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(ed25519.PublicKey); !ok {
-
- return nil, ErrNotEdPublicKey
-
- }
-
- return pkey, nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/errors.go b/vendor/github.com/golang-jwt/jwt/v5/errors.go
deleted file mode 100644
index 53363fa..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/errors.go
+++ /dev/null
@@ -1,77 +0,0 @@
-package jwt
-
-import (
- "errors"
- "strings"
-)
-
-var (
- ErrInvalidKey = errors.New("key is invalid")
-
- ErrInvalidKeyType = errors.New("key is of invalid type")
-
- ErrHashUnavailable = errors.New("the requested hash function is unavailable")
-
- ErrTokenMalformed = errors.New("token is malformed")
-
- ErrTokenUnverifiable = errors.New("token is unverifiable")
-
- ErrTokenSignatureInvalid = errors.New("token signature is invalid")
-
- ErrTokenRequiredClaimMissing = errors.New("token is missing required claim")
-
- ErrTokenInvalidAudience = errors.New("token has invalid audience")
-
- ErrTokenExpired = errors.New("token is expired")
-
- ErrTokenUsedBeforeIssued = errors.New("token used before issued")
-
- ErrTokenInvalidIssuer = errors.New("token has invalid issuer")
-
- ErrTokenInvalidSubject = errors.New("token has invalid subject")
-
- ErrTokenNotValidYet = errors.New("token is not valid yet")
-
- ErrTokenInvalidId = errors.New("token has invalid id")
-
- ErrTokenInvalidClaims = errors.New("token has invalid claims")
-
- ErrInvalidType = errors.New("invalid type for claim")
-)
-
-// joinedError is an error type that works similar to what [errors.Join]
-
-// produces, with the exception that it has a nice error string; mainly its
-
-// error messages are concatenated using a comma, rather than a newline.
-
-type joinedError struct {
- errs []error
-}
-
-func (je joinedError) Error() string {
-
- msg := []string{}
-
- for _, err := range je.errs {
-
- msg = append(msg, err.Error())
-
- }
-
- return strings.Join(msg, ", ")
-
-}
-
-// joinErrors joins together multiple errors. Useful for scenarios where
-
-// multiple errors next to each other occur, e.g., in claims validation.
-
-func joinErrors(errs ...error) error {
-
- return &joinedError{
-
- errs: errs,
- }
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/errors_go1_20.go b/vendor/github.com/golang-jwt/jwt/v5/errors_go1_20.go
deleted file mode 100644
index a893d35..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/errors_go1_20.go
+++ /dev/null
@@ -1,47 +0,0 @@
-//go:build go1.20
-// +build go1.20
-
-package jwt
-
-import (
- "fmt"
-)
-
-// Unwrap implements the multiple error unwrapping for this error type, which is
-// possible in Go 1.20.
-func (je joinedError) Unwrap() []error {
- return je.errs
-}
-
-// newError creates a new error message with a detailed error message. The
-// message will be prefixed with the contents of the supplied error type.
-// Additionally, more errors, that provide more context can be supplied which
-// will be appended to the message. This makes use of Go 1.20's possibility to
-// include more than one %w formatting directive in [fmt.Errorf].
-//
-// For example,
-//
-// newError("no keyfunc was provided", ErrTokenUnverifiable)
-//
-// will produce the error string
-//
-// "token is unverifiable: no keyfunc was provided"
-func newError(message string, err error, more ...error) error {
- var format string
- var args []any
- if message != "" {
- format = "%w: %s"
- args = []any{err, message}
- } else {
- format = "%w"
- args = []any{err}
- }
-
- for _, e := range more {
- format += ": %w"
- args = append(args, e)
- }
-
- err = fmt.Errorf(format, args...)
- return err
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/errors_go_other.go b/vendor/github.com/golang-jwt/jwt/v5/errors_go_other.go
deleted file mode 100644
index bdc84ba..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/errors_go_other.go
+++ /dev/null
@@ -1,130 +0,0 @@
-//go:build !go1.20
-// +build !go1.20
-
-package jwt
-
-import (
- "errors"
- "fmt"
-)
-
-// Is implements checking for multiple errors using [errors.Is], since multiple
-
-// error unwrapping is not possible in versions less than Go 1.20.
-
-func (je joinedError) Is(err error) bool {
-
- for _, e := range je.errs {
-
- if errors.Is(e, err) {
-
- return true
-
- }
-
- }
-
- return false
-
-}
-
-// wrappedErrors is a workaround for wrapping multiple errors in environments
-
-// where Go 1.20 is not available. It basically uses the already implemented
-
-// functionatlity of joinedError to handle multiple errors with supplies a
-
-// custom error message that is identical to the one we produce in Go 1.20 using
-
-// multiple %w directives.
-
-type wrappedErrors struct {
- msg string
-
- joinedError
-}
-
-// Error returns the stored error string
-
-func (we wrappedErrors) Error() string {
-
- return we.msg
-
-}
-
-// newError creates a new error message with a detailed error message. The
-
-// message will be prefixed with the contents of the supplied error type.
-
-// Additionally, more errors, that provide more context can be supplied which
-
-// will be appended to the message. Since we cannot use of Go 1.20's possibility
-
-// to include more than one %w formatting directive in [fmt.Errorf], we have to
-
-// emulate that.
-
-//
-
-// For example,
-
-//
-
-// newError("no keyfunc was provided", ErrTokenUnverifiable)
-
-//
-
-// will produce the error string
-
-//
-
-// "token is unverifiable: no keyfunc was provided"
-
-func newError(message string, err error, more ...error) error {
-
- // We cannot wrap multiple errors here with %w, so we have to be a little
-
- // bit creative. Basically, we are using %s instead of %w to produce the
-
- // same error message and then throw the result into a custom error struct.
-
- var format string
-
- var args []any
-
- if message != "" {
-
- format = "%s: %s"
-
- args = []any{err, message}
-
- } else {
-
- format = "%s"
-
- args = []any{err}
-
- }
-
- errs := []error{err}
-
- for _, e := range more {
-
- format += ": %s"
-
- args = append(args, e)
-
- errs = append(errs, e)
-
- }
-
- err = &wrappedErrors{
-
- msg: fmt.Sprintf(format, args...),
-
- joinedError: joinedError{errs: errs},
- }
-
- return err
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/hmac.go b/vendor/github.com/golang-jwt/jwt/v5/hmac.go
deleted file mode 100644
index a2f8da6..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/hmac.go
+++ /dev/null
@@ -1,169 +0,0 @@
-package jwt
-
-import (
- "crypto"
- "crypto/hmac"
- "errors"
-)
-
-// SigningMethodHMAC implements the HMAC-SHA family of signing methods.
-
-// Expects key type of []byte for both signing and validation
-
-type SigningMethodHMAC struct {
- Name string
-
- Hash crypto.Hash
-}
-
-// Specific instances for HS256 and company
-
-var (
- SigningMethodHS256 *SigningMethodHMAC
-
- SigningMethodHS384 *SigningMethodHMAC
-
- SigningMethodHS512 *SigningMethodHMAC
-
- ErrSignatureInvalid = errors.New("signature is invalid")
-)
-
-func init() {
-
- // HS256
-
- SigningMethodHS256 = &SigningMethodHMAC{"HS256", crypto.SHA256}
-
- RegisterSigningMethod(SigningMethodHS256.Alg(), func() SigningMethod {
-
- return SigningMethodHS256
-
- })
-
- // HS384
-
- SigningMethodHS384 = &SigningMethodHMAC{"HS384", crypto.SHA384}
-
- RegisterSigningMethod(SigningMethodHS384.Alg(), func() SigningMethod {
-
- return SigningMethodHS384
-
- })
-
- // HS512
-
- SigningMethodHS512 = &SigningMethodHMAC{"HS512", crypto.SHA512}
-
- RegisterSigningMethod(SigningMethodHS512.Alg(), func() SigningMethod {
-
- return SigningMethodHS512
-
- })
-
-}
-
-func (m *SigningMethodHMAC) Alg() string {
-
- return m.Name
-
-}
-
-// Verify implements token verification for the SigningMethod. Returns nil if
-
-// the signature is valid. Key must be []byte.
-
-//
-
-// Note it is not advised to provide a []byte which was converted from a 'human
-
-// readable' string using a subset of ASCII characters. To maximize entropy, you
-
-// should ideally be providing a []byte key which was produced from a
-
-// cryptographically random source, e.g. crypto/rand. Additional information
-
-// about this, and why we intentionally are not supporting string as a key can
-
-// be found on our usage guide
-
-// https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types.
-
-func (m *SigningMethodHMAC) Verify(signingString string, sig []byte, key interface{}) error {
-
- // Verify the key is the right type
-
- keyBytes, ok := key.([]byte)
-
- if !ok {
-
- return ErrInvalidKeyType
-
- }
-
- // Can we use the specified hashing method?
-
- if !m.Hash.Available() {
-
- return ErrHashUnavailable
-
- }
-
- // This signing method is symmetric, so we validate the signature
-
- // by reproducing the signature from the signing string and key, then
-
- // comparing that against the provided signature.
-
- hasher := hmac.New(m.Hash.New, keyBytes)
-
- hasher.Write([]byte(signingString))
-
- if !hmac.Equal(sig, hasher.Sum(nil)) {
-
- return ErrSignatureInvalid
-
- }
-
- // No validation errors. Signature is good.
-
- return nil
-
-}
-
-// Sign implements token signing for the SigningMethod. Key must be []byte.
-
-//
-
-// Note it is not advised to provide a []byte which was converted from a 'human
-
-// readable' string using a subset of ASCII characters. To maximize entropy, you
-
-// should ideally be providing a []byte key which was produced from a
-
-// cryptographically random source, e.g. crypto/rand. Additional information
-
-// about this, and why we intentionally are not supporting string as a key can
-
-// be found on our usage guide https://golang-jwt.github.io/jwt/usage/signing_methods/.
-
-func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) ([]byte, error) {
-
- if keyBytes, ok := key.([]byte); ok {
-
- if !m.Hash.Available() {
-
- return nil, ErrHashUnavailable
-
- }
-
- hasher := hmac.New(m.Hash.New, keyBytes)
-
- hasher.Write([]byte(signingString))
-
- return hasher.Sum(nil), nil
-
- }
-
- return nil, ErrInvalidKeyType
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/map_claims.go b/vendor/github.com/golang-jwt/jwt/v5/map_claims.go
deleted file mode 100644
index 8ec52e6..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/map_claims.go
+++ /dev/null
@@ -1,176 +0,0 @@
-package jwt
-
-import (
- "encoding/json"
- "fmt"
-)
-
-// MapClaims is a claims type that uses the map[string]interface{} for JSON
-
-// decoding. This is the default claims type if you don't supply one
-
-type MapClaims map[string]interface{}
-
-// GetExpirationTime implements the Claims interface.
-
-func (m MapClaims) GetExpirationTime() (*NumericDate, error) {
-
- return m.parseNumericDate("exp")
-
-}
-
-// GetNotBefore implements the Claims interface.
-
-func (m MapClaims) GetNotBefore() (*NumericDate, error) {
-
- return m.parseNumericDate("nbf")
-
-}
-
-// GetIssuedAt implements the Claims interface.
-
-func (m MapClaims) GetIssuedAt() (*NumericDate, error) {
-
- return m.parseNumericDate("iat")
-
-}
-
-// GetAudience implements the Claims interface.
-
-func (m MapClaims) GetAudience() (ClaimStrings, error) {
-
- return m.parseClaimsString("aud")
-
-}
-
-// GetIssuer implements the Claims interface.
-
-func (m MapClaims) GetIssuer() (string, error) {
-
- return m.parseString("iss")
-
-}
-
-// GetSubject implements the Claims interface.
-
-func (m MapClaims) GetSubject() (string, error) {
-
- return m.parseString("sub")
-
-}
-
-// parseNumericDate tries to parse a key in the map claims type as a number
-
-// date. This will succeed, if the underlying type is either a [float64] or a
-
-// [json.Number]. Otherwise, nil will be returned.
-
-func (m MapClaims) parseNumericDate(key string) (*NumericDate, error) {
-
- v, ok := m[key]
-
- if !ok {
-
- return nil, nil
-
- }
-
- switch exp := v.(type) {
-
- case float64:
-
- if exp == 0 {
-
- return nil, nil
-
- }
-
- return newNumericDateFromSeconds(exp), nil
-
- case json.Number:
-
- v, _ := exp.Float64()
-
- return newNumericDateFromSeconds(v), nil
-
- }
-
- return nil, newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType)
-
-}
-
-// parseClaimsString tries to parse a key in the map claims type as a
-
-// [ClaimsStrings] type, which can either be a string or an array of string.
-
-func (m MapClaims) parseClaimsString(key string) (ClaimStrings, error) {
-
- var cs []string
-
- switch v := m[key].(type) {
-
- case string:
-
- cs = append(cs, v)
-
- case []string:
-
- cs = v
-
- case []interface{}:
-
- for _, a := range v {
-
- vs, ok := a.(string)
-
- if !ok {
-
- return nil, newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType)
-
- }
-
- cs = append(cs, vs)
-
- }
-
- }
-
- return cs, nil
-
-}
-
-// parseString tries to parse a key in the map claims type as a [string] type.
-
-// If the key does not exist, an empty string is returned. If the key has the
-
-// wrong type, an error is returned.
-
-func (m MapClaims) parseString(key string) (string, error) {
-
- var (
- ok bool
-
- raw interface{}
-
- iss string
- )
-
- raw, ok = m[key]
-
- if !ok {
-
- return "", nil
-
- }
-
- iss, ok = raw.(string)
-
- if !ok {
-
- return "", newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType)
-
- }
-
- return iss, nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/none.go b/vendor/github.com/golang-jwt/jwt/v5/none.go
deleted file mode 100644
index c93daa5..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/none.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package jwt
-
-// SigningMethodNone implements the none signing method. This is required by the spec
-// but you probably should never use it.
-var SigningMethodNone *signingMethodNone
-
-const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed"
-
-var NoneSignatureTypeDisallowedError error
-
-type signingMethodNone struct{}
-type unsafeNoneMagicConstant string
-
-func init() {
- SigningMethodNone = &signingMethodNone{}
- NoneSignatureTypeDisallowedError = newError("'none' signature type is not allowed", ErrTokenUnverifiable)
-
- RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod {
- return SigningMethodNone
- })
-}
-
-func (m *signingMethodNone) Alg() string {
- return "none"
-}
-
-// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key
-func (m *signingMethodNone) Verify(signingString string, sig []byte, key interface{}) (err error) {
- // Key must be UnsafeAllowNoneSignatureType to prevent accidentally
- // accepting 'none' signing method
- if _, ok := key.(unsafeNoneMagicConstant); !ok {
- return NoneSignatureTypeDisallowedError
- }
- // If signing method is none, signature must be an empty string
- if string(sig) != "" {
- return newError("'none' signing method with non-empty signature", ErrTokenUnverifiable)
- }
-
- // Accept 'none' signing method.
- return nil
-}
-
-// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key
-func (m *signingMethodNone) Sign(signingString string, key interface{}) ([]byte, error) {
- if _, ok := key.(unsafeNoneMagicConstant); ok {
- return []byte{}, nil
- }
-
- return nil, NoneSignatureTypeDisallowedError
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/parser.go b/vendor/github.com/golang-jwt/jwt/v5/parser.go
deleted file mode 100644
index ccdf4d4..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/parser.go
+++ /dev/null
@@ -1,357 +0,0 @@
-package jwt
-
-import (
- "bytes"
- "encoding/base64"
- "encoding/json"
- "fmt"
- "strings"
-)
-
-type Parser struct {
-
- // If populated, only these methods will be considered valid.
-
- validMethods []string
-
- // Use JSON Number format in JSON decoder.
-
- useJSONNumber bool
-
- // Skip claims validation during token parsing.
-
- skipClaimsValidation bool
-
- validator *validator
-
- decodeStrict bool
-
- decodePaddingAllowed bool
-}
-
-// NewParser creates a new Parser with the specified options
-
-func NewParser(options ...ParserOption) *Parser {
-
- p := &Parser{
-
- validator: &validator{},
- }
-
- // Loop through our parsing options and apply them
-
- for _, option := range options {
-
- option(p)
-
- }
-
- return p
-
-}
-
-// Parse parses, validates, verifies the signature and returns the parsed token.
-
-// keyFunc will receive the parsed token and should return the key for validating.
-
-func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
-
- return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc)
-
-}
-
-// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object implementing the Claims
-
-// interface. This provides default values which can be overridden and allows a caller to use their own type, rather
-
-// than the default MapClaims implementation of Claims.
-
-//
-
-// Note: If you provide a custom claim implementation that embeds one of the standard claims (such as RegisteredClaims),
-
-// make sure that a) you either embed a non-pointer version of the claims or b) if you are using a pointer, allocate the
-
-// proper memory for it before passing in the overall claims, otherwise you might run into a panic.
-
-func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) {
-
- token, parts, err := p.ParseUnverified(tokenString, claims)
-
- if err != nil {
-
- return token, err
-
- }
-
- // Verify signing method is in the required set
-
- if p.validMethods != nil {
-
- var signingMethodValid = false
-
- var alg = token.Method.Alg()
-
- for _, m := range p.validMethods {
-
- if m == alg {
-
- signingMethodValid = true
-
- break
-
- }
-
- }
-
- if !signingMethodValid {
-
- // signing method is not in the listed set
-
- return token, newError(fmt.Sprintf("signing method %v is invalid", alg), ErrTokenSignatureInvalid)
-
- }
-
- }
-
- // Lookup key
-
- var key interface{}
-
- if keyFunc == nil {
-
- // keyFunc was not provided. short circuiting validation
-
- return token, newError("no keyfunc was provided", ErrTokenUnverifiable)
-
- }
-
- if key, err = keyFunc(token); err != nil {
-
- return token, newError("error while executing keyfunc", ErrTokenUnverifiable, err)
-
- }
-
- // Decode signature
-
- token.Signature, err = p.DecodeSegment(parts[2])
-
- if err != nil {
-
- return token, newError("could not base64 decode signature", ErrTokenMalformed, err)
-
- }
-
- // Perform signature validation
-
- if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
-
- return token, newError("", ErrTokenSignatureInvalid, err)
-
- }
-
- // Validate Claims
-
- if !p.skipClaimsValidation {
-
- // Make sure we have at least a default validator
-
- if p.validator == nil {
-
- p.validator = newValidator()
-
- }
-
- if err := p.validator.Validate(claims); err != nil {
-
- return token, newError("", ErrTokenInvalidClaims, err)
-
- }
-
- }
-
- // No errors so far, token is valid.
-
- token.Valid = true
-
- return token, nil
-
-}
-
-// ParseUnverified parses the token but doesn't validate the signature.
-
-//
-
-// WARNING: Don't use this method unless you know what you're doing.
-
-//
-
-// It's only ever useful in cases where you know the signature is valid (because it has
-
-// been checked previously in the stack) and you want to extract values from it.
-
-func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error) {
-
- parts = strings.Split(tokenString, ".")
-
- if len(parts) != 3 {
-
- return nil, parts, newError("token contains an invalid number of segments", ErrTokenMalformed)
-
- }
-
- token = &Token{Raw: tokenString}
-
- // parse Header
-
- var headerBytes []byte
-
- if headerBytes, err = p.DecodeSegment(parts[0]); err != nil {
-
- if strings.HasPrefix(strings.ToLower(tokenString), "bearer ") {
-
- return token, parts, newError("tokenstring should not contain 'bearer '", ErrTokenMalformed)
-
- }
-
- return token, parts, newError("could not base64 decode header", ErrTokenMalformed, err)
-
- }
-
- if err = json.Unmarshal(headerBytes, &token.Header); err != nil {
-
- return token, parts, newError("could not JSON decode header", ErrTokenMalformed, err)
-
- }
-
- // parse Claims
-
- var claimBytes []byte
-
- token.Claims = claims
-
- if claimBytes, err = p.DecodeSegment(parts[1]); err != nil {
-
- return token, parts, newError("could not base64 decode claim", ErrTokenMalformed, err)
-
- }
-
- dec := json.NewDecoder(bytes.NewBuffer(claimBytes))
-
- if p.useJSONNumber {
-
- dec.UseNumber()
-
- }
-
- // JSON Decode. Special case for map type to avoid weird pointer behavior
-
- if c, ok := token.Claims.(MapClaims); ok {
-
- err = dec.Decode(&c)
-
- } else {
-
- err = dec.Decode(&claims)
-
- }
-
- // Handle decode error
-
- if err != nil {
-
- return token, parts, newError("could not JSON decode claim", ErrTokenMalformed, err)
-
- }
-
- // Lookup signature method
-
- if method, ok := token.Header["alg"].(string); ok {
-
- if token.Method = GetSigningMethod(method); token.Method == nil {
-
- return token, parts, newError("signing method (alg) is unavailable", ErrTokenUnverifiable)
-
- }
-
- } else {
-
- return token, parts, newError("signing method (alg) is unspecified", ErrTokenUnverifiable)
-
- }
-
- return token, parts, nil
-
-}
-
-// DecodeSegment decodes a JWT specific base64url encoding. This function will
-
-// take into account whether the [Parser] is configured with additional options,
-
-// such as [WithStrictDecoding] or [WithPaddingAllowed].
-
-func (p *Parser) DecodeSegment(seg string) ([]byte, error) {
-
- encoding := base64.RawURLEncoding
-
- if p.decodePaddingAllowed {
-
- if l := len(seg) % 4; l > 0 {
-
- seg += strings.Repeat("=", 4-l)
-
- }
-
- encoding = base64.URLEncoding
-
- }
-
- if p.decodeStrict {
-
- encoding = encoding.Strict()
-
- }
-
- return encoding.DecodeString(seg)
-
-}
-
-// Parse parses, validates, verifies the signature and returns the parsed token.
-
-// keyFunc will receive the parsed token and should return the cryptographic key
-
-// for verifying the signature. The caller is strongly encouraged to set the
-
-// WithValidMethods option to validate the 'alg' claim in the token matches the
-
-// expected algorithm. For more details about the importance of validating the
-
-// 'alg' claim, see
-
-// https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/
-
-func Parse(tokenString string, keyFunc Keyfunc, options ...ParserOption) (*Token, error) {
-
- return NewParser(options...).Parse(tokenString, keyFunc)
-
-}
-
-// ParseWithClaims is a shortcut for NewParser().ParseWithClaims().
-
-//
-
-// Note: If you provide a custom claim implementation that embeds one of the
-
-// standard claims (such as RegisteredClaims), make sure that a) you either
-
-// embed a non-pointer version of the claims or b) if you are using a pointer,
-
-// allocate the proper memory for it before passing in the overall claims,
-
-// otherwise you might run into a panic.
-
-func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc, options ...ParserOption) (*Token, error) {
-
- return NewParser(options...).ParseWithClaims(tokenString, claims, keyFunc)
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/parser_option.go b/vendor/github.com/golang-jwt/jwt/v5/parser_option.go
deleted file mode 100644
index 1b5af97..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/parser_option.go
+++ /dev/null
@@ -1,120 +0,0 @@
-package jwt
-
-import "time"
-
-// ParserOption is used to implement functional-style options that modify the
-// behavior of the parser. To add new options, just create a function (ideally
-// beginning with With or Without) that returns an anonymous function that takes
-// a *Parser type as input and manipulates its configuration accordingly.
-type ParserOption func(*Parser)
-
-// WithValidMethods is an option to supply algorithm methods that the parser
-// will check. Only those methods will be considered valid. It is heavily
-// encouraged to use this option in order to prevent attacks such as
-// https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/.
-func WithValidMethods(methods []string) ParserOption {
- return func(p *Parser) {
- p.validMethods = methods
- }
-}
-
-// WithJSONNumber is an option to configure the underlying JSON parser with
-// UseNumber.
-func WithJSONNumber() ParserOption {
- return func(p *Parser) {
- p.useJSONNumber = true
- }
-}
-
-// WithoutClaimsValidation is an option to disable claims validation. This
-// option should only be used if you exactly know what you are doing.
-func WithoutClaimsValidation() ParserOption {
- return func(p *Parser) {
- p.skipClaimsValidation = true
- }
-}
-
-// WithLeeway returns the ParserOption for specifying the leeway window.
-func WithLeeway(leeway time.Duration) ParserOption {
- return func(p *Parser) {
- p.validator.leeway = leeway
- }
-}
-
-// WithTimeFunc returns the ParserOption for specifying the time func. The
-// primary use-case for this is testing. If you are looking for a way to account
-// for clock-skew, WithLeeway should be used instead.
-func WithTimeFunc(f func() time.Time) ParserOption {
- return func(p *Parser) {
- p.validator.timeFunc = f
- }
-}
-
-// WithIssuedAt returns the ParserOption to enable verification
-// of issued-at.
-func WithIssuedAt() ParserOption {
- return func(p *Parser) {
- p.validator.verifyIat = true
- }
-}
-
-// WithAudience configures the validator to require the specified audience in
-// the `aud` claim. Validation will fail if the audience is not listed in the
-// token or the `aud` claim is missing.
-//
-// NOTE: While the `aud` claim is OPTIONAL in a JWT, the handling of it is
-// application-specific. Since this validation API is helping developers in
-// writing secure application, we decided to REQUIRE the existence of the claim,
-// if an audience is expected.
-func WithAudience(aud string) ParserOption {
- return func(p *Parser) {
- p.validator.expectedAud = aud
- }
-}
-
-// WithIssuer configures the validator to require the specified issuer in the
-// `iss` claim. Validation will fail if a different issuer is specified in the
-// token or the `iss` claim is missing.
-//
-// NOTE: While the `iss` claim is OPTIONAL in a JWT, the handling of it is
-// application-specific. Since this validation API is helping developers in
-// writing secure application, we decided to REQUIRE the existence of the claim,
-// if an issuer is expected.
-func WithIssuer(iss string) ParserOption {
- return func(p *Parser) {
- p.validator.expectedIss = iss
- }
-}
-
-// WithSubject configures the validator to require the specified subject in the
-// `sub` claim. Validation will fail if a different subject is specified in the
-// token or the `sub` claim is missing.
-//
-// NOTE: While the `sub` claim is OPTIONAL in a JWT, the handling of it is
-// application-specific. Since this validation API is helping developers in
-// writing secure application, we decided to REQUIRE the existence of the claim,
-// if a subject is expected.
-func WithSubject(sub string) ParserOption {
- return func(p *Parser) {
- p.validator.expectedSub = sub
- }
-}
-
-// WithPaddingAllowed will enable the codec used for decoding JWTs to allow
-// padding. Note that the JWS RFC7515 states that the tokens will utilize a
-// Base64url encoding with no padding. Unfortunately, some implementations of
-// JWT are producing non-standard tokens, and thus require support for decoding.
-func WithPaddingAllowed() ParserOption {
- return func(p *Parser) {
- p.decodePaddingAllowed = true
- }
-}
-
-// WithStrictDecoding will switch the codec used for decoding JWTs into strict
-// mode. In this mode, the decoder requires that trailing padding bits are zero,
-// as described in RFC 4648 section 3.5.
-func WithStrictDecoding() ParserOption {
- return func(p *Parser) {
- p.decodeStrict = true
- }
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go b/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go
deleted file mode 100644
index 77951a5..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package jwt
-
-// RegisteredClaims are a structured version of the JWT Claims Set,
-// restricted to Registered Claim Names, as referenced at
-// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1
-//
-// This type can be used on its own, but then additional private and
-// public claims embedded in the JWT will not be parsed. The typical use-case
-// therefore is to embedded this in a user-defined claim type.
-//
-// See examples for how to use this with your own claim types.
-type RegisteredClaims struct {
- // the `iss` (Issuer) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1
- Issuer string `json:"iss,omitempty"`
-
- // the `sub` (Subject) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.2
- Subject string `json:"sub,omitempty"`
-
- // the `aud` (Audience) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3
- Audience ClaimStrings `json:"aud,omitempty"`
-
- // the `exp` (Expiration Time) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.4
- ExpiresAt *NumericDate `json:"exp,omitempty"`
-
- // the `nbf` (Not Before) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.5
- NotBefore *NumericDate `json:"nbf,omitempty"`
-
- // the `iat` (Issued At) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.6
- IssuedAt *NumericDate `json:"iat,omitempty"`
-
- // the `jti` (JWT ID) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.7
- ID string `json:"jti,omitempty"`
-}
-
-// GetExpirationTime implements the Claims interface.
-func (c RegisteredClaims) GetExpirationTime() (*NumericDate, error) {
- return c.ExpiresAt, nil
-}
-
-// GetNotBefore implements the Claims interface.
-func (c RegisteredClaims) GetNotBefore() (*NumericDate, error) {
- return c.NotBefore, nil
-}
-
-// GetIssuedAt implements the Claims interface.
-func (c RegisteredClaims) GetIssuedAt() (*NumericDate, error) {
- return c.IssuedAt, nil
-}
-
-// GetAudience implements the Claims interface.
-func (c RegisteredClaims) GetAudience() (ClaimStrings, error) {
- return c.Audience, nil
-}
-
-// GetIssuer implements the Claims interface.
-func (c RegisteredClaims) GetIssuer() (string, error) {
- return c.Issuer, nil
-}
-
-// GetSubject implements the Claims interface.
-func (c RegisteredClaims) GetSubject() (string, error) {
- return c.Subject, nil
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa.go b/vendor/github.com/golang-jwt/jwt/v5/rsa.go
deleted file mode 100644
index 5037408..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/rsa.go
+++ /dev/null
@@ -1,145 +0,0 @@
-package jwt
-
-import (
- "crypto"
- "crypto/rand"
- "crypto/rsa"
-)
-
-// SigningMethodRSA implements the RSA family of signing methods.
-
-// Expects *rsa.PrivateKey for signing and *rsa.PublicKey for validation
-
-type SigningMethodRSA struct {
- Name string
-
- Hash crypto.Hash
-}
-
-// Specific instances for RS256 and company
-
-var (
- SigningMethodRS256 *SigningMethodRSA
-
- SigningMethodRS384 *SigningMethodRSA
-
- SigningMethodRS512 *SigningMethodRSA
-)
-
-func init() {
-
- // RS256
-
- SigningMethodRS256 = &SigningMethodRSA{"RS256", crypto.SHA256}
-
- RegisterSigningMethod(SigningMethodRS256.Alg(), func() SigningMethod {
-
- return SigningMethodRS256
-
- })
-
- // RS384
-
- SigningMethodRS384 = &SigningMethodRSA{"RS384", crypto.SHA384}
-
- RegisterSigningMethod(SigningMethodRS384.Alg(), func() SigningMethod {
-
- return SigningMethodRS384
-
- })
-
- // RS512
-
- SigningMethodRS512 = &SigningMethodRSA{"RS512", crypto.SHA512}
-
- RegisterSigningMethod(SigningMethodRS512.Alg(), func() SigningMethod {
-
- return SigningMethodRS512
-
- })
-
-}
-
-func (m *SigningMethodRSA) Alg() string {
-
- return m.Name
-
-}
-
-// Verify implements token verification for the SigningMethod
-
-// For this signing method, must be an *rsa.PublicKey structure.
-
-func (m *SigningMethodRSA) Verify(signingString string, sig []byte, key interface{}) error {
-
- var rsaKey *rsa.PublicKey
-
- var ok bool
-
- if rsaKey, ok = key.(*rsa.PublicKey); !ok {
-
- return ErrInvalidKeyType
-
- }
-
- // Create hasher
-
- if !m.Hash.Available() {
-
- return ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Verify the signature
-
- return rsa.VerifyPKCS1v15(rsaKey, m.Hash, hasher.Sum(nil), sig)
-
-}
-
-// Sign implements token signing for the SigningMethod
-
-// For this signing method, must be an *rsa.PrivateKey structure.
-
-func (m *SigningMethodRSA) Sign(signingString string, key interface{}) ([]byte, error) {
-
- var rsaKey *rsa.PrivateKey
-
- var ok bool
-
- // Validate type of key
-
- if rsaKey, ok = key.(*rsa.PrivateKey); !ok {
-
- return nil, ErrInvalidKey
-
- }
-
- // Create the hasher
-
- if !m.Hash.Available() {
-
- return nil, ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Sign the string and return the encoded bytes
-
- if sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil {
-
- return sigBytes, nil
-
- } else {
-
- return nil, err
-
- }
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go b/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go
deleted file mode 100644
index b4d1ccb..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go
+++ /dev/null
@@ -1,216 +0,0 @@
-//go:build go1.4
-// +build go1.4
-
-package jwt
-
-import (
- "crypto"
- "crypto/rand"
- "crypto/rsa"
-)
-
-// SigningMethodRSAPSS implements the RSAPSS family of signing methods signing methods
-
-type SigningMethodRSAPSS struct {
- *SigningMethodRSA
-
- Options *rsa.PSSOptions
-
- // VerifyOptions is optional. If set overrides Options for rsa.VerifyPPS.
-
- // Used to accept tokens signed with rsa.PSSSaltLengthAuto, what doesn't follow
-
- // https://tools.ietf.org/html/rfc7518#section-3.5 but was used previously.
-
- // See https://github.com/dgrijalva/jwt-go/issues/285#issuecomment-437451244 for details.
-
- VerifyOptions *rsa.PSSOptions
-}
-
-// Specific instances for RS/PS and company.
-
-var (
- SigningMethodPS256 *SigningMethodRSAPSS
-
- SigningMethodPS384 *SigningMethodRSAPSS
-
- SigningMethodPS512 *SigningMethodRSAPSS
-)
-
-func init() {
-
- // PS256
-
- SigningMethodPS256 = &SigningMethodRSAPSS{
-
- SigningMethodRSA: &SigningMethodRSA{
-
- Name: "PS256",
-
- Hash: crypto.SHA256,
- },
-
- Options: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthEqualsHash,
- },
-
- VerifyOptions: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthAuto,
- },
- }
-
- RegisterSigningMethod(SigningMethodPS256.Alg(), func() SigningMethod {
-
- return SigningMethodPS256
-
- })
-
- // PS384
-
- SigningMethodPS384 = &SigningMethodRSAPSS{
-
- SigningMethodRSA: &SigningMethodRSA{
-
- Name: "PS384",
-
- Hash: crypto.SHA384,
- },
-
- Options: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthEqualsHash,
- },
-
- VerifyOptions: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthAuto,
- },
- }
-
- RegisterSigningMethod(SigningMethodPS384.Alg(), func() SigningMethod {
-
- return SigningMethodPS384
-
- })
-
- // PS512
-
- SigningMethodPS512 = &SigningMethodRSAPSS{
-
- SigningMethodRSA: &SigningMethodRSA{
-
- Name: "PS512",
-
- Hash: crypto.SHA512,
- },
-
- Options: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthEqualsHash,
- },
-
- VerifyOptions: &rsa.PSSOptions{
-
- SaltLength: rsa.PSSSaltLengthAuto,
- },
- }
-
- RegisterSigningMethod(SigningMethodPS512.Alg(), func() SigningMethod {
-
- return SigningMethodPS512
-
- })
-
-}
-
-// Verify implements token verification for the SigningMethod.
-
-// For this verify method, key must be an rsa.PublicKey struct
-
-func (m *SigningMethodRSAPSS) Verify(signingString string, sig []byte, key interface{}) error {
-
- var rsaKey *rsa.PublicKey
-
- switch k := key.(type) {
-
- case *rsa.PublicKey:
-
- rsaKey = k
-
- default:
-
- return ErrInvalidKey
-
- }
-
- // Create hasher
-
- if !m.Hash.Available() {
-
- return ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- opts := m.Options
-
- if m.VerifyOptions != nil {
-
- opts = m.VerifyOptions
-
- }
-
- return rsa.VerifyPSS(rsaKey, m.Hash, hasher.Sum(nil), sig, opts)
-
-}
-
-// Sign implements token signing for the SigningMethod.
-
-// For this signing method, key must be an rsa.PrivateKey struct
-
-func (m *SigningMethodRSAPSS) Sign(signingString string, key interface{}) ([]byte, error) {
-
- var rsaKey *rsa.PrivateKey
-
- switch k := key.(type) {
-
- case *rsa.PrivateKey:
-
- rsaKey = k
-
- default:
-
- return nil, ErrInvalidKeyType
-
- }
-
- // Create the hasher
-
- if !m.Hash.Available() {
-
- return nil, ErrHashUnavailable
-
- }
-
- hasher := m.Hash.New()
-
- hasher.Write([]byte(signingString))
-
- // Sign the string and return the encoded bytes
-
- if sigBytes, err := rsa.SignPSS(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil), m.Options); err == nil {
-
- return sigBytes, nil
-
- } else {
-
- return nil, err
-
- }
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go b/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go
deleted file mode 100644
index e1359d9..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go
+++ /dev/null
@@ -1,168 +0,0 @@
-package jwt
-
-import (
- "crypto/rsa"
- "crypto/x509"
- "encoding/pem"
- "errors"
-)
-
-var (
- ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key")
-
- ErrNotRSAPrivateKey = errors.New("key is not a valid RSA private key")
-
- ErrNotRSAPublicKey = errors.New("key is not a valid RSA public key")
-)
-
-// ParseRSAPrivateKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 private key
-
-func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil {
-
- if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
-
- return nil, err
-
- }
-
- }
-
- var pkey *rsa.PrivateKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok {
-
- return nil, ErrNotRSAPrivateKey
-
- }
-
- return pkey, nil
-
-}
-
-// ParseRSAPrivateKeyFromPEMWithPassword parses a PEM encoded PKCS1 or PKCS8 private key protected with password
-
-//
-
-// Deprecated: This function is deprecated and should not be used anymore. It uses the deprecated x509.DecryptPEMBlock
-
-// function, which was deprecated since RFC 1423 is regarded insecure by design. Unfortunately, there is no alternative
-
-// in the Go standard library for now. See https://github.com/golang/go/issues/8860.
-
-func ParseRSAPrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- var parsedKey interface{}
-
- var blockDecrypted []byte
-
- if blockDecrypted, err = x509.DecryptPEMBlock(block, []byte(password)); err != nil {
-
- return nil, err
-
- }
-
- if parsedKey, err = x509.ParsePKCS1PrivateKey(blockDecrypted); err != nil {
-
- if parsedKey, err = x509.ParsePKCS8PrivateKey(blockDecrypted); err != nil {
-
- return nil, err
-
- }
-
- }
-
- var pkey *rsa.PrivateKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok {
-
- return nil, ErrNotRSAPrivateKey
-
- }
-
- return pkey, nil
-
-}
-
-// ParseRSAPublicKeyFromPEM parses a certificate or a PEM encoded PKCS1 or PKIX public key
-
-func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) {
-
- var err error
-
- // Parse PEM block
-
- var block *pem.Block
-
- if block, _ = pem.Decode(key); block == nil {
-
- return nil, ErrKeyMustBePEMEncoded
-
- }
-
- // Parse the key
-
- var parsedKey interface{}
-
- if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
-
- if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
-
- parsedKey = cert.PublicKey
-
- } else {
-
- if parsedKey, err = x509.ParsePKCS1PublicKey(block.Bytes); err != nil {
-
- return nil, err
-
- }
-
- }
-
- }
-
- var pkey *rsa.PublicKey
-
- var ok bool
-
- if pkey, ok = parsedKey.(*rsa.PublicKey); !ok {
-
- return nil, ErrNotRSAPublicKey
-
- }
-
- return pkey, nil
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/signing_method.go b/vendor/github.com/golang-jwt/jwt/v5/signing_method.go
deleted file mode 100644
index 0d73631..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/signing_method.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package jwt
-
-import (
- "sync"
-)
-
-var signingMethods = map[string]func() SigningMethod{}
-var signingMethodLock = new(sync.RWMutex)
-
-// SigningMethod can be used add new methods for signing or verifying tokens. It
-// takes a decoded signature as an input in the Verify function and produces a
-// signature in Sign. The signature is then usually base64 encoded as part of a
-// JWT.
-type SigningMethod interface {
- Verify(signingString string, sig []byte, key interface{}) error // Returns nil if signature is valid
- Sign(signingString string, key interface{}) ([]byte, error) // Returns signature or error
- Alg() string // returns the alg identifier for this method (example: 'HS256')
-}
-
-// RegisterSigningMethod registers the "alg" name and a factory function for signing method.
-// This is typically done during init() in the method's implementation
-func RegisterSigningMethod(alg string, f func() SigningMethod) {
- signingMethodLock.Lock()
- defer signingMethodLock.Unlock()
-
- signingMethods[alg] = f
-}
-
-// GetSigningMethod retrieves a signing method from an "alg" string
-func GetSigningMethod(alg string) (method SigningMethod) {
- signingMethodLock.RLock()
- defer signingMethodLock.RUnlock()
-
- if methodF, ok := signingMethods[alg]; ok {
- method = methodF()
- }
- return
-}
-
-// GetAlgorithms returns a list of registered "alg" names
-func GetAlgorithms() (algs []string) {
- signingMethodLock.RLock()
- defer signingMethodLock.RUnlock()
-
- for alg := range signingMethods {
- algs = append(algs, alg)
- }
- return
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf b/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf
deleted file mode 100644
index 53745d5..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf
+++ /dev/null
@@ -1 +0,0 @@
-checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1023"]
diff --git a/vendor/github.com/golang-jwt/jwt/v5/token.go b/vendor/github.com/golang-jwt/jwt/v5/token.go
deleted file mode 100644
index 84a40bf..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/token.go
+++ /dev/null
@@ -1,141 +0,0 @@
-package jwt
-
-import (
- "encoding/base64"
- "encoding/json"
-)
-
-// Keyfunc will be used by the Parse methods as a callback function to supply
-
-// the key for verification. The function receives the parsed, but unverified
-
-// Token. This allows you to use properties in the Header of the token (such as
-
-// `kid`) to identify which key to use.
-
-type Keyfunc func(*Token) (interface{}, error)
-
-// Token represents a JWT Token. Different fields will be used depending on
-
-// whether you're creating or parsing/verifying a token.
-
-type Token struct {
- Raw string // Raw contains the raw token. Populated when you [Parse] a token
-
- Method SigningMethod // Method is the signing method used or to be used
-
- Header map[string]interface{} // Header is the first segment of the token in decoded form
-
- Claims Claims // Claims is the second segment of the token in decoded form
-
- Signature []byte // Signature is the third segment of the token in decoded form. Populated when you Parse a token
-
- Valid bool // Valid specifies if the token is valid. Populated when you Parse/Verify a token
-
-}
-
-// New creates a new [Token] with the specified signing method and an empty map
-
-// of claims. Additional options can be specified, but are currently unused.
-
-func New(method SigningMethod, opts ...TokenOption) *Token {
-
- return NewWithClaims(method, MapClaims{}, opts...)
-
-}
-
-// NewWithClaims creates a new [Token] with the specified signing method and
-
-// claims. Additional options can be specified, but are currently unused.
-
-func NewWithClaims(method SigningMethod, claims Claims, opts ...TokenOption) *Token {
-
- return &Token{
-
- Header: map[string]interface{}{
-
- "typ": "JWT",
-
- "alg": method.Alg(),
- },
-
- Claims: claims,
-
- Method: method,
- }
-
-}
-
-// SignedString creates and returns a complete, signed JWT. The token is signed
-
-// using the SigningMethod specified in the token. Please refer to
-
-// https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types
-
-// for an overview of the different signing methods and their respective key
-
-// types.
-
-func (t *Token) SignedString(key interface{}) (string, error) {
-
- sstr, err := t.SigningString()
-
- if err != nil {
-
- return "", err
-
- }
-
- sig, err := t.Method.Sign(sstr, key)
-
- if err != nil {
-
- return "", err
-
- }
-
- return sstr + "." + t.EncodeSegment(sig), nil
-
-}
-
-// SigningString generates the signing string. This is the most expensive part
-
-// of the whole deal. Unless you need this for something special, just go
-
-// straight for the SignedString.
-
-func (t *Token) SigningString() (string, error) {
-
- h, err := json.Marshal(t.Header)
-
- if err != nil {
-
- return "", err
-
- }
-
- c, err := json.Marshal(t.Claims)
-
- if err != nil {
-
- return "", err
-
- }
-
- return t.EncodeSegment(h) + "." + t.EncodeSegment(c), nil
-
-}
-
-// EncodeSegment encodes a JWT specific base64url encoding with padding
-
-// stripped. In the future, this function might take into account a
-
-// [TokenOption]. Therefore, this function exists as a method of [Token], rather
-
-// than a global function.
-
-func (*Token) EncodeSegment(seg []byte) string {
-
- return base64.RawURLEncoding.EncodeToString(seg)
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/token_option.go b/vendor/github.com/golang-jwt/jwt/v5/token_option.go
deleted file mode 100644
index b4ae3ba..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/token_option.go
+++ /dev/null
@@ -1,5 +0,0 @@
-package jwt
-
-// TokenOption is a reserved type, which provides some forward compatibility,
-// if we ever want to introduce token creation-related options.
-type TokenOption func(*Token)
diff --git a/vendor/github.com/golang-jwt/jwt/v5/types.go b/vendor/github.com/golang-jwt/jwt/v5/types.go
deleted file mode 100644
index 8e25807..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/types.go
+++ /dev/null
@@ -1,240 +0,0 @@
-package jwt
-
-import (
- "encoding/json"
- "fmt"
- "math"
- "reflect"
- "strconv"
- "time"
-)
-
-// TimePrecision sets the precision of times and dates within this library. This
-
-// has an influence on the precision of times when comparing expiry or other
-
-// related time fields. Furthermore, it is also the precision of times when
-
-// serializing.
-
-//
-
-// For backwards compatibility the default precision is set to seconds, so that
-
-// no fractional timestamps are generated.
-
-var TimePrecision = time.Second
-
-// MarshalSingleStringAsArray modifies the behavior of the ClaimStrings type,
-
-// especially its MarshalJSON function.
-
-//
-
-// If it is set to true (the default), it will always serialize the type as an
-
-// array of strings, even if it just contains one element, defaulting to the
-
-// behavior of the underlying []string. If it is set to false, it will serialize
-
-// to a single string, if it contains one element. Otherwise, it will serialize
-
-// to an array of strings.
-
-var MarshalSingleStringAsArray = true
-
-// NumericDate represents a JSON numeric date value, as referenced at
-
-// https://datatracker.ietf.org/doc/html/rfc7519#section-2.
-
-type NumericDate struct {
- time.Time
-}
-
-// NewNumericDate constructs a new *NumericDate from a standard library time.Time struct.
-
-// It will truncate the timestamp according to the precision specified in TimePrecision.
-
-func NewNumericDate(t time.Time) *NumericDate {
-
- return &NumericDate{t.Truncate(TimePrecision)}
-
-}
-
-// newNumericDateFromSeconds creates a new *NumericDate out of a float64 representing a
-
-// UNIX epoch with the float fraction representing non-integer seconds.
-
-func newNumericDateFromSeconds(f float64) *NumericDate {
-
- round, frac := math.Modf(f)
-
- return NewNumericDate(time.Unix(int64(round), int64(frac*1e9)))
-
-}
-
-// MarshalJSON is an implementation of the json.RawMessage interface and serializes the UNIX epoch
-
-// represented in NumericDate to a byte array, using the precision specified in TimePrecision.
-
-func (date NumericDate) MarshalJSON() (b []byte, err error) {
-
- var prec int
-
- if TimePrecision < time.Second {
-
- prec = int(math.Log10(float64(time.Second) / float64(TimePrecision)))
-
- }
-
- truncatedDate := date.Truncate(TimePrecision)
-
- // For very large timestamps, UnixNano would overflow an int64, but this
-
- // function requires nanosecond level precision, so we have to use the
-
- // following technique to get round the issue:
-
- //
-
- // 1. Take the normal unix timestamp to form the whole number part of the
-
- // output,
-
- // 2. Take the result of the Nanosecond function, which returns the offset
-
- // within the second of the particular unix time instance, to form the
-
- // decimal part of the output
-
- // 3. Concatenate them to produce the final result
-
- seconds := strconv.FormatInt(truncatedDate.Unix(), 10)
-
- nanosecondsOffset := strconv.FormatFloat(float64(truncatedDate.Nanosecond())/float64(time.Second), 'f', prec, 64)
-
- output := append([]byte(seconds), []byte(nanosecondsOffset)[1:]...)
-
- return output, nil
-
-}
-
-// UnmarshalJSON is an implementation of the json.RawMessage interface and
-
-// deserializes a [NumericDate] from a JSON representation, i.e. a
-
-// [json.Number]. This number represents an UNIX epoch with either integer or
-
-// non-integer seconds.
-
-func (date *NumericDate) UnmarshalJSON(b []byte) (err error) {
-
- var (
- number json.Number
-
- f float64
- )
-
- if err = json.Unmarshal(b, &number); err != nil {
-
- return fmt.Errorf("could not parse NumericData: %w", err)
-
- }
-
- if f, err = number.Float64(); err != nil {
-
- return fmt.Errorf("could not convert json number value to float: %w", err)
-
- }
-
- n := newNumericDateFromSeconds(f)
-
- *date = *n
-
- return nil
-
-}
-
-// ClaimStrings is basically just a slice of strings, but it can be either
-
-// serialized from a string array or just a string. This type is necessary,
-
-// since the "aud" claim can either be a single string or an array.
-
-type ClaimStrings []string
-
-func (s *ClaimStrings) UnmarshalJSON(data []byte) (err error) {
-
- var value interface{}
-
- if err = json.Unmarshal(data, &value); err != nil {
-
- return err
-
- }
-
- var aud []string
-
- switch v := value.(type) {
-
- case string:
-
- aud = append(aud, v)
-
- case []string:
-
- aud = ClaimStrings(v)
-
- case []interface{}:
-
- for _, vv := range v {
-
- vs, ok := vv.(string)
-
- if !ok {
-
- return &json.UnsupportedTypeError{Type: reflect.TypeOf(vv)}
-
- }
-
- aud = append(aud, vs)
-
- }
-
- case nil:
-
- return nil
-
- default:
-
- return &json.UnsupportedTypeError{Type: reflect.TypeOf(v)}
-
- }
-
- *s = aud
-
- return
-
-}
-
-func (s ClaimStrings) MarshalJSON() (b []byte, err error) {
-
- // This handles a special case in the JWT RFC. If the string array, e.g.
-
- // used by the "aud" field, only contains one element, it MAY be serialized
-
- // as a single string. This may or may not be desired based on the ecosystem
-
- // of other JWT library used, so we make it configurable by the variable
-
- // MarshalSingleStringAsArray.
-
- if len(s) == 1 && !MarshalSingleStringAsArray {
-
- return json.Marshal(s[0])
-
- }
-
- return json.Marshal([]string(s))
-
-}
diff --git a/vendor/github.com/golang-jwt/jwt/v5/validator.go b/vendor/github.com/golang-jwt/jwt/v5/validator.go
deleted file mode 100644
index 029be87..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/validator.go
+++ /dev/null
@@ -1,506 +0,0 @@
-package jwt
-
-import (
- "crypto/subtle"
- "fmt"
- "time"
-)
-
-// ClaimsValidator is an interface that can be implemented by custom claims who
-
-// wish to execute any additional claims validation based on
-
-// application-specific logic. The Validate function is then executed in
-
-// addition to the regular claims validation and any error returned is appended
-
-// to the final validation result.
-
-//
-
-// type MyCustomClaims struct {
-
-// Foo string `json:"foo"`
-
-// jwt.RegisteredClaims
-
-// }
-
-//
-
-// func (m MyCustomClaims) Validate() error {
-
-// if m.Foo != "bar" {
-
-// return errors.New("must be foobar")
-
-// }
-
-// return nil
-
-// }
-
-type ClaimsValidator interface {
- Claims
-
- Validate() error
-}
-
-// validator is the core of the new Validation API. It is automatically used by
-
-// a [Parser] during parsing and can be modified with various parser options.
-
-//
-
-// Note: This struct is intentionally not exported (yet) as we want to
-
-// internally finalize its API. In the future, we might make it publicly
-
-// available.
-
-type validator struct {
-
- // leeway is an optional leeway that can be provided to account for clock skew.
-
- leeway time.Duration
-
- // timeFunc is used to supply the current time that is needed for
-
- // validation. If unspecified, this defaults to time.Now.
-
- timeFunc func() time.Time
-
- // verifyIat specifies whether the iat (Issued At) claim will be verified.
-
- // According to https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6 this
-
- // only specifies the age of the token, but no validation check is
-
- // necessary. However, if wanted, it can be checked if the iat is
-
- // unrealistic, i.e., in the future.
-
- verifyIat bool
-
- // expectedAud contains the audience this token expects. Supplying an empty
-
- // string will disable aud checking.
-
- expectedAud string
-
- // expectedIss contains the issuer this token expects. Supplying an empty
-
- // string will disable iss checking.
-
- expectedIss string
-
- // expectedSub contains the subject this token expects. Supplying an empty
-
- // string will disable sub checking.
-
- expectedSub string
-}
-
-// newValidator can be used to create a stand-alone validator with the supplied
-
-// options. This validator can then be used to validate already parsed claims.
-
-func newValidator(opts ...ParserOption) *validator {
-
- p := NewParser(opts...)
-
- return p.validator
-
-}
-
-// Validate validates the given claims. It will also perform any custom
-
-// validation if claims implements the [ClaimsValidator] interface.
-
-func (v *validator) Validate(claims Claims) error {
-
- var (
- now time.Time
-
- errs []error = make([]error, 0, 6)
-
- err error
- )
-
- // Check, if we have a time func
-
- if v.timeFunc != nil {
-
- now = v.timeFunc()
-
- } else {
-
- now = time.Now()
-
- }
-
- // We always need to check the expiration time, but usage of the claim
-
- // itself is OPTIONAL.
-
- if err = v.verifyExpiresAt(claims, now, false); err != nil {
-
- errs = append(errs, err)
-
- }
-
- // We always need to check not-before, but usage of the claim itself is
-
- // OPTIONAL.
-
- if err = v.verifyNotBefore(claims, now, false); err != nil {
-
- errs = append(errs, err)
-
- }
-
- // Check issued-at if the option is enabled
-
- if v.verifyIat {
-
- if err = v.verifyIssuedAt(claims, now, false); err != nil {
-
- errs = append(errs, err)
-
- }
-
- }
-
- // If we have an expected audience, we also require the audience claim
-
- if v.expectedAud != "" {
-
- if err = v.verifyAudience(claims, v.expectedAud, true); err != nil {
-
- errs = append(errs, err)
-
- }
-
- }
-
- // If we have an expected issuer, we also require the issuer claim
-
- if v.expectedIss != "" {
-
- if err = v.verifyIssuer(claims, v.expectedIss, true); err != nil {
-
- errs = append(errs, err)
-
- }
-
- }
-
- // If we have an expected subject, we also require the subject claim
-
- if v.expectedSub != "" {
-
- if err = v.verifySubject(claims, v.expectedSub, true); err != nil {
-
- errs = append(errs, err)
-
- }
-
- }
-
- // Finally, we want to give the claim itself some possibility to do some
-
- // additional custom validation based on a custom Validate function.
-
- cvt, ok := claims.(ClaimsValidator)
-
- if ok {
-
- if err := cvt.Validate(); err != nil {
-
- errs = append(errs, err)
-
- }
-
- }
-
- if len(errs) == 0 {
-
- return nil
-
- }
-
- return joinErrors(errs...)
-
-}
-
-// verifyExpiresAt compares the exp claim in claims against cmp. This function
-
-// will succeed if cmp < exp. Additional leeway is taken into account.
-
-//
-
-// If exp is not set, it will succeed if the claim is not required,
-
-// otherwise ErrTokenRequiredClaimMissing will be returned.
-
-//
-
-// Additionally, if any error occurs while retrieving the claim, e.g., when its
-
-// the wrong type, an ErrTokenUnverifiable error will be returned.
-
-func (v *validator) verifyExpiresAt(claims Claims, cmp time.Time, required bool) error {
-
- exp, err := claims.GetExpirationTime()
-
- if err != nil {
-
- return err
-
- }
-
- if exp == nil {
-
- return errorIfRequired(required, "exp")
-
- }
-
- return errorIfFalse(cmp.Before((exp.Time).Add(+v.leeway)), ErrTokenExpired)
-
-}
-
-// verifyIssuedAt compares the iat claim in claims against cmp. This function
-
-// will succeed if cmp >= iat. Additional leeway is taken into account.
-
-//
-
-// If iat is not set, it will succeed if the claim is not required,
-
-// otherwise ErrTokenRequiredClaimMissing will be returned.
-
-//
-
-// Additionally, if any error occurs while retrieving the claim, e.g., when its
-
-// the wrong type, an ErrTokenUnverifiable error will be returned.
-
-func (v *validator) verifyIssuedAt(claims Claims, cmp time.Time, required bool) error {
-
- iat, err := claims.GetIssuedAt()
-
- if err != nil {
-
- return err
-
- }
-
- if iat == nil {
-
- return errorIfRequired(required, "iat")
-
- }
-
- return errorIfFalse(!cmp.Before(iat.Add(-v.leeway)), ErrTokenUsedBeforeIssued)
-
-}
-
-// verifyNotBefore compares the nbf claim in claims against cmp. This function
-
-// will return true if cmp >= nbf. Additional leeway is taken into account.
-
-//
-
-// If nbf is not set, it will succeed if the claim is not required,
-
-// otherwise ErrTokenRequiredClaimMissing will be returned.
-
-//
-
-// Additionally, if any error occurs while retrieving the claim, e.g., when its
-
-// the wrong type, an ErrTokenUnverifiable error will be returned.
-
-func (v *validator) verifyNotBefore(claims Claims, cmp time.Time, required bool) error {
-
- nbf, err := claims.GetNotBefore()
-
- if err != nil {
-
- return err
-
- }
-
- if nbf == nil {
-
- return errorIfRequired(required, "nbf")
-
- }
-
- return errorIfFalse(!cmp.Before(nbf.Add(-v.leeway)), ErrTokenNotValidYet)
-
-}
-
-// verifyAudience compares the aud claim against cmp.
-
-//
-
-// If aud is not set or an empty list, it will succeed if the claim is not required,
-
-// otherwise ErrTokenRequiredClaimMissing will be returned.
-
-//
-
-// Additionally, if any error occurs while retrieving the claim, e.g., when its
-
-// the wrong type, an ErrTokenUnverifiable error will be returned.
-
-func (v *validator) verifyAudience(claims Claims, cmp string, required bool) error {
-
- aud, err := claims.GetAudience()
-
- if err != nil {
-
- return err
-
- }
-
- if len(aud) == 0 {
-
- return errorIfRequired(required, "aud")
-
- }
-
- // use a var here to keep constant time compare when looping over a number of claims
-
- result := false
-
- var stringClaims string
-
- for _, a := range aud {
-
- if subtle.ConstantTimeCompare([]byte(a), []byte(cmp)) != 0 {
-
- result = true
-
- }
-
- stringClaims = stringClaims + a
-
- }
-
- // case where "" is sent in one or many aud claims
-
- if stringClaims == "" {
-
- return errorIfRequired(required, "aud")
-
- }
-
- return errorIfFalse(result, ErrTokenInvalidAudience)
-
-}
-
-// verifyIssuer compares the iss claim in claims against cmp.
-
-//
-
-// If iss is not set, it will succeed if the claim is not required,
-
-// otherwise ErrTokenRequiredClaimMissing will be returned.
-
-//
-
-// Additionally, if any error occurs while retrieving the claim, e.g., when its
-
-// the wrong type, an ErrTokenUnverifiable error will be returned.
-
-func (v *validator) verifyIssuer(claims Claims, cmp string, required bool) error {
-
- iss, err := claims.GetIssuer()
-
- if err != nil {
-
- return err
-
- }
-
- if iss == "" {
-
- return errorIfRequired(required, "iss")
-
- }
-
- return errorIfFalse(iss == cmp, ErrTokenInvalidIssuer)
-
-}
-
-// verifySubject compares the sub claim against cmp.
-
-//
-
-// If sub is not set, it will succeed if the claim is not required,
-
-// otherwise ErrTokenRequiredClaimMissing will be returned.
-
-//
-
-// Additionally, if any error occurs while retrieving the claim, e.g., when its
-
-// the wrong type, an ErrTokenUnverifiable error will be returned.
-
-func (v *validator) verifySubject(claims Claims, cmp string, required bool) error {
-
- sub, err := claims.GetSubject()
-
- if err != nil {
-
- return err
-
- }
-
- if sub == "" {
-
- return errorIfRequired(required, "sub")
-
- }
-
- return errorIfFalse(sub == cmp, ErrTokenInvalidSubject)
-
-}
-
-// errorIfFalse returns the error specified in err, if the value is true.
-
-// Otherwise, nil is returned.
-
-func errorIfFalse(value bool, err error) error {
-
- if value {
-
- return nil
-
- } else {
-
- return err
-
- }
-
-}
-
-// errorIfRequired returns an ErrTokenRequiredClaimMissing error if required is
-
-// true. Otherwise, nil is returned.
-
-func errorIfRequired(required bool, claim string) error {
-
- if required {
-
- return newError(fmt.Sprintf("%s claim is required", claim), ErrTokenRequiredClaimMissing)
-
- } else {
-
- return nil
-
- }
-
-}
diff --git a/vendor/github.com/josharian/intern/README.md b/vendor/github.com/josharian/intern/README.md
deleted file mode 100644
index ffc44b2..0000000
--- a/vendor/github.com/josharian/intern/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-Docs: https://godoc.org/github.com/josharian/intern
-
-See also [Go issue 5160](https://golang.org/issue/5160).
-
-License: MIT
diff --git a/vendor/github.com/josharian/intern/intern.go b/vendor/github.com/josharian/intern/intern.go
deleted file mode 100644
index 7acb1fe..0000000
--- a/vendor/github.com/josharian/intern/intern.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Package intern interns strings.
-// Interning is best effort only.
-// Interned strings may be removed automatically
-// at any time without notification.
-// All functions may be called concurrently
-// with themselves and each other.
-package intern
-
-import "sync"
-
-var (
- pool sync.Pool = sync.Pool{
- New: func() interface{} {
- return make(map[string]string)
- },
- }
-)
-
-// String returns s, interned.
-func String(s string) string {
- m := pool.Get().(map[string]string)
- c, ok := m[s]
- if ok {
- pool.Put(m)
- return c
- }
- m[s] = s
- pool.Put(m)
- return s
-}
-
-// Bytes returns b converted to a string, interned.
-func Bytes(b []byte) string {
- m := pool.Get().(map[string]string)
- c, ok := m[string(b)]
- if ok {
- pool.Put(m)
- return c
- }
- s := string(b)
- m[s] = s
- pool.Put(m)
- return s
-}
diff --git a/vendor/github.com/josharian/intern/license.md b/vendor/github.com/josharian/intern/license.md
deleted file mode 100644
index 353d305..0000000
--- a/vendor/github.com/josharian/intern/license.md
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2019 Josh Bleecher Snyder
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/kavenegar/kavenegar-go/.gitignore b/vendor/github.com/kavenegar/kavenegar-go/.gitignore
deleted file mode 100644
index 92871d7..0000000
--- a/vendor/github.com/kavenegar/kavenegar-go/.gitignore
+++ /dev/null
@@ -1,49 +0,0 @@
-# Ideas & editors
-.idea
-*.iml
-.project
-.classpath
-.c9/
-*.launch
-.settings/
-*.sublime-workspace
-
-# VSCode
-.vscode/*
-!.vscode/settings.json
-!.vscode/tasks.json
-!.vscode/launch.json
-!.vscode/extensions.json
-*.code-workspace
-# Local History for Visual Studio Code
-.history/
-__debug_bin
-debug.test
-
-# Emacs
-*~
-\#*\#
-/.emacs.desktop
-/.emacs.desktop.lock
-*.elc
-auto-save-list
-tramp
-.\#*
-
-# Binaries for programs and plugins
-*.exe
-*.exe~
-*.dll
-*.so
-*.dylib
-
-# Test binary, built with `go test -c`
-*.test
-
-# Output of the go coverage tool, specifically when used with LiteIDE
-*.out
-
-# Other files
-.DS_Store
-Thumbs.db
-
diff --git a/vendor/github.com/kavenegar/kavenegar-go/.travis.yml b/vendor/github.com/kavenegar/kavenegar-go/.travis.yml
deleted file mode 100644
index 86eca94..0000000
--- a/vendor/github.com/kavenegar/kavenegar-go/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: go
-
-go:
- - 1.8
-
-script:
- - go test
diff --git a/vendor/github.com/kavenegar/kavenegar-go/README.md b/vendor/github.com/kavenegar/kavenegar-go/README.md
deleted file mode 100644
index 4708e79..0000000
--- a/vendor/github.com/kavenegar/kavenegar-go/README.md
+++ /dev/null
@@ -1,143 +0,0 @@
-# kavenegar-go
- [![Build Status](https://travis-ci.org/kavenegar/kavenegar-go.svg?branch=master)](https://travis-ci.org/KaveNegar/kavenegar-go)
-
-
-## Installation
-```
-go get github.com/kavenegar/kavenegar-go
-```
-## Usage
-### Send
-```golang
-package main
-import (
- "fmt"
- "net/url"
- "github.com/kavenegar/kavenegar-go"
-)
-func main() {
- api := kavenegar.New(" your apikey ")
- sender := ""
- receptor := []string{"", ""}
- message := "Hello Go!"
- if res, err := api.Message.Send(sender, receptor, message, nil); err != nil {
- switch err := err.(type) {
- case *kavenegar.APIError:
- fmt.Println(err.Error())
- case *kavenegar.HTTPError:
- fmt.Println(err.Error())
- default:
- fmt.Println(err.Error())
- }
- } else {
- for _, r := range res {
- fmt.Println("MessageID = ", r.MessageID)
- fmt.Println("Status = ", r.Status)
- //...
- }
- }
-}
-```
-### OTP
-```golang
-package main
-import (
- "fmt"
- "net/url"
- "github.com/kavenegar/kavenegar-go"
-)
-func main() {
- api := kavenegar.New(" your apikey ")
- receptor := ""
- template := ""
- token := ""
- params := &kavenegar.VerifyLookupParam{
- }
- if res, err := api.Verify.Lookup(receptor, template, token, params); err != nil {
- switch err := err.(type) {
- case *kavenegar.APIError:
- fmt.Println(err.Error())
- case *kavenegar.HTTPError:
- fmt.Println(err.Error())
- default:
- fmt.Println(err.Error())
- }
- } else {
- fmt.Println("MessageID = ", res.MessageID)
- fmt.Println("Status = ", res.Status)
- //...
- }
-
-}
-```
-### Send Bulk
-```golang
-package main
-import (
- "fmt"
- "net/url"
- "github.com/kavenegar/kavenegar-go"
-)
-func main() {
- api := kavenegar.New(" your apikey here ")
- res, err := api.Message.SendArray(url.Values{
- "receptor": {"",""},
- "message": {"Hello Go!","Hello Go!"},
- "sender": {"",""},
- })
- if err != nil {
- switch err := err.(type) {
- case *kavenegar.APIError:
- fmt.Println(err.Error())
- case *kavenegar.HTTPError:
- fmt.Println(err.Error())
- default:
- fmt.Println(err.Error())
- }
- }else{
- fmt.Println(res)
- }
-}
-```
-## Contribution
-Bug fixes, docs, and enhancements welcome! Please let us know support@kavenegar.com
-
-
-
-
-
-## راهنما
-
-### معرفی سرویس کاوه نگار
-
-کاوه نگار یک وب سرویس ارسال و دریافت پیامک و تماس صوتی است که به راحتی میتوانید از آن استفاده نمایید.
-
-### ساخت حساب کاربری
-
-اگر در وب سرویس کاوه نگار عضو نیستید میتوانید از [لینک عضویت](http://panel.kavenegar.com/client/membership/register) ثبت نام و اکانت آزمایشی برای تست API دریافت نمایید.
-
-### مستندات
-
-برای مشاهده اطلاعات کامل مستندات [وب سرویس پیامک](http://kavenegar.com/وب-سرویس-پیامک.html) به صفحه [مستندات وب سرویس](http://kavenegar.com/rest.html) مراجعه نمایید.
-
-### راهنمای فارسی
-
-در صورتی که مایل هستید راهنمای فارسی کیت توسعه کاوه نگار را مطالعه کنید به صفحه [کد ارسال پیامک](http://kavenegar.com/sdk.html) مراجعه نمایید.
-
-### اطالاعات بیشتر
-برای مطالعه بیشتر به صفحه معرفی
-[وب سرویس اس ام اس ](http://kavenegar.com)
-کاوه نگار
-مراجعه نمایید .
-
- اگر در استفاده از کیت های سرویس کاوه نگار مشکلی یا پیشنهادی داشتید ما را با یک Pull Request یا ارسال ایمیل به support@kavenegar.com خوشحال کنید.
-
-##
-![http://kavenegar.com](http://kavenegar.com/public/images/logo.png)
-
-[http://kavenegar.com](http://kavenegar.com)
-
-