refactor to go-restful
This commit is contained in:
29
vendor/github.com/gobuffalo/syncx/.gitignore
generated
vendored
Normal file
29
vendor/github.com/gobuffalo/syncx/.gitignore
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
*.log
|
||||
.DS_Store
|
||||
doc
|
||||
tmp
|
||||
pkg
|
||||
*.gem
|
||||
*.pid
|
||||
coverage
|
||||
coverage.data
|
||||
build/*
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
.svn
|
||||
profile
|
||||
.console_history
|
||||
.sass-cache/*
|
||||
.rake_tasks~
|
||||
*.log.lck
|
||||
solr/
|
||||
.jhw-cache/
|
||||
jhw.*
|
||||
*.sublime*
|
||||
node_modules/
|
||||
dist/
|
||||
generated/
|
||||
.vendor/
|
||||
bin/*
|
||||
gin-bin
|
||||
.idea/
|
3
vendor/github.com/gobuffalo/syncx/.gometalinter.json
generated
vendored
Normal file
3
vendor/github.com/gobuffalo/syncx/.gometalinter.json
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"]
|
||||
}
|
36
vendor/github.com/gobuffalo/syncx/.travis.yml
generated
vendored
Normal file
36
vendor/github.com/gobuffalo/syncx/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
language: go
|
||||
|
||||
sudo: false
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
go: "1.9.x"
|
||||
- os: windows
|
||||
go: "1.9.x"
|
||||
- os: linux
|
||||
go: "1.10.x"
|
||||
- os: windows
|
||||
go: "1.10.x"
|
||||
- os: linux
|
||||
go: "1.11.x"
|
||||
env:
|
||||
- GO111MODULE=off
|
||||
- os: windows
|
||||
go: "1.11.x"
|
||||
env:
|
||||
- GO111MODULE=off
|
||||
- os: linux
|
||||
go: "1.11.x"
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
- os: windows
|
||||
go: "1.11.x"
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
|
||||
install: false
|
||||
|
||||
script:
|
||||
- go get -v -t ./...
|
||||
- go test -v -timeout=5s -race ./...
|
21
vendor/github.com/gobuffalo/syncx/LICENSE
generated
vendored
Normal file
21
vendor/github.com/gobuffalo/syncx/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Mark Bates
|
||||
|
||||
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.
|
52
vendor/github.com/gobuffalo/syncx/Makefile
generated
vendored
Normal file
52
vendor/github.com/gobuffalo/syncx/Makefile
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
TAGS ?= "sqlite"
|
||||
GO_BIN ?= go
|
||||
|
||||
install:
|
||||
$(GO_BIN) install -tags ${TAGS} -v .
|
||||
make tidy
|
||||
|
||||
tidy:
|
||||
ifeq ($(GO111MODULE),on)
|
||||
$(GO_BIN) mod tidy
|
||||
else
|
||||
echo skipping go mod tidy
|
||||
endif
|
||||
|
||||
deps:
|
||||
$(GO_BIN) get github.com/gobuffalo/release
|
||||
$(GO_BIN) get -tags ${TAGS} -t ./...
|
||||
make tidy
|
||||
|
||||
build:
|
||||
$(GO_BIN) build -v .
|
||||
make tidy
|
||||
|
||||
test:
|
||||
$(GO_BIN) test -tags ${TAGS} ./...
|
||||
make tidy
|
||||
|
||||
ci-deps:
|
||||
$(GO_BIN) get -tags ${TAGS} -t ./...
|
||||
|
||||
ci-test:
|
||||
$(GO_BIN) test -tags ${TAGS} -race ./...
|
||||
|
||||
lint:
|
||||
gometalinter --vendor ./... --deadline=1m --skip=internal
|
||||
make tidy
|
||||
|
||||
update:
|
||||
$(GO_BIN) get -u -tags ${TAGS}
|
||||
make tidy
|
||||
make test
|
||||
make install
|
||||
make tidy
|
||||
|
||||
release-test:
|
||||
$(GO_BIN) test -tags ${TAGS} -race ./...
|
||||
make tidy
|
||||
|
||||
release:
|
||||
make tidy
|
||||
release -y -f version.go
|
||||
make tidy
|
18
vendor/github.com/gobuffalo/syncx/README.md
generated
vendored
Normal file
18
vendor/github.com/gobuffalo/syncx/README.md
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
<p align="center"><img src="https://github.com/gobuffalo/buffalo/blob/master/logo.svg" width="360"></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://godoc.org/github.com/gobuffalo/syncx"><img src="https://godoc.org/github.com/gobuffalo/syncx?status.svg" alt="GoDoc" /></a>
|
||||
<a href="https://goreportcard.com/report/github.com/gobuffalo/syncx"><img src="https://goreportcard.com/badge/github.com/gobuffalo/syncx" alt="Go Report Card" /></a>
|
||||
</p>
|
||||
|
||||
# github.com/gobuffalo/syncx
|
||||
|
||||
This package provides a set of types and tools for working in current environments.
|
||||
|
||||
See [https://godoc.org/github.com/gobuffalo/syncx](https://godoc.org/github.com/gobuffalo/syncx) for more details.
|
||||
|
||||
# Installation
|
||||
|
||||
```bash
|
||||
$ go get github.com/gobuffalo/syncx
|
||||
```
|
73
vendor/github.com/gobuffalo/syncx/byte_map.go
generated
vendored
Normal file
73
vendor/github.com/gobuffalo/syncx/byte_map.go
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
//go:generate mapgen -name "Byte" -zero "[]byte(``)" -go-type "[]byte" -pkg "" -a "[]byte(`A`)" -b "[]byte(`B`)" -c "[]byte(`C`)" -bb "[]byte(`BB`)" -destination "syncx"
|
||||
// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT.
|
||||
|
||||
package syncx
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// ByteMap wraps sync.Map and uses the following types:
|
||||
// key: string
|
||||
// value: []byte
|
||||
type ByteMap struct {
|
||||
data sync.Map
|
||||
}
|
||||
|
||||
// Delete the key from the map
|
||||
func (m *ByteMap) Delete(key string) {
|
||||
m.data.Delete(key)
|
||||
}
|
||||
|
||||
// Load the key from the map.
|
||||
// Returns []byte or bool.
|
||||
// A false return indicates either the key was not found
|
||||
// or the value is not of type []byte
|
||||
func (m *ByteMap) Load(key string) ([]byte, bool) {
|
||||
i, ok := m.data.Load(key)
|
||||
if !ok {
|
||||
return []byte(``), false
|
||||
}
|
||||
s, ok := i.([]byte)
|
||||
return s, ok
|
||||
}
|
||||
|
||||
// LoadOrStore will return an existing key or
|
||||
// store the value if not already in the map
|
||||
func (m *ByteMap) LoadOrStore(key string, value []byte) ([]byte, bool) {
|
||||
i, _ := m.data.LoadOrStore(key, value)
|
||||
s, ok := i.([]byte)
|
||||
return s, ok
|
||||
}
|
||||
|
||||
// Range over the []byte values in the map
|
||||
func (m *ByteMap) Range(f func(key string, value []byte) bool) {
|
||||
m.data.Range(func(k, v interface{}) bool {
|
||||
key, ok := k.(string)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
value, ok := v.([]byte)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return f(key, value)
|
||||
})
|
||||
}
|
||||
|
||||
// Store a []byte in the map
|
||||
func (m *ByteMap) Store(key string, value []byte) {
|
||||
m.data.Store(key, value)
|
||||
}
|
||||
|
||||
// Keys returns a list of keys in the map
|
||||
func (m *ByteMap) Keys() []string {
|
||||
var keys []string
|
||||
m.Range(func(key string, value []byte) bool {
|
||||
keys = append(keys, key)
|
||||
return true
|
||||
})
|
||||
sort.Strings(keys)
|
||||
return keys
|
||||
}
|
7
vendor/github.com/gobuffalo/syncx/go.mod
generated
vendored
Normal file
7
vendor/github.com/gobuffalo/syncx/go.mod
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
module github.com/gobuffalo/syncx
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/stretchr/testify v1.2.2
|
||||
)
|
6
vendor/github.com/gobuffalo/syncx/go.sum
generated
vendored
Normal file
6
vendor/github.com/gobuffalo/syncx/go.sum
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
73
vendor/github.com/gobuffalo/syncx/int_map.go
generated
vendored
Normal file
73
vendor/github.com/gobuffalo/syncx/int_map.go
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
//go:generate mapgen -name "Int" -zero "0" -go-type "int" -pkg "" -a "0" -b "1" -c "2" -bb "-1" -destination "syncx"
|
||||
// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT.
|
||||
|
||||
package syncx
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// IntMap wraps sync.Map and uses the following types:
|
||||
// key: string
|
||||
// value: int
|
||||
type IntMap struct {
|
||||
data sync.Map
|
||||
}
|
||||
|
||||
// Delete the key from the map
|
||||
func (m *IntMap) Delete(key string) {
|
||||
m.data.Delete(key)
|
||||
}
|
||||
|
||||
// Load the key from the map.
|
||||
// Returns int or bool.
|
||||
// A false return indicates either the key was not found
|
||||
// or the value is not of type int
|
||||
func (m *IntMap) Load(key string) (int, bool) {
|
||||
i, ok := m.data.Load(key)
|
||||
if !ok {
|
||||
return 0, false
|
||||
}
|
||||
s, ok := i.(int)
|
||||
return s, ok
|
||||
}
|
||||
|
||||
// LoadOrStore will return an existing key or
|
||||
// store the value if not already in the map
|
||||
func (m *IntMap) LoadOrStore(key string, value int) (int, bool) {
|
||||
i, _ := m.data.LoadOrStore(key, value)
|
||||
s, ok := i.(int)
|
||||
return s, ok
|
||||
}
|
||||
|
||||
// Range over the int values in the map
|
||||
func (m *IntMap) Range(f func(key string, value int) bool) {
|
||||
m.data.Range(func(k, v interface{}) bool {
|
||||
key, ok := k.(string)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
value, ok := v.(int)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return f(key, value)
|
||||
})
|
||||
}
|
||||
|
||||
// Store a int in the map
|
||||
func (m *IntMap) Store(key string, value int) {
|
||||
m.data.Store(key, value)
|
||||
}
|
||||
|
||||
// Keys returns a list of keys in the map
|
||||
func (m *IntMap) Keys() []string {
|
||||
var keys []string
|
||||
m.Range(func(key string, value int) bool {
|
||||
keys = append(keys, key)
|
||||
return true
|
||||
})
|
||||
sort.Strings(keys)
|
||||
return keys
|
||||
}
|
73
vendor/github.com/gobuffalo/syncx/interface_map.go
generated
vendored
Normal file
73
vendor/github.com/gobuffalo/syncx/interface_map.go
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
//go:generate mapgen -name "" -zero "nil" -go-type "interface{}" -pkg "" -a "0" -b "1" -c "2" -bb "-1" -destination "syncx"
|
||||
// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT.
|
||||
|
||||
package syncx
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Map wraps sync.Map and uses the following types:
|
||||
// key: string
|
||||
// value: interface{}
|
||||
type Map struct {
|
||||
data sync.Map
|
||||
}
|
||||
|
||||
// Delete the key from the map
|
||||
func (m *Map) Delete(key string) {
|
||||
m.data.Delete(key)
|
||||
}
|
||||
|
||||
// Load the key from the map.
|
||||
// Returns interface{} or bool.
|
||||
// A false return indicates either the key was not found
|
||||
// or the value is not of type interface{}
|
||||
func (m *Map) Load(key string) (interface{}, bool) {
|
||||
i, ok := m.data.Load(key)
|
||||
if !ok {
|
||||
return nil, false
|
||||
}
|
||||
s, ok := i.(interface{})
|
||||
return s, ok
|
||||
}
|
||||
|
||||
// LoadOrStore will return an existing key or
|
||||
// store the value if not already in the map
|
||||
func (m *Map) LoadOrStore(key string, value interface{}) (interface{}, bool) {
|
||||
i, _ := m.data.LoadOrStore(key, value)
|
||||
s, ok := i.(interface{})
|
||||
return s, ok
|
||||
}
|
||||
|
||||
// Range over the interface{} values in the map
|
||||
func (m *Map) Range(f func(key string, value interface{}) bool) {
|
||||
m.data.Range(func(k, v interface{}) bool {
|
||||
key, ok := k.(string)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
value, ok := v.(interface{})
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return f(key, value)
|
||||
})
|
||||
}
|
||||
|
||||
// Store a interface{} in the map
|
||||
func (m *Map) Store(key string, value interface{}) {
|
||||
m.data.Store(key, value)
|
||||
}
|
||||
|
||||
// Keys returns a list of keys in the map
|
||||
func (m *Map) Keys() []string {
|
||||
var keys []string
|
||||
m.Range(func(key string, value interface{}) bool {
|
||||
keys = append(keys, key)
|
||||
return true
|
||||
})
|
||||
sort.Strings(keys)
|
||||
return keys
|
||||
}
|
73
vendor/github.com/gobuffalo/syncx/string_map.go
generated
vendored
Normal file
73
vendor/github.com/gobuffalo/syncx/string_map.go
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
//go:generate mapgen -name "String" -zero "``" -go-type "string" -pkg "" -a "`A`" -b "`B`" -c "`C`" -bb "`BB`" -destination "syncx"
|
||||
// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT.
|
||||
|
||||
package syncx
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// StringMap wraps sync.Map and uses the following types:
|
||||
// key: string
|
||||
// value: string
|
||||
type StringMap struct {
|
||||
data sync.Map
|
||||
}
|
||||
|
||||
// Delete the key from the map
|
||||
func (m *StringMap) Delete(key string) {
|
||||
m.data.Delete(key)
|
||||
}
|
||||
|
||||
// Load the key from the map.
|
||||
// Returns string or bool.
|
||||
// A false return indicates either the key was not found
|
||||
// or the value is not of type string
|
||||
func (m *StringMap) Load(key string) (string, bool) {
|
||||
i, ok := m.data.Load(key)
|
||||
if !ok {
|
||||
return ``, false
|
||||
}
|
||||
s, ok := i.(string)
|
||||
return s, ok
|
||||
}
|
||||
|
||||
// LoadOrStore will return an existing key or
|
||||
// store the value if not already in the map
|
||||
func (m *StringMap) LoadOrStore(key string, value string) (string, bool) {
|
||||
i, _ := m.data.LoadOrStore(key, value)
|
||||
s, ok := i.(string)
|
||||
return s, ok
|
||||
}
|
||||
|
||||
// Range over the string values in the map
|
||||
func (m *StringMap) Range(f func(key string, value string) bool) {
|
||||
m.data.Range(func(k, v interface{}) bool {
|
||||
key, ok := k.(string)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
value, ok := v.(string)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return f(key, value)
|
||||
})
|
||||
}
|
||||
|
||||
// Store a string in the map
|
||||
func (m *StringMap) Store(key string, value string) {
|
||||
m.data.Store(key, value)
|
||||
}
|
||||
|
||||
// Keys returns a list of keys in the map
|
||||
func (m *StringMap) Keys() []string {
|
||||
var keys []string
|
||||
m.Range(func(key string, value string) bool {
|
||||
keys = append(keys, key)
|
||||
return true
|
||||
})
|
||||
sort.Strings(keys)
|
||||
return keys
|
||||
}
|
4
vendor/github.com/gobuffalo/syncx/version.go
generated
vendored
Normal file
4
vendor/github.com/gobuffalo/syncx/version.go
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
package syncx
|
||||
|
||||
// Version of syncx
|
||||
const Version = "v0.0.1"
|
Reference in New Issue
Block a user