Showing preview only (1,211K chars total). Download the full file or copy to clipboard to get everything.
Repository: Fs02/go-todo-backend
Branch: master
Commit: c6b0d7e90d51
Files: 188
Total size: 1.1 MB
Directory structure:
gitextract_5k9udub5/
├── .github/
│ ├── FUNDING.yml
│ └── dependabot.yml
├── .gitignore
├── .tool-versions
├── .travis.yml
├── LICENSE
├── Makefile
├── Procfile
├── README.md
├── api/
│ ├── README.md
│ ├── api.go
│ ├── handler/
│ │ ├── README.md
│ │ ├── handler.go
│ │ ├── handler_test.go
│ │ ├── healthz.go
│ │ ├── healthz_test.go
│ │ ├── score.go
│ │ ├── score_test.go
│ │ ├── todos.go
│ │ └── todos_test.go
│ └── middleware/
│ └── README.md
├── cmd/
│ ├── README.md
│ └── api/
│ └── main.go
├── db/
│ ├── README.md
│ └── migrations/
│ ├── 20202806225100_create_todos.go
│ ├── 20203006230600_create_scores.go
│ └── 20203006230700_create_points.go
├── deploy/
│ ├── README.md
│ └── api/
│ └── Dockerfile
├── docker-compose.yml
├── go.mod
├── go.sum
├── scores/
│ ├── earn.go
│ ├── earn_test.go
│ ├── point.go
│ ├── score.go
│ ├── scorestest/
│ │ └── service.go
│ └── service.go
├── todos/
│ ├── README.md
│ ├── clear.go
│ ├── clear_test.go
│ ├── create.go
│ ├── create_test.go
│ ├── delete.go
│ ├── delete_test.go
│ ├── search.go
│ ├── search_test.go
│ ├── service.go
│ ├── todo.go
│ ├── todo_test.go
│ ├── todostest/
│ │ ├── README.md
│ │ ├── service.go
│ │ └── todos.go
│ ├── update.go
│ └── update_test.go
└── vendor/
├── github.com/
│ ├── davecgh/
│ │ └── go-spew/
│ │ ├── LICENSE
│ │ └── spew/
│ │ ├── bypass.go
│ │ ├── bypasssafe.go
│ │ ├── common.go
│ │ ├── config.go
│ │ ├── doc.go
│ │ ├── dump.go
│ │ ├── format.go
│ │ └── spew.go
│ ├── go-chi/
│ │ └── chi/
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── CHANGELOG.md
│ │ ├── CONTRIBUTING.md
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── chain.go
│ │ ├── chi.go
│ │ ├── context.go
│ │ ├── middleware/
│ │ │ ├── basic_auth.go
│ │ │ ├── compress.go
│ │ │ ├── content_charset.go
│ │ │ ├── content_encoding.go
│ │ │ ├── content_type.go
│ │ │ ├── get_head.go
│ │ │ ├── heartbeat.go
│ │ │ ├── logger.go
│ │ │ ├── middleware.go
│ │ │ ├── nocache.go
│ │ │ ├── profiler.go
│ │ │ ├── realip.go
│ │ │ ├── recoverer.go
│ │ │ ├── request_id.go
│ │ │ ├── route_headers.go
│ │ │ ├── strip.go
│ │ │ ├── terminal.go
│ │ │ ├── throttle.go
│ │ │ ├── timeout.go
│ │ │ ├── url_format.go
│ │ │ ├── value.go
│ │ │ └── wrap_writer.go
│ │ ├── mux.go
│ │ └── tree.go
│ ├── goware/
│ │ └── cors/
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── cors.go
│ │ └── utils.go
│ ├── jinzhu/
│ │ └── inflection/
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── inflections.go
│ │ └── wercker.yml
│ ├── lib/
│ │ └── pq/
│ │ ├── .gitignore
│ │ ├── LICENSE.md
│ │ ├── README.md
│ │ ├── TESTS.md
│ │ ├── array.go
│ │ ├── buf.go
│ │ ├── conn.go
│ │ ├── conn_go115.go
│ │ ├── conn_go18.go
│ │ ├── connector.go
│ │ ├── copy.go
│ │ ├── doc.go
│ │ ├── encode.go
│ │ ├── error.go
│ │ ├── krb.go
│ │ ├── notice.go
│ │ ├── notify.go
│ │ ├── oid/
│ │ │ ├── doc.go
│ │ │ └── types.go
│ │ ├── rows.go
│ │ ├── scram/
│ │ │ └── scram.go
│ │ ├── ssl.go
│ │ ├── ssl_permissions.go
│ │ ├── ssl_windows.go
│ │ ├── url.go
│ │ ├── user_other.go
│ │ ├── user_posix.go
│ │ ├── user_windows.go
│ │ └── uuid.go
│ ├── pmezard/
│ │ └── go-difflib/
│ │ ├── LICENSE
│ │ └── difflib/
│ │ └── difflib.go
│ ├── serenize/
│ │ └── snaker/
│ │ ├── .travis.yml
│ │ ├── LICENSE.txt
│ │ ├── README.md
│ │ └── snaker.go
│ └── stretchr/
│ ├── objx/
│ │ ├── .codeclimate.yml
│ │ ├── .gitignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── Taskfile.yml
│ │ ├── accessors.go
│ │ ├── conversions.go
│ │ ├── doc.go
│ │ ├── map.go
│ │ ├── mutations.go
│ │ ├── security.go
│ │ ├── tests.go
│ │ ├── type_specific.go
│ │ ├── type_specific_codegen.go
│ │ └── value.go
│ └── testify/
│ ├── LICENSE
│ ├── assert/
│ │ ├── assertion_compare.go
│ │ ├── assertion_compare_can_convert.go
│ │ ├── assertion_compare_legacy.go
│ │ ├── assertion_format.go
│ │ ├── assertion_format.go.tmpl
│ │ ├── assertion_forward.go
│ │ ├── assertion_forward.go.tmpl
│ │ ├── assertion_order.go
│ │ ├── assertions.go
│ │ ├── doc.go
│ │ ├── errors.go
│ │ ├── forward_assertions.go
│ │ └── http_assertions.go
│ └── mock/
│ ├── doc.go
│ └── mock.go
├── gopkg.in/
│ └── yaml.v3/
│ ├── LICENSE
│ ├── NOTICE
│ ├── README.md
│ ├── apic.go
│ ├── decode.go
│ ├── emitterc.go
│ ├── encode.go
│ ├── parserc.go
│ ├── readerc.go
│ ├── resolve.go
│ ├── scannerc.go
│ ├── sorter.go
│ ├── writerc.go
│ ├── yaml.go
│ ├── yamlh.go
│ └── yamlprivateh.go
└── modules.txt
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/FUNDING.yml
================================================
github: Fs02
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
================================================
FILE: .gitignore
================================================
.env
bin
!bin/README.md
data/
================================================
FILE: .tool-versions
================================================
golang 1.19
================================================
FILE: .travis.yml
================================================
language: go
go:
- "1.17.x"
- "1.18.x"
- "1.19.x"
env:
- COVER=-coverprofile=c.out
script:
- go test -race $COVER ./...
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2020 Muhammad Surya
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.
================================================
FILE: Makefile
================================================
export RELEASE_VERSION ?= $(shell git show -q --format=%h)
export DOCKER_REGISTRY ?= docker.pkg.github.com/fs02/go-todo-backend
export DEPLOY ?= api
all: build start
db-migrate:
rel migrate
db-rollback:
rel rollback
gen:
go generate ./...
build: gen
go build -mod=vendor -o bin/api ./cmd/api
test: gen
go test -mod=vendor -race ./...
start:
export $$(cat .env | grep -v ^\# | xargs) && ./bin/api
docker:
docker build -t $(DOCKER_REGISTRY)/$(DEPLOY):$(RELEASE_VERSION) -f ./deploy/$(DEPLOY)/Dockerfile .
push:
docker push $(DOCKER_REGISTRY)/$(DEPLOY):$(RELEASE_VERSION)
================================================
FILE: Procfile
================================================
web: bin/api
================================================
FILE: README.md
================================================
# go-todo-backend
[](https://godoc.org/github.com/Fs02/go-todo-backend)
[](https://travis-ci.com/Fs02/go-todo-backend)
[](https://goreportcard.com/report/github.com/Fs02/go-todo-backend)
[](https://codeclimate.com/github/Fs02/go-todo-backend/maintainability)
[](https://codeclimate.com/github/Fs02/go-todo-backend/test_coverage)
Go Todo Backend Example Using Modular Project Layout for Product Microservice. It's suitable as starting point for a medium to larger project.
This example uses [Chi](https://github.com/go-chi/chi) for http router and [REL](https://github.com/go-rel/rel) for database access.
Feature:
- Modular Project Structure.
- Full example including tests.
- Docker deployment.
- Compatible with [todobackend](https://www.todobackend.com/specs/index.html).
## Installation
### Prerequisite
1. Install [mockery](https://github.com/vektra/mockery#installation) for interface mock generation.
2. Install [rel cli](https://go-rel.github.io/migration/#running-migration) for database migration.
### Running
1. Prepare `.env`.
```
cp .env.sample .env
```
2. Start postgresql and create database.
```
docker-compose up -d
```
2. Prepare database schema.
```
rel migrate
```
3. Build and Running
```
make
```
## Project Structure
```
.
├── api
│ ├── handler
│ │ ├── todos.go
│ │ └── [other handler].go
│ └── middleware
│ └── [other middleware].go
├── bin
│ ├── api
│ └── [other executable]
├── cmd
│ ├── api
│ │ └── main.go
│ └── [other cmd]
│ └── main.go
├── db
│ ├── schema.sql
│ └── migrations
│ └── [migration file]
├── todos
│ ├── todo.go
│ ├── create.go
│ ├── update.go
│ ├── delete.go
│ ├── service.go
│ └── todostest
│ ├── todo.go
│ └── service.go
├── [other domain]
│ ├── [entity a].go
│ ├── [business logic].go
│ ├── [other domain]test
│ │ └── service.go
│ └── service.go
└── [other client]
├── [entity b].go
├── client.go
└── [other client]test
└── client.go
```
This project structure is based on a modular project structure, with loosely coupled dependencies between domain, Think of making libraries under a single repo that only exports certain functionality that used by other service and http handler. One of domain that present in this example is todos.
Loosely coupled dependency between domain is enforced by avoiding the use of shared entity package, therefore any entity struct should be included inside it's own respective domain. This will prevent cyclic dependency between entity. This shouldn't be a problem in most cases, becasause if you encounter cyclic dependency, there's huge chance that the entity should belongs to the same domain.
For example, consider three structs: user, transaction and transaction items. transaction and its transaction items might need cyclic dependency and items doesn't works standalone (items without transaction should not exists), thus it should be on the same domain.
In the other hand, user and transaction shouldn't require cyclic dependency, transaction might have a user field in the struct, but user shouldn't have a slice of transaction field, therefore it should be on a separate domain.
### Domain vs Client
Domain and Client folder is very similar, the difference is client folder doesn't actually implement any business logic (service), but instead a client that calls any internal/external API to works with the domain entity.
================================================
FILE: api/README.md
================================================
# api
This package contains the root router for the handler. The root router should be `mountable` as sub router in other application (modular).
================================================
FILE: api/api.go
================================================
package api
import (
"github.com/Fs02/go-todo-backend/api/handler"
"github.com/Fs02/go-todo-backend/scores"
"github.com/Fs02/go-todo-backend/todos"
"github.com/go-chi/chi"
chimid "github.com/go-chi/chi/middleware"
"github.com/go-rel/rel"
"github.com/goware/cors"
)
// NewMux api.
func NewMux(repository rel.Repository) *chi.Mux {
var (
mux = chi.NewMux()
scores = scores.New(repository)
todos = todos.New(repository, scores)
healthzHandler = handler.NewHealthz()
todosHandler = handler.NewTodos(repository, todos)
scoreHandler = handler.NewScore(repository)
)
healthzHandler.Add("database", repository)
mux.Use(chimid.RequestID)
mux.Use(chimid.RealIP)
mux.Use(chimid.Recoverer)
mux.Use(cors.AllowAll().Handler)
mux.Mount("/healthz", healthzHandler)
mux.Mount("/todos", todosHandler)
mux.Mount("/score", scoreHandler)
return mux
}
================================================
FILE: api/handler/README.md
================================================
# handler
This package contains handler that handle http request for each endpoints.
Every handler should be simple and light, it's should only responsible for decoding request, calling business service, and encoding the response.
It's recommended to avoid implementing any business logic directly in handler, including writes to the database.
Even if the logic seems simple at the beginning, implementing the logic directly in the handler might trigger tech-debt when additional requirement comes and other engineer just added the implementation directly in handler without moving it to a specific service.
================================================
FILE: api/handler/handler.go
================================================
package handler
import (
"encoding/json"
"errors"
"net/http"
"go.uber.org/zap"
)
var (
logger, _ = zap.NewProduction(zap.Fields(zap.String("type", "handler")))
// ErrBadRequest error.
ErrBadRequest = errors.New("Bad Request")
)
func render(w http.ResponseWriter, body interface{}, status int) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(status)
switch v := body.(type) {
case string:
json.NewEncoder(w).Encode(struct {
Message string `json:"message"`
}{
Message: v,
})
case error:
json.NewEncoder(w).Encode(struct {
Error string `json:"error"`
}{
Error: v.Error(),
})
case nil:
// do nothing
default:
json.NewEncoder(w).Encode(body)
}
}
================================================
FILE: api/handler/handler_test.go
================================================
package handler
import (
"errors"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
)
func TestRender(t *testing.T) {
tests := []struct {
name string
data interface{}
response string
}{
{
name: "message",
data: "lorem",
response: `{"message":"lorem"}`,
},
{
name: "error",
data: errors.New("system error"),
response: `{"error":"system error"}`,
},
{
name: "nil",
data: nil,
response: ``,
},
{
name: "struct",
data: struct {
ID int `json:"id"`
}{ID: 1},
response: `{"id":1}`,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
var (
rr = httptest.NewRecorder()
)
render(rr, test.data, 200)
if test.response != "" {
assert.JSONEq(t, test.response, rr.Body.String())
} else {
assert.Equal(t, test.response, rr.Body.String())
}
})
}
}
================================================
FILE: api/handler/healthz.go
================================================
package handler
import (
"context"
"net/http"
"sync"
"github.com/go-chi/chi"
"go.uber.org/zap"
)
// Pinger interface.
type Pinger interface {
Ping(ctx context.Context) error
}
type ping struct {
Service string `json:"service"`
Status string `json:"status"`
}
// Healthz handler.
type Healthz struct {
*chi.Mux
pingers map[string]Pinger
}
// Show handle GET /
func (h Healthz) Show(w http.ResponseWriter, r *http.Request) {
var (
wg sync.WaitGroup
status = 200
pings = make([]ping, len(h.pingers))
)
wg.Add(len(h.pingers))
i := 0
for service, pinger := range h.pingers {
go func(i int, service string, pinger Pinger) {
defer wg.Done()
pings[i].Service = service
if err := pinger.Ping(r.Context()); err != nil {
logger.Error("ping error", zap.Error(err))
status = 503
pings[i].Status = err.Error()
} else {
pings[i].Status = "UP"
}
}(i, service, pinger)
i++
}
wg.Wait()
render(w, pings, status)
}
// Add a pinger.
func (h *Healthz) Add(name string, ping Pinger) {
h.pingers[name] = ping
}
// NewHealthz handler.
func NewHealthz() Healthz {
h := Healthz{
Mux: chi.NewMux(),
pingers: make(map[string]Pinger),
}
h.Get("/", h.Show)
return h
}
================================================
FILE: api/handler/healthz_test.go
================================================
package handler_test
import (
"context"
"errors"
"net/http"
"net/http/httptest"
"testing"
"github.com/Fs02/go-todo-backend/api/handler"
"github.com/stretchr/testify/assert"
)
type pinger struct {
err error
}
func (p pinger) Ping(ctx context.Context) error {
return p.err
}
func TestHealthz_Show(t *testing.T) {
tests := []struct {
name string
pinger handler.Pinger
status int
path string
response string
}{
{
name: "all dependencies are healthy",
pinger: pinger{},
status: http.StatusOK,
path: "/",
response: `[{"service": "test", "status": "UP"}]`,
},
{
name: "some dependencies are sick",
pinger: pinger{err: errors.New("service is down")},
status: http.StatusServiceUnavailable,
path: "/",
response: `[{"service": "test", "status": "service is down"}]`,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
var (
req, _ = http.NewRequest("GET", test.path, nil)
rr = httptest.NewRecorder()
handler = handler.NewHealthz()
)
handler.Add("test", test.pinger)
handler.ServeHTTP(rr, req)
assert.Equal(t, test.status, rr.Code)
assert.JSONEq(t, test.response, rr.Body.String())
})
}
}
================================================
FILE: api/handler/score.go
================================================
package handler
import (
"net/http"
"github.com/Fs02/go-todo-backend/scores"
"github.com/go-chi/chi"
"github.com/go-rel/rel"
)
// Score for score endpoints.
type Score struct {
*chi.Mux
repository rel.Repository
}
// Index handle GET /
func (s Score) Index(w http.ResponseWriter, r *http.Request) {
var (
ctx = r.Context()
result scores.Score
)
s.repository.Find(ctx, &result)
render(w, result, 200)
}
// Points handle Get /points
func (s Score) Points(w http.ResponseWriter, r *http.Request) {
var (
ctx = r.Context()
result []scores.Point
)
s.repository.FindAll(ctx, &result)
render(w, result, 200)
}
// NewScore handler.
func NewScore(repository rel.Repository) Score {
h := Score{
Mux: chi.NewMux(),
repository: repository,
}
h.Get("/", h.Index)
h.Get("/points", h.Points)
return h
}
================================================
FILE: api/handler/score_test.go
================================================
package handler_test
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/Fs02/go-todo-backend/api/handler"
"github.com/Fs02/go-todo-backend/scores"
"github.com/go-rel/reltest"
"github.com/stretchr/testify/assert"
)
func TestScore_Index(t *testing.T) {
tests := []struct {
name string
status int
path string
response string
mockRepo func(repo *reltest.Repository)
}{
{
name: "ok",
status: http.StatusOK,
path: "/",
response: `{"id":1, "total_point":10, "created_at":"0001-01-01T00:00:00Z", "updated_at":"0001-01-01T00:00:00Z"}`,
mockRepo: func(repo *reltest.Repository) {
repo.ExpectFind().Result(scores.Score{ID: 1, TotalPoint: 10})
},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
var (
req, _ = http.NewRequest("GET", test.path, nil)
rr = httptest.NewRecorder()
repository = reltest.New()
handler = handler.NewScore(repository)
)
if test.mockRepo != nil {
test.mockRepo(repository)
}
handler.ServeHTTP(rr, req)
assert.Equal(t, test.status, rr.Code)
assert.JSONEq(t, test.response, rr.Body.String())
repository.AssertExpectations(t)
})
}
}
func TestScore_Points(t *testing.T) {
tests := []struct {
name string
status int
path string
response string
mockRepo func(repo *reltest.Repository)
}{
{
name: "ok",
status: http.StatusOK,
path: "/points",
response: `[{"id":1, "name": "todo completed", "count":1, "score_id": 0, "created_at":"0001-01-01T00:00:00Z", "updated_at":"0001-01-01T00:00:00Z"}]`,
mockRepo: func(repo *reltest.Repository) {
repo.ExpectFindAll().Result([]scores.Point{{ID: 1, Name: "todo completed", Count: 1}})
},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
var (
req, _ = http.NewRequest("GET", test.path, nil)
rr = httptest.NewRecorder()
repository = reltest.New()
handler = handler.NewScore(repository)
)
if test.mockRepo != nil {
test.mockRepo(repository)
}
handler.ServeHTTP(rr, req)
assert.Equal(t, test.status, rr.Code)
assert.JSONEq(t, test.response, rr.Body.String())
repository.AssertExpectations(t)
})
}
}
================================================
FILE: api/handler/todos.go
================================================
package handler
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"strconv"
"github.com/Fs02/go-todo-backend/todos"
"github.com/go-chi/chi"
"github.com/go-rel/rel"
"github.com/go-rel/rel/where"
"go.uber.org/zap"
)
type ctx int
const (
bodyKey ctx = 0
loadKey ctx = 1
)
// Todos for todos endpoints.
type Todos struct {
*chi.Mux
repository rel.Repository
todos todos.Service
}
// Index handle GET /.
func (t Todos) Index(w http.ResponseWriter, r *http.Request) {
var (
ctx = r.Context()
query = r.URL.Query()
result []todos.Todo
filter = todos.Filter{
Keyword: query.Get("keyword"),
}
)
if str := query.Get("completed"); str != "" {
completed := str == "true"
filter.Completed = &completed
}
t.todos.Search(ctx, &result, filter)
render(w, result, 200)
}
// Create handle POST /
func (t Todos) Create(w http.ResponseWriter, r *http.Request) {
var (
ctx = r.Context()
todo todos.Todo
)
if err := json.NewDecoder(r.Body).Decode(&todo); err != nil {
logger.Warn("decode error", zap.Error(err))
render(w, ErrBadRequest, 400)
return
}
if err := t.todos.Create(ctx, &todo); err != nil {
render(w, err, 422)
return
}
w.Header().Set("Location", fmt.Sprint(r.RequestURI, "/", todo.ID))
render(w, todo, 201)
}
// Show handle GET /{ID}
func (t Todos) Show(w http.ResponseWriter, r *http.Request) {
var (
ctx = r.Context()
todo = ctx.Value(loadKey).(todos.Todo)
)
render(w, todo, 200)
}
// Update handle PATCH /{ID}
func (t Todos) Update(w http.ResponseWriter, r *http.Request) {
var (
ctx = r.Context()
todo = ctx.Value(loadKey).(todos.Todo)
changes = rel.NewChangeset(&todo)
)
if err := json.NewDecoder(r.Body).Decode(&todo); err != nil {
logger.Warn("decode error", zap.Error(err))
render(w, ErrBadRequest, 400)
return
}
if err := t.todos.Update(ctx, &todo, changes); err != nil {
render(w, err, 422)
return
}
render(w, todo, 200)
}
// Destroy handle DELETE /{ID}
func (t Todos) Destroy(w http.ResponseWriter, r *http.Request) {
var (
ctx = r.Context()
todo = ctx.Value(loadKey).(todos.Todo)
)
t.todos.Delete(ctx, &todo)
render(w, nil, 204)
}
// Clear handle DELETE /
func (t Todos) Clear(w http.ResponseWriter, r *http.Request) {
var (
ctx = r.Context()
)
t.todos.Clear(ctx)
render(w, nil, 204)
}
// Load is middleware that loads todos to context.
func (t Todos) Load(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var (
ctx = r.Context()
id, _ = strconv.Atoi(chi.URLParam(r, "ID"))
todo todos.Todo
)
if err := t.repository.Find(ctx, &todo, where.Eq("id", id)); err != nil {
if errors.Is(err, rel.ErrNotFound) {
render(w, err, 404)
return
}
panic(err)
}
ctx = context.WithValue(ctx, loadKey, todo)
next.ServeHTTP(w, r.WithContext(ctx))
})
}
// NewTodos handler.
func NewTodos(repository rel.Repository, todos todos.Service) Todos {
h := Todos{
Mux: chi.NewMux(),
repository: repository,
todos: todos,
}
h.Get("/", h.Index)
h.Post("/", h.Create)
h.With(h.Load).Get("/{ID}", h.Show)
h.With(h.Load).Patch("/{ID}", h.Update)
h.With(h.Load).Delete("/{ID}", h.Destroy)
h.Delete("/", h.Clear)
return h
}
================================================
FILE: api/handler/todos_test.go
================================================
package handler_test
import (
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/Fs02/go-todo-backend/api/handler"
"github.com/Fs02/go-todo-backend/todos"
"github.com/Fs02/go-todo-backend/todos/todostest"
"github.com/go-rel/rel/where"
"github.com/go-rel/reltest"
"github.com/stretchr/testify/assert"
)
func TestTodos_Index(t *testing.T) {
var (
trueb = true
)
tests := []struct {
name string
status int
path string
response string
mockTodosSearch func(todos *todostest.Service)
}{
{
name: "ok",
status: http.StatusOK,
path: "/",
response: `[{"id":1, "title":"Sleep", "completed":false, "order":0, "url":"todos/1", "created_at":"0001-01-01T00:00:00Z", "updated_at":"0001-01-01T00:00:00Z"}]`,
mockTodosSearch: todostest.MockSearch(
[]todos.Todo{{ID: 1, Title: "Sleep"}},
todos.Filter{},
nil,
),
},
{
name: "with keyword and filter completed",
status: http.StatusOK,
path: "/?keyword=Wake&completed=true",
response: `[{"id":2, "title":"Wake", "completed":true, "order":0, "url":"todos/2", "created_at":"0001-01-01T00:00:00Z", "updated_at":"0001-01-01T00:00:00Z"}]`,
mockTodosSearch: todostest.MockSearch(
[]todos.Todo{{ID: 2, Title: "Wake", Completed: true}},
todos.Filter{Keyword: "Wake", Completed: &trueb},
nil,
),
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
var (
req, _ = http.NewRequest("GET", test.path, nil)
rr = httptest.NewRecorder()
repository = reltest.New()
todos = &todostest.Service{}
handler = handler.NewTodos(repository, todos)
)
todostest.Mock(todos, test.mockTodosSearch)
handler.ServeHTTP(rr, req)
assert.Equal(t, test.status, rr.Code)
assert.JSONEq(t, test.response, rr.Body.String())
repository.AssertExpectations(t)
todos.AssertExpectations(t)
})
}
}
func TestTodos_Create(t *testing.T) {
tests := []struct {
name string
status int
path string
payload string
response string
location string
mockTodosCreate func(todos *todostest.Service)
}{
{
name: "created",
status: http.StatusCreated,
path: "/",
payload: `{"title": "Sleep"}`,
response: `{"id":1, "title":"Sleep", "completed":false, "order":0, "url":"todos/1", "created_at":"0001-01-01T00:00:00Z", "updated_at":"0001-01-01T00:00:00Z"}`,
location: "/1",
mockTodosCreate: todostest.MockCreate(
todos.Todo{ID: 1, Title: "Sleep"},
nil,
),
},
{
name: "validation error",
status: http.StatusUnprocessableEntity,
path: "/",
payload: `{"title": ""}`,
response: `{"error":"Title can't be blank"}`,
mockTodosCreate: todostest.MockCreate(
todos.Todo{Title: "Sleep"},
todos.ErrTodoTitleBlank,
),
},
{
name: "bad request",
status: http.StatusBadRequest,
path: "/",
payload: ``,
response: `{"error":"Bad Request"}`,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
var (
body = strings.NewReader(test.payload)
req, _ = http.NewRequest("POST", test.path, body)
rr = httptest.NewRecorder()
repository = reltest.New()
todos = &todostest.Service{}
handler = handler.NewTodos(repository, todos)
)
todostest.Mock(todos, test.mockTodosCreate)
handler.ServeHTTP(rr, req)
assert.Equal(t, test.status, rr.Code)
assert.Equal(t, test.location, rr.Header().Get("Location"))
assert.JSONEq(t, test.response, rr.Body.String())
repository.AssertExpectations(t)
todos.AssertExpectations(t)
})
}
}
func TestTodos_Show(t *testing.T) {
tests := []struct {
name string
status int
path string
response string
isPanic bool
mockRepo func(repo *reltest.Repository)
}{
{
name: "ok",
status: http.StatusOK,
path: "/1",
response: `{"id":1, "title":"Sleep", "completed":false, "order":0, "url":"todos/1", "created_at":"0001-01-01T00:00:00Z", "updated_at":"0001-01-01T00:00:00Z"}`,
mockRepo: func(repo *reltest.Repository) {
repo.ExpectFind(where.Eq("id", 1)).Result(todos.Todo{ID: 1, Title: "Sleep"})
},
},
{
name: "not found",
status: http.StatusNotFound,
path: "/1",
response: `{"error":"entity not found"}`,
mockRepo: func(repo *reltest.Repository) {
repo.ExpectFind(where.Eq("id", 1)).NotFound()
},
},
{
name: "panic",
path: "/1",
isPanic: true,
mockRepo: func(repo *reltest.Repository) {
repo.ExpectFind(where.Eq("id", 1)).ConnectionClosed()
},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
var (
req, _ = http.NewRequest("GET", test.path, nil)
rr = httptest.NewRecorder()
repository = reltest.New()
todos = &todostest.Service{}
handler = handler.NewTodos(repository, todos)
)
if test.mockRepo != nil {
test.mockRepo(repository)
}
if test.isPanic {
assert.Panics(t, func() {
handler.ServeHTTP(rr, req)
})
} else {
handler.ServeHTTP(rr, req)
assert.Equal(t, test.status, rr.Code)
assert.JSONEq(t, test.response, rr.Body.String())
}
repository.AssertExpectations(t)
todos.AssertExpectations(t)
})
}
}
func TestTodos_Update(t *testing.T) {
tests := []struct {
name string
status int
path string
payload string
response string
mockRepo func(repo *reltest.Repository)
mockTodosUpdate func(todos *todostest.Service)
}{
{
name: "ok",
status: http.StatusOK,
path: "/1",
payload: `{"title": "Wake"}`,
response: `{"id":1, "title":"Wake", "completed":false, "order":0, "url":"todos/1", "created_at":"0001-01-01T00:00:00Z", "updated_at":"0001-01-01T00:00:00Z"}`,
mockRepo: func(repo *reltest.Repository) {
repo.ExpectFind(where.Eq("id", 1)).Result(todos.Todo{ID: 1, Title: "Sleep"})
},
mockTodosUpdate: todostest.MockUpdate(
todos.Todo{ID: 1, Title: "Wake"},
nil,
),
},
{
name: "validation error",
status: http.StatusUnprocessableEntity,
path: "/1",
payload: `{"title": ""}`,
response: `{"error":"Title can't be blank"}`,
mockRepo: func(repo *reltest.Repository) {
repo.ExpectFind(where.Eq("id", 1)).Result(todos.Todo{ID: 1, Title: "Sleep"})
},
mockTodosUpdate: todostest.MockUpdate(
todos.Todo{ID: 1, Title: ""},
todos.ErrTodoTitleBlank,
),
},
{
name: "bad request",
status: http.StatusBadRequest,
path: "/1",
payload: ``,
response: `{"error":"Bad Request"}`,
mockRepo: func(repo *reltest.Repository) {
repo.ExpectFind(where.Eq("id", 1)).Result(todos.Todo{ID: 1, Title: "Sleep"})
},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
var (
body = strings.NewReader(test.payload)
req, _ = http.NewRequest("PATCH", test.path, body)
rr = httptest.NewRecorder()
repository = reltest.New()
todos = &todostest.Service{}
handler = handler.NewTodos(repository, todos)
)
if test.mockRepo != nil {
test.mockRepo(repository)
}
todostest.Mock(todos, test.mockTodosUpdate)
handler.ServeHTTP(rr, req)
assert.Equal(t, test.status, rr.Code)
assert.JSONEq(t, test.response, rr.Body.String())
repository.AssertExpectations(t)
todos.AssertExpectations(t)
})
}
}
func TestTodos_Destroy(t *testing.T) {
tests := []struct {
name string
status int
path string
response string
mockRepo func(repo *reltest.Repository)
mockTodosDelete func(todos *todostest.Service)
}{
{
name: "ok",
status: http.StatusNoContent,
path: "/1",
response: "",
mockRepo: func(repo *reltest.Repository) {
repo.ExpectFind(where.Eq("id", 1)).Result(todos.Todo{ID: 1, Title: "Sleep"})
},
mockTodosDelete: todostest.MockDelete(),
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
var (
req, _ = http.NewRequest("DELETE", test.path, nil)
rr = httptest.NewRecorder()
repository = reltest.New()
todos = &todostest.Service{}
handler = handler.NewTodos(repository, todos)
)
if test.mockRepo != nil {
test.mockRepo(repository)
}
todostest.Mock(todos, test.mockTodosDelete)
handler.ServeHTTP(rr, req)
assert.Equal(t, test.status, rr.Code)
assert.Equal(t, test.response, rr.Body.String())
repository.AssertExpectations(t)
todos.AssertExpectations(t)
})
}
}
func TestTodos_Clear(t *testing.T) {
tests := []struct {
name string
status int
path string
response string
mockTodosClear func(todos *todostest.Service)
}{
{
name: "created",
status: http.StatusNoContent,
path: "/",
response: "",
mockTodosClear: todostest.MockClear(),
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
var (
req, _ = http.NewRequest("DELETE", test.path, nil)
rr = httptest.NewRecorder()
repository = reltest.New()
todos = &todostest.Service{}
handler = handler.NewTodos(repository, todos)
)
todostest.Mock(todos, test.mockTodosClear)
handler.ServeHTTP(rr, req)
assert.Equal(t, test.status, rr.Code)
if test.response != "" {
assert.JSONEq(t, test.response, rr.Body.String())
} else {
assert.Equal(t, "", rr.Body.String())
}
repository.AssertExpectations(t)
todos.AssertExpectations(t)
})
}
}
================================================
FILE: api/middleware/README.md
================================================
# middleware
This package contains shared middleware that can be used accross handler. An example middleware that can be implemented here is authentication related middleware.
================================================
FILE: cmd/README.md
================================================
# cmd
Contains folders for main function for each application, the directory name for each server should match the name of the executable you want to have.
================================================
FILE: cmd/api/main.go
================================================
package main
import (
"context"
"fmt"
"net/http"
"os"
"os/signal"
"strings"
"syscall"
"time"
"github.com/Fs02/go-todo-backend/api"
"github.com/go-rel/postgres"
"github.com/go-rel/rel"
_ "github.com/lib/pq"
"go.uber.org/zap"
)
var (
logger, _ = zap.NewProduction(zap.Fields(zap.String("type", "main")))
shutdowns []func() error
)
func main() {
var (
ctx = context.Background()
port = os.Getenv("PORT")
repository = initRepository()
mux = api.NewMux(repository)
server = http.Server{
Addr: ":" + port,
Handler: mux,
}
shutdown = make(chan struct{})
)
go gracefulShutdown(ctx, &server, shutdown)
logger.Info("server starting: http://localhost" + server.Addr)
if err := server.ListenAndServe(); err != http.ErrServerClosed {
logger.Fatal("server error", zap.Error(err))
}
<-shutdown
}
func initRepository() rel.Repository {
var (
logger, _ = zap.NewProduction(zap.Fields(zap.String("type", "repository")))
dsn = fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=disable",
os.Getenv("POSTGRESQL_USERNAME"),
os.Getenv("POSTGRESQL_PASSWORD"),
os.Getenv("POSTGRESQL_HOST"),
os.Getenv("POSTGRESQL_PORT"),
os.Getenv("POSTGRESQL_DATABASE"))
)
adapter, err := postgres.Open(dsn)
if err != nil {
logger.Fatal(err.Error(), zap.Error(err))
}
// add to graceful shutdown list.
shutdowns = append(shutdowns, adapter.Close)
repository := rel.New(adapter)
repository.Instrumentation(func(ctx context.Context, op string, message string, args ...interface{}) func(err error) {
// no op for rel functions.
if strings.HasPrefix(op, "rel-") {
return func(error) {}
}
t := time.Now()
return func(err error) {
duration := time.Since(t)
if err != nil {
logger.Error(message, zap.Error(err), zap.Duration("duration", duration), zap.String("operation", op))
} else {
logger.Info(message, zap.Duration("duration", duration), zap.String("operation", op))
}
}
})
return repository
}
func gracefulShutdown(ctx context.Context, server *http.Server, shutdown chan struct{}) {
var (
sigint = make(chan os.Signal, 1)
)
signal.Notify(sigint, os.Interrupt, syscall.SIGTERM)
<-sigint
logger.Info("shutting down server gracefully")
// stop receiving any request.
if err := server.Shutdown(ctx); err != nil {
logger.Fatal("shutdown error", zap.Error(err))
}
// close any other modules.
for i := range shutdowns {
shutdowns[i]()
}
close(shutdown)
}
================================================
FILE: db/README.md
================================================
# db
Contains file required for building [database migration](https://go-rel.github.io/migration/).
================================================
FILE: db/migrations/20202806225100_create_todos.go
================================================
package migrations
import (
"github.com/go-rel/rel"
)
// MigrateCreateTodos definition
func MigrateCreateTodos(schema *rel.Schema) {
schema.CreateTable("todos", func(t *rel.Table) {
t.ID("id")
t.DateTime("created_at")
t.DateTime("updated_at")
t.String("title")
t.Bool("completed")
t.Int("order")
})
schema.CreateIndex("todos", "order", []string{"order"})
}
// RollbackCreateTodos definition
func RollbackCreateTodos(schema *rel.Schema) {
schema.DropTable("todos")
}
================================================
FILE: db/migrations/20203006230600_create_scores.go
================================================
package migrations
import (
"github.com/go-rel/rel"
)
// MigrateCreateScores definition
func MigrateCreateScores(schema *rel.Schema) {
schema.CreateTable("scores", func(t *rel.Table) {
t.ID("id")
t.DateTime("created_at")
t.DateTime("updated_at")
t.Int("total_point")
})
}
// RollbackCreateScores definition
func RollbackCreateScores(schema *rel.Schema) {
schema.DropTable("scores")
}
================================================
FILE: db/migrations/20203006230700_create_points.go
================================================
package migrations
import (
"github.com/go-rel/rel"
)
// MigrateCreatePoints definition
func MigrateCreatePoints(schema *rel.Schema) {
schema.CreateTable("points", func(t *rel.Table) {
t.ID("id")
t.DateTime("created_at")
t.DateTime("updated_at")
t.String("name")
t.Int("count")
t.Int("score_id", rel.Unsigned(true))
t.ForeignKey("score_id", "scores", "id")
})
}
// RollbackCreatePoints definition
func RollbackCreatePoints(schema *rel.Schema) {
schema.DropTable("points")
}
================================================
FILE: deploy/README.md
================================================
# deploy
This folder is where you store any deployable artifacts like `Dockerfile`.
================================================
FILE: deploy/api/Dockerfile
================================================
# Step 1:
FROM golang:1.13.5-alpine3.11 AS builder
RUN apk update && apk add --no-cache git make
WORKDIR $GOPATH/src/github.com/Fs02/go-todo-backend
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64\
go build -mod=vendor -ldflags="-w -s" -o /go/bin/api ./cmd/api
# Step 2:
# you can also use scratch here, but I prefer to use alpine because it comes with basic command such as curl useful for debugging.
FROM alpine:3.11
RUN apk update && apk add --no-cache curl ca-certificates
RUN rm -rf /var/cache/apk/*
COPY --from=builder --chown=65534:0 /go/bin/api /go/bin/api
USER 65534
EXPOSE 3000
ENTRYPOINT ["/go/bin/api"]
================================================
FILE: docker-compose.yml
================================================
version: '3'
services:
postgres:
image: postgres:alpine
environment:
POSTGRES_USER: ${POSTGRESQL_USERNAME}
POSTGRES_PASSWORD: ${POSTGRESQL_PASSWORD}
POSTGRES_DB: ${POSTGRESQL_DATABASE}
ports:
- ${POSTGRESQL_PORT}:5432
volumes:
- ./data/postgresql:/var/lib/postgresql/data/
================================================
FILE: go.mod
================================================
module github.com/Fs02/go-todo-backend
go 1.19
require (
github.com/go-chi/chi v4.1.2+incompatible
github.com/go-rel/postgres v0.8.0
github.com/go-rel/rel v0.39.0
github.com/go-rel/reltest v0.11.0
github.com/goware/cors v1.1.1
github.com/lib/pq v1.10.9
github.com/stretchr/testify v1.8.3
go.uber.org/zap v1.24.0
)
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-rel/sql v0.12.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e // indirect
github.com/stretchr/objx v0.5.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
================================================
FILE: go.sum
================================================
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec=
github.com/go-chi/chi v4.1.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-rel/postgres v0.8.0 h1:SBaXmCQbZ7t0JBw9M2UUnNgna+vAVsxPehOfllW63RU=
github.com/go-rel/postgres v0.8.0/go.mod h1:74yHS5xTTMTBUys1XqfsPea3yOdCXtSa7J1BxvJY/so=
github.com/go-rel/primaryreplica v0.4.0 h1:lhU+4dh0/sDQEs602Chiz0SJDXewPU06baWQlx7oB3c=
github.com/go-rel/rel v0.38.0/go.mod h1:Zq18pQqXZbDh2JBCo29jgt+y90nZWkUvI+W9Ls29ans=
github.com/go-rel/rel v0.39.0 h1:2zmK8kazM82iRRfWX7+mm1MxDkGKDj2W+xJLjguli5U=
github.com/go-rel/rel v0.39.0/go.mod h1:yN6+aimHyRIzbuWFe5DaxiZPuVuPfd7GlLpy/YTqTUg=
github.com/go-rel/reltest v0.11.0 h1:X9UsgZlk4zHAQlckQ5iRCE7GG1ZT2VpbLEca/dnEmYQ=
github.com/go-rel/reltest v0.11.0/go.mod h1:NWpBpRcdzy7UU6/KZtJVLOvCKoiNcQEWYEZ9//cCaTw=
github.com/go-rel/sql v0.12.0 h1:1iIm2JgUr854TjN2C2403A9nZKH1RwbMJp09SQC4HO8=
github.com/go-rel/sql v0.12.0/go.mod h1:Usxy37iCTA5aIqoJGekV4ATdCUOK5w2FiR00/VvvLJQ=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/goware/cors v1.1.1 h1:70q2dL4qV2Gl5ZlPCH8VO2ZsANEcidqbpb6Pru6qKzs=
github.com/goware/cors v1.1.1/go.mod h1:b14AZ0Wsjv3gNG3fr/TTDexvbEJyWljkGLKLVpe4vns=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
github.com/jackc/pgconn v1.12.1 h1:rsDFzIpRk7xT4B8FufgpCCeyjdNpKyghZeSefViE5W8=
github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgproto3/v2 v2.3.0 h1:brH0pCGBDkBW07HWlN/oSBXrmo3WB0UvZd1pIuDcL8Y=
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg=
github.com/jackc/pgtype v1.11.0 h1:u4uiGPz/1hryuXzyaBhSk6dnIyyG2683olG2OV+UUgs=
github.com/jackc/pgx/v4 v4.16.1 h1:JzTglcal01DrghUqt+PmzWsZx/Yh7SC/CTQmSBMTd0Y=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.15.0 h1:1V1NfVQR87RtWAgp1lv9JZJ5Jap+XFGKPi00andXGi4=
github.com/onsi/ginkgo v1.15.0/go.mod h1:hF8qUzuuC8DJGygJH3726JnCZX4MYbRB8yFfISqnKUg=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ=
github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
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/serenize/snaker v0.0.0-20201027110005-a7ad2135616e h1:zWKUYT07mGmVBH+9UgnHXd/ekCK99C8EbDSAt5qsjXE=
github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=
go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
================================================
FILE: scores/earn.go
================================================
package scores
import (
"context"
"errors"
"github.com/go-rel/rel"
)
type earn struct {
repository rel.Repository
}
func (e earn) Earn(ctx context.Context, name string, count int) error {
var (
score Score
)
return e.repository.Transaction(ctx, func(ctx context.Context) error {
// for simplicity, assumes only one user, so there's only one score and always retrieve the first one.
// this will probably lock the entire table since there's no where clause provided, but it's find since we assume only one user.
if err := e.repository.Find(ctx, &score, rel.ForUpdate()); err != nil {
if !errors.Is(err, rel.ErrNotFound) {
// unexpected error.
return err
}
score.TotalPoint = count
e.repository.MustInsert(ctx, &score)
} else {
score.TotalPoint += count
e.repository.Update(ctx, &score)
}
// insert point history.
e.repository.MustInsert(ctx, &Point{Name: name, Count: count, ScoreID: score.ID})
return nil
})
}
================================================
FILE: scores/earn_test.go
================================================
package scores
import (
"context"
"testing"
"github.com/go-rel/rel"
"github.com/go-rel/reltest"
"github.com/stretchr/testify/assert"
)
func TestEarn(t *testing.T) {
var (
ctx = context.TODO()
repository = reltest.New()
service = New(repository)
name = "todo completed"
count = 1
)
repository.ExpectTransaction(func(repository *reltest.Repository) {
repository.ExpectFind(rel.ForUpdate()).Result(Score{ID: 1, TotalPoint: 10})
repository.ExpectUpdate().For(&Score{ID: 1, TotalPoint: 11})
repository.ExpectInsert().For(&Point{Name: name, Count: count, ScoreID: 1})
})
assert.Nil(t, service.Earn(ctx, name, count))
repository.AssertExpectations(t)
}
func TestEarn_insertScore(t *testing.T) {
var (
ctx = context.TODO()
repository = reltest.New()
service = New(repository)
name = "todo completed"
count = 1
)
repository.ExpectTransaction(func(repository *reltest.Repository) {
repository.ExpectFind(rel.ForUpdate()).NotFound()
repository.ExpectInsert().For(&Score{TotalPoint: 1})
repository.ExpectInsert().For(&Point{Name: name, Count: count, ScoreID: 1})
})
assert.Nil(t, service.Earn(ctx, name, count))
repository.AssertExpectations(t)
}
func TestEarn_findError(t *testing.T) {
var (
ctx = context.TODO()
repository = reltest.New()
service = New(repository)
name = "todo completed"
count = 1
)
repository.ExpectTransaction(func(repository *reltest.Repository) {
repository.ExpectFind(rel.ForUpdate()).ConnectionClosed()
})
assert.Equal(t, reltest.ErrConnectionClosed, service.Earn(ctx, name, count))
repository.AssertExpectations(t)
}
================================================
FILE: scores/point.go
================================================
package scores
import (
"time"
)
// Point component for score.
type Point struct {
ID int `json:"id"`
Name string `json:"name"`
Count int `json:"count"`
ScoreID int `json:"score_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
================================================
FILE: scores/score.go
================================================
package scores
import (
"time"
)
// Score stores total points.
type Score struct {
ID int `json:"id"`
TotalPoint int `json:"total_point"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
================================================
FILE: scores/scorestest/service.go
================================================
// Code generated by mockery 2.9.0. DO NOT EDIT.
package scorestest
import (
context "context"
mock "github.com/stretchr/testify/mock"
)
// Service is an autogenerated mock type for the Service type
type Service struct {
mock.Mock
}
// Earn provides a mock function with given fields: ctx, name, count
func (_m *Service) Earn(ctx context.Context, name string, count int) error {
ret := _m.Called(ctx, name, count)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, int) error); ok {
r0 = rf(ctx, name, count)
} else {
r0 = ret.Error(0)
}
return r0
}
================================================
FILE: scores/service.go
================================================
package scores
import (
"context"
"github.com/go-rel/rel"
)
//go:generate mockery --name=Service --case=underscore --output scorestest --outpkg scorestest
// Service instance for todo's domain.
// Any operation done to any of object within this domain should use this service.
type Service interface {
Earn(ctx context.Context, name string, count int) error
}
// beside embeding the struct, you can also declare the function directly on this struct.
// the advantage of embedding the struct is it allows spreading the implementation across multiple files.
type service struct {
earn
}
var _ Service = (*service)(nil)
// New Scores service.
func New(repository rel.Repository) Service {
return service{
earn: earn{repository: repository},
}
}
================================================
FILE: todos/README.md
================================================
# todos
Contains domain related entities and business logic implementations. The business functionality should be exported using `Service` interface that contains necessary functions to work with the entity.
Every domain/client should have it's own testing package (`todostest`) that can be used to mock the functionality of this package, usualy generated using external tools like `mockery`.
================================================
FILE: todos/clear.go
================================================
package todos
import (
"context"
"github.com/go-rel/rel"
)
type clear struct {
repository rel.Repository
}
func (c clear) Clear(ctx context.Context) {
c.repository.MustDeleteAny(ctx, rel.From("todos"))
}
================================================
FILE: todos/clear_test.go
================================================
package todos
import (
"context"
"testing"
"github.com/go-rel/rel"
"github.com/go-rel/reltest"
"github.com/stretchr/testify/assert"
)
func TestClear(t *testing.T) {
var (
ctx = context.TODO()
repository = reltest.New()
service = New(repository, nil)
)
repository.ExpectDeleteAny(rel.From("todos")).Unsafe()
assert.NotPanics(t, func() {
service.Clear(ctx)
})
repository.AssertExpectations(t)
}
================================================
FILE: todos/create.go
================================================
package todos
import (
"context"
"github.com/Fs02/go-todo-backend/scores"
"github.com/go-rel/rel"
"go.uber.org/zap"
)
type create struct {
repository rel.Repository
scores scores.Service
}
func (c create) Create(ctx context.Context, todo *Todo) error {
if err := todo.Validate(); err != nil {
logger.Warn("validation error", zap.Error(err))
return err
}
// if completed, then earn a point.
if todo.Completed {
return c.repository.Transaction(ctx, func(ctx context.Context) error {
c.repository.MustInsert(ctx, todo)
return c.scores.Earn(ctx, "todo completed", 1)
})
}
c.repository.MustInsert(ctx, todo)
return nil
}
================================================
FILE: todos/create_test.go
================================================
package todos
import (
"context"
"testing"
"github.com/Fs02/go-todo-backend/scores/scorestest"
"github.com/go-rel/reltest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
func TestCreate(t *testing.T) {
var (
ctx = context.TODO()
repository = reltest.New()
scores = &scorestest.Service{}
service = New(repository, scores)
todo = Todo{Title: "Sleep"}
)
repository.ExpectInsert().For(&todo)
assert.Nil(t, service.Create(ctx, &todo))
assert.NotEmpty(t, todo.ID)
repository.AssertExpectations(t)
scores.AssertExpectations(t)
}
func TestCreate_completed(t *testing.T) {
var (
ctx = context.TODO()
repository = reltest.New()
scores = &scorestest.Service{}
service = New(repository, scores)
todo = Todo{Title: "Sleep", Completed: true}
)
repository.ExpectTransaction(func(repository *reltest.Repository) {
scores.On("Earn", mock.Anything, "todo completed", 1).Return(nil)
repository.ExpectInsert().For(&todo)
})
assert.Nil(t, service.Create(ctx, &todo))
assert.NotEmpty(t, todo.ID)
repository.AssertExpectations(t)
scores.AssertExpectations(t)
}
func TestCreate_validateError(t *testing.T) {
var (
ctx = context.TODO()
repository = reltest.New()
scores = &scorestest.Service{}
service = New(repository, scores)
todo = Todo{Title: ""}
)
assert.Equal(t, ErrTodoTitleBlank, service.Create(ctx, &todo))
repository.AssertExpectations(t)
scores.AssertExpectations(t)
}
================================================
FILE: todos/delete.go
================================================
package todos
import (
"context"
"github.com/go-rel/rel"
)
type delete struct {
repository rel.Repository
}
func (d delete) Delete(ctx context.Context, todo *Todo) {
d.repository.MustDelete(ctx, todo)
}
================================================
FILE: todos/delete_test.go
================================================
package todos
import (
"context"
"testing"
"github.com/go-rel/reltest"
"github.com/stretchr/testify/assert"
)
func TestDelete(t *testing.T) {
var (
ctx = context.TODO()
repository = reltest.New()
service = New(repository, nil)
todo = Todo{ID: 1, Title: "Sleep"}
)
repository.ExpectDelete().ForType("todos.Todo")
assert.NotPanics(t, func() {
service.Delete(ctx, &todo)
})
repository.AssertExpectations(t)
}
================================================
FILE: todos/search.go
================================================
package todos
import (
"context"
"github.com/go-rel/rel"
)
// Filter for search.
type Filter struct {
Keyword string
Completed *bool
}
type search struct {
repository rel.Repository
}
func (s search) Search(ctx context.Context, todos *[]Todo, filter Filter) error {
var (
query = rel.Select().SortAsc("order")
)
if filter.Keyword != "" {
query = query.Where(rel.Like("title", "%"+filter.Keyword+"%"))
}
if filter.Completed != nil {
query = query.Where(rel.Eq("completed", *filter.Completed))
}
s.repository.MustFindAll(ctx, todos, query)
return nil
}
================================================
FILE: todos/search_test.go
================================================
package todos
import (
"context"
"testing"
"github.com/go-rel/rel"
"github.com/go-rel/reltest"
"github.com/stretchr/testify/assert"
)
func TestSearch(t *testing.T) {
var (
ctx = context.TODO()
repository = reltest.New()
service = New(repository, nil)
todos []Todo
completed = false
filter = Filter{Keyword: "Sleep", Completed: &completed}
result = []Todo{{ID: 1, Title: "Sleep"}}
)
repository.ExpectFindAll(
rel.Select().SortAsc("order").Where(rel.Like("title", "%Sleep%").AndEq("completed", false)),
).Result(result)
assert.NotPanics(t, func() {
service.Search(ctx, &todos, filter)
assert.Equal(t, result, todos)
})
repository.AssertExpectations(t)
}
================================================
FILE: todos/service.go
================================================
package todos
import (
"context"
"github.com/Fs02/go-todo-backend/scores"
"github.com/go-rel/rel"
"go.uber.org/zap"
)
var (
logger, _ = zap.NewProduction(zap.Fields(zap.String("type", "todos")))
)
//go:generate mockery --name=Service --case=underscore --output todostest --outpkg todostest
// Service instance for todo's domain.
// Any operation done to any of object within this domain should use this service.
type Service interface {
Search(ctx context.Context, todos *[]Todo, filter Filter) error
Create(ctx context.Context, todo *Todo) error
Update(ctx context.Context, todo *Todo, changes rel.Changeset) error
Delete(ctx context.Context, todo *Todo)
Clear(ctx context.Context)
}
// beside embeding the struct, you can also declare the function directly on this struct.
// the advantage of embedding the struct is it allows spreading the implementation across multiple files.
type service struct {
search
create
update
delete
clear
}
var _ Service = (*service)(nil)
// New Todos service.
func New(repository rel.Repository, scores scores.Service) Service {
return service{
search: search{repository: repository},
create: create{repository: repository, scores: scores},
update: update{repository: repository, scores: scores},
delete: delete{repository: repository},
clear: clear{repository: repository},
}
}
================================================
FILE: todos/todo.go
================================================
package todos
import (
"encoding/json"
"errors"
"fmt"
"os"
"time"
)
var (
// TodoURLPrefix to be returned when encoding todo.
TodoURLPrefix = os.Getenv("URL") + "todos/"
// ErrTodoTitleBlank validation error.
ErrTodoTitleBlank = errors.New("Title can't be blank")
)
// Todo respresent a record stored in todos table.
type Todo struct {
ID uint `json:"id"`
Title string `json:"title"`
Order int `json:"order"`
Completed bool `json:"completed"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// Validate todo.
func (t Todo) Validate() error {
var err error
switch {
case len(t.Title) == 0:
err = ErrTodoTitleBlank
}
return err
}
// MarshalJSON implement custom marshaller to marshal url.
func (t Todo) MarshalJSON() ([]byte, error) {
type Alias Todo
return json.Marshal(struct {
Alias
URL string `json:"url"`
}{
Alias: Alias(t),
URL: fmt.Sprint(TodoURLPrefix, t.ID),
})
}
================================================
FILE: todos/todo_test.go
================================================
package todos
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/assert"
)
func init() {
TodoURLPrefix = "http://localhost:3000/"
}
func TestTodo_Validate(t *testing.T) {
var todo Todo
t.Run("title is blank", func(t *testing.T) {
assert.Equal(t, ErrTodoTitleBlank, todo.Validate())
})
t.Run("valid", func(t *testing.T) {
todo.Title = "Sleep"
assert.Nil(t, todo.Validate())
})
}
func TestTodo_MarshalJSON(t *testing.T) {
var (
todo = Todo{
ID: 1,
Title: "Sleep",
Completed: true,
}
encoded, err = json.Marshal(todo)
)
assert.Nil(t, err)
assert.JSONEq(t, `{
"id": 1,
"title": "Sleep",
"completed": true,
"order": 0,
"url": "http://localhost:3000/1",
"created_at": "0001-01-01T00:00:00Z",
"updated_at": "0001-01-01T00:00:00Z"
}`, string(encoded))
}
================================================
FILE: todos/todostest/README.md
================================================
# todostest
This package should be named using `[domain]test` format, which is also used by standard package such as `net/http/httptest`.
If needed, this package may also contains additional function that act as helper for mocking (see todo.go).
================================================
FILE: todos/todostest/service.go
================================================
// Code generated by mockery 2.9.0. DO NOT EDIT.
package todostest
import (
context "context"
rel "github.com/go-rel/rel"
mock "github.com/stretchr/testify/mock"
todos "github.com/Fs02/go-todo-backend/todos"
)
// Service is an autogenerated mock type for the Service type
type Service struct {
mock.Mock
}
// Clear provides a mock function with given fields: ctx
func (_m *Service) Clear(ctx context.Context) {
_m.Called(ctx)
}
// Create provides a mock function with given fields: ctx, todo
func (_m *Service) Create(ctx context.Context, todo *todos.Todo) error {
ret := _m.Called(ctx, todo)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *todos.Todo) error); ok {
r0 = rf(ctx, todo)
} else {
r0 = ret.Error(0)
}
return r0
}
// Delete provides a mock function with given fields: ctx, todo
func (_m *Service) Delete(ctx context.Context, todo *todos.Todo) {
_m.Called(ctx, todo)
}
// Search provides a mock function with given fields: ctx, _a1, filter
func (_m *Service) Search(ctx context.Context, _a1 *[]todos.Todo, filter todos.Filter) error {
ret := _m.Called(ctx, _a1, filter)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *[]todos.Todo, todos.Filter) error); ok {
r0 = rf(ctx, _a1, filter)
} else {
r0 = ret.Error(0)
}
return r0
}
// Update provides a mock function with given fields: ctx, todo, changes
func (_m *Service) Update(ctx context.Context, todo *todos.Todo, changes rel.Changeset) error {
ret := _m.Called(ctx, todo, changes)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *todos.Todo, rel.Changeset) error); ok {
r0 = rf(ctx, todo, changes)
} else {
r0 = ret.Error(0)
}
return r0
}
================================================
FILE: todos/todostest/todos.go
================================================
package todostest
import (
context "context"
todos "github.com/Fs02/go-todo-backend/todos"
rel "github.com/go-rel/rel"
mock "github.com/stretchr/testify/mock"
)
// MockFunc function.
type MockFunc func(service *Service)
// Mock apply mock todo functions.
func Mock(service *Service, funcs ...MockFunc) {
for i := range funcs {
if funcs[i] != nil {
funcs[i](service)
}
}
}
// MockSearch util.
func MockSearch(result []todos.Todo, filter todos.Filter, err error) MockFunc {
return func(service *Service) {
service.On("Search", mock.Anything, mock.Anything, filter).
Return(func(ctx context.Context, out *[]todos.Todo, filter todos.Filter) error {
*out = result
return err
})
}
}
// MockCreate util.
func MockCreate(result todos.Todo, err error) MockFunc {
return func(service *Service) {
service.On("Create", mock.Anything, mock.Anything).
Return(func(ctx context.Context, out *todos.Todo) error {
*out = result
return err
})
}
}
// MockUpdate util.
func MockUpdate(result todos.Todo, err error) MockFunc {
return func(service *Service) {
service.On("Update", mock.Anything, mock.Anything, mock.Anything).
Return(func(ctx context.Context, out *todos.Todo, changeset rel.Changeset) error {
if result.ID != out.ID {
panic("inconsistent id")
}
*out = result
return err
})
}
}
// MockClear util.
func MockClear() MockFunc {
return func(service *Service) {
service.On("Clear", mock.Anything)
}
}
// MockDelete util.
func MockDelete() MockFunc {
return func(service *Service) {
service.On("Delete", mock.Anything, mock.Anything)
}
}
================================================
FILE: todos/update.go
================================================
package todos
import (
"context"
"github.com/Fs02/go-todo-backend/scores"
"github.com/go-rel/rel"
"go.uber.org/zap"
)
type update struct {
repository rel.Repository
scores scores.Service
}
func (u update) Update(ctx context.Context, todo *Todo, changes rel.Changeset) error {
if err := todo.Validate(); err != nil {
logger.Warn("validation error", zap.Error(err))
return err
}
// update score if completed is changed.
if changes.FieldChanged("completed") {
return u.repository.Transaction(ctx, func(ctx context.Context) error {
u.repository.MustUpdate(ctx, todo, changes)
if todo.Completed {
return u.scores.Earn(ctx, "todo completed", 1)
}
return u.scores.Earn(ctx, "todo uncompleted", -2)
})
}
u.repository.MustUpdate(ctx, todo, changes)
return nil
}
================================================
FILE: todos/update_test.go
================================================
package todos
import (
"context"
"testing"
"github.com/Fs02/go-todo-backend/scores/scorestest"
"github.com/go-rel/rel"
"github.com/go-rel/reltest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
func TestUpdate(t *testing.T) {
var (
ctx = context.TODO()
repository = reltest.New()
scores = &scorestest.Service{}
service = New(repository, scores)
todo = Todo{ID: 1, Title: "Sleep"}
changes = rel.NewChangeset(&todo)
)
todo.Title = "Wake up"
repository.ExpectUpdate(changes).ForType("todos.Todo")
assert.Nil(t, service.Update(ctx, &todo, changes))
assert.NotEmpty(t, todo.ID)
repository.AssertExpectations(t)
scores.AssertExpectations(t)
}
func TestUpdate_completed(t *testing.T) {
var (
ctx = context.TODO()
repository = reltest.New()
scores = &scorestest.Service{}
service = New(repository, scores)
todo = Todo{ID: 1, Title: "Sleep"}
changes = rel.NewChangeset(&todo)
)
todo.Completed = true
repository.ExpectTransaction(func(repository *reltest.Repository) {
scores.On("Earn", mock.Anything, "todo completed", 1).Return(nil)
repository.ExpectUpdate(changes).ForType("todos.Todo")
})
assert.Nil(t, service.Update(ctx, &todo, changes))
assert.NotEmpty(t, todo.ID)
repository.AssertExpectations(t)
scores.AssertExpectations(t)
}
func TestUpdate_uncompleted(t *testing.T) {
var (
ctx = context.TODO()
repository = reltest.New()
scores = &scorestest.Service{}
service = New(repository, scores)
todo = Todo{ID: 1, Title: "Sleep", Completed: true}
changes = rel.NewChangeset(&todo)
)
todo.Completed = false
repository.ExpectTransaction(func(repository *reltest.Repository) {
scores.On("Earn", mock.Anything, "todo uncompleted", -2).Return(nil)
repository.ExpectUpdate(changes).ForType("todos.Todo")
})
assert.Nil(t, service.Update(ctx, &todo, changes))
assert.NotEmpty(t, todo.ID)
repository.AssertExpectations(t)
scores.AssertExpectations(t)
}
func TestUpdate_validateError(t *testing.T) {
var (
ctx = context.TODO()
repository = reltest.New()
scores = &scorestest.Service{}
service = New(repository, scores)
todo = Todo{ID: 1, Title: "Sleep"}
changes = rel.NewChangeset(&todo)
)
todo.Title = ""
assert.Equal(t, ErrTodoTitleBlank, service.Update(ctx, &todo, changes))
repository.AssertExpectations(t)
scores.AssertExpectations(t)
}
================================================
FILE: vendor/github.com/davecgh/go-spew/LICENSE
================================================
ISC License
Copyright (c) 2012-2016 Dave Collins <dave@davec.name>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/bypass.go
================================================
// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
// NOTE: Due to the following build constraints, this file will only be compiled
// when the code is not running on Google App Engine, compiled by GopherJS, and
// "-tags safe" is not added to the go build command line. The "disableunsafe"
// tag is deprecated and thus should not be used.
// Go versions prior to 1.4 are disabled because they use a different layout
// for interfaces which make the implementation of unsafeReflectValue more complex.
// +build !js,!appengine,!safe,!disableunsafe,go1.4
package spew
import (
"reflect"
"unsafe"
)
const (
// UnsafeDisabled is a build-time constant which specifies whether or
// not access to the unsafe package is available.
UnsafeDisabled = false
// ptrSize is the size of a pointer on the current arch.
ptrSize = unsafe.Sizeof((*byte)(nil))
)
type flag uintptr
var (
// flagRO indicates whether the value field of a reflect.Value
// is read-only.
flagRO flag
// flagAddr indicates whether the address of the reflect.Value's
// value may be taken.
flagAddr flag
)
// flagKindMask holds the bits that make up the kind
// part of the flags field. In all the supported versions,
// it is in the lower 5 bits.
const flagKindMask = flag(0x1f)
// Different versions of Go have used different
// bit layouts for the flags type. This table
// records the known combinations.
var okFlags = []struct {
ro, addr flag
}{{
// From Go 1.4 to 1.5
ro: 1 << 5,
addr: 1 << 7,
}, {
// Up to Go tip.
ro: 1<<5 | 1<<6,
addr: 1 << 8,
}}
var flagValOffset = func() uintptr {
field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag")
if !ok {
panic("reflect.Value has no flag field")
}
return field.Offset
}()
// flagField returns a pointer to the flag field of a reflect.Value.
func flagField(v *reflect.Value) *flag {
return (*flag)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + flagValOffset))
}
// unsafeReflectValue converts the passed reflect.Value into a one that bypasses
// the typical safety restrictions preventing access to unaddressable and
// unexported data. It works by digging the raw pointer to the underlying
// value out of the protected value and generating a new unprotected (unsafe)
// reflect.Value to it.
//
// This allows us to check for implementations of the Stringer and error
// interfaces to be used for pretty printing ordinarily unaddressable and
// inaccessible values such as unexported struct fields.
func unsafeReflectValue(v reflect.Value) reflect.Value {
if !v.IsValid() || (v.CanInterface() && v.CanAddr()) {
return v
}
flagFieldPtr := flagField(&v)
*flagFieldPtr &^= flagRO
*flagFieldPtr |= flagAddr
return v
}
// Sanity checks against future reflect package changes
// to the type or semantics of the Value.flag field.
func init() {
field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag")
if !ok {
panic("reflect.Value has no flag field")
}
if field.Type.Kind() != reflect.TypeOf(flag(0)).Kind() {
panic("reflect.Value flag field has changed kind")
}
type t0 int
var t struct {
A t0
// t0 will have flagEmbedRO set.
t0
// a will have flagStickyRO set
a t0
}
vA := reflect.ValueOf(t).FieldByName("A")
va := reflect.ValueOf(t).FieldByName("a")
vt0 := reflect.ValueOf(t).FieldByName("t0")
// Infer flagRO from the difference between the flags
// for the (otherwise identical) fields in t.
flagPublic := *flagField(&vA)
flagWithRO := *flagField(&va) | *flagField(&vt0)
flagRO = flagPublic ^ flagWithRO
// Infer flagAddr from the difference between a value
// taken from a pointer and not.
vPtrA := reflect.ValueOf(&t).Elem().FieldByName("A")
flagNoPtr := *flagField(&vA)
flagPtr := *flagField(&vPtrA)
flagAddr = flagNoPtr ^ flagPtr
// Check that the inferred flags tally with one of the known versions.
for _, f := range okFlags {
if flagRO == f.ro && flagAddr == f.addr {
return
}
}
panic("reflect.Value read-only flag has changed semantics")
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/bypasssafe.go
================================================
// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
// NOTE: Due to the following build constraints, this file will only be compiled
// when the code is running on Google App Engine, compiled by GopherJS, or
// "-tags safe" is added to the go build command line. The "disableunsafe"
// tag is deprecated and thus should not be used.
// +build js appengine safe disableunsafe !go1.4
package spew
import "reflect"
const (
// UnsafeDisabled is a build-time constant which specifies whether or
// not access to the unsafe package is available.
UnsafeDisabled = true
)
// unsafeReflectValue typically converts the passed reflect.Value into a one
// that bypasses the typical safety restrictions preventing access to
// unaddressable and unexported data. However, doing this relies on access to
// the unsafe package. This is a stub version which simply returns the passed
// reflect.Value when the unsafe package is not available.
func unsafeReflectValue(v reflect.Value) reflect.Value {
return v
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/common.go
================================================
/*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package spew
import (
"bytes"
"fmt"
"io"
"reflect"
"sort"
"strconv"
)
// Some constants in the form of bytes to avoid string overhead. This mirrors
// the technique used in the fmt package.
var (
panicBytes = []byte("(PANIC=")
plusBytes = []byte("+")
iBytes = []byte("i")
trueBytes = []byte("true")
falseBytes = []byte("false")
interfaceBytes = []byte("(interface {})")
commaNewlineBytes = []byte(",\n")
newlineBytes = []byte("\n")
openBraceBytes = []byte("{")
openBraceNewlineBytes = []byte("{\n")
closeBraceBytes = []byte("}")
asteriskBytes = []byte("*")
colonBytes = []byte(":")
colonSpaceBytes = []byte(": ")
openParenBytes = []byte("(")
closeParenBytes = []byte(")")
spaceBytes = []byte(" ")
pointerChainBytes = []byte("->")
nilAngleBytes = []byte("<nil>")
maxNewlineBytes = []byte("<max depth reached>\n")
maxShortBytes = []byte("<max>")
circularBytes = []byte("<already shown>")
circularShortBytes = []byte("<shown>")
invalidAngleBytes = []byte("<invalid>")
openBracketBytes = []byte("[")
closeBracketBytes = []byte("]")
percentBytes = []byte("%")
precisionBytes = []byte(".")
openAngleBytes = []byte("<")
closeAngleBytes = []byte(">")
openMapBytes = []byte("map[")
closeMapBytes = []byte("]")
lenEqualsBytes = []byte("len=")
capEqualsBytes = []byte("cap=")
)
// hexDigits is used to map a decimal value to a hex digit.
var hexDigits = "0123456789abcdef"
// catchPanic handles any panics that might occur during the handleMethods
// calls.
func catchPanic(w io.Writer, v reflect.Value) {
if err := recover(); err != nil {
w.Write(panicBytes)
fmt.Fprintf(w, "%v", err)
w.Write(closeParenBytes)
}
}
// handleMethods attempts to call the Error and String methods on the underlying
// type the passed reflect.Value represents and outputes the result to Writer w.
//
// It handles panics in any called methods by catching and displaying the error
// as the formatted value.
func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) {
// We need an interface to check if the type implements the error or
// Stringer interface. However, the reflect package won't give us an
// interface on certain things like unexported struct fields in order
// to enforce visibility rules. We use unsafe, when it's available,
// to bypass these restrictions since this package does not mutate the
// values.
if !v.CanInterface() {
if UnsafeDisabled {
return false
}
v = unsafeReflectValue(v)
}
// Choose whether or not to do error and Stringer interface lookups against
// the base type or a pointer to the base type depending on settings.
// Technically calling one of these methods with a pointer receiver can
// mutate the value, however, types which choose to satisify an error or
// Stringer interface with a pointer receiver should not be mutating their
// state inside these interface methods.
if !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() {
v = unsafeReflectValue(v)
}
if v.CanAddr() {
v = v.Addr()
}
// Is it an error or Stringer?
switch iface := v.Interface().(type) {
case error:
defer catchPanic(w, v)
if cs.ContinueOnMethod {
w.Write(openParenBytes)
w.Write([]byte(iface.Error()))
w.Write(closeParenBytes)
w.Write(spaceBytes)
return false
}
w.Write([]byte(iface.Error()))
return true
case fmt.Stringer:
defer catchPanic(w, v)
if cs.ContinueOnMethod {
w.Write(openParenBytes)
w.Write([]byte(iface.String()))
w.Write(closeParenBytes)
w.Write(spaceBytes)
return false
}
w.Write([]byte(iface.String()))
return true
}
return false
}
// printBool outputs a boolean value as true or false to Writer w.
func printBool(w io.Writer, val bool) {
if val {
w.Write(trueBytes)
} else {
w.Write(falseBytes)
}
}
// printInt outputs a signed integer value to Writer w.
func printInt(w io.Writer, val int64, base int) {
w.Write([]byte(strconv.FormatInt(val, base)))
}
// printUint outputs an unsigned integer value to Writer w.
func printUint(w io.Writer, val uint64, base int) {
w.Write([]byte(strconv.FormatUint(val, base)))
}
// printFloat outputs a floating point value using the specified precision,
// which is expected to be 32 or 64bit, to Writer w.
func printFloat(w io.Writer, val float64, precision int) {
w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision)))
}
// printComplex outputs a complex value using the specified float precision
// for the real and imaginary parts to Writer w.
func printComplex(w io.Writer, c complex128, floatPrecision int) {
r := real(c)
w.Write(openParenBytes)
w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision)))
i := imag(c)
if i >= 0 {
w.Write(plusBytes)
}
w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision)))
w.Write(iBytes)
w.Write(closeParenBytes)
}
// printHexPtr outputs a uintptr formatted as hexadecimal with a leading '0x'
// prefix to Writer w.
func printHexPtr(w io.Writer, p uintptr) {
// Null pointer.
num := uint64(p)
if num == 0 {
w.Write(nilAngleBytes)
return
}
// Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix
buf := make([]byte, 18)
// It's simpler to construct the hex string right to left.
base := uint64(16)
i := len(buf) - 1
for num >= base {
buf[i] = hexDigits[num%base]
num /= base
i--
}
buf[i] = hexDigits[num]
// Add '0x' prefix.
i--
buf[i] = 'x'
i--
buf[i] = '0'
// Strip unused leading bytes.
buf = buf[i:]
w.Write(buf)
}
// valuesSorter implements sort.Interface to allow a slice of reflect.Value
// elements to be sorted.
type valuesSorter struct {
values []reflect.Value
strings []string // either nil or same len and values
cs *ConfigState
}
// newValuesSorter initializes a valuesSorter instance, which holds a set of
// surrogate keys on which the data should be sorted. It uses flags in
// ConfigState to decide if and how to populate those surrogate keys.
func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface {
vs := &valuesSorter{values: values, cs: cs}
if canSortSimply(vs.values[0].Kind()) {
return vs
}
if !cs.DisableMethods {
vs.strings = make([]string, len(values))
for i := range vs.values {
b := bytes.Buffer{}
if !handleMethods(cs, &b, vs.values[i]) {
vs.strings = nil
break
}
vs.strings[i] = b.String()
}
}
if vs.strings == nil && cs.SpewKeys {
vs.strings = make([]string, len(values))
for i := range vs.values {
vs.strings[i] = Sprintf("%#v", vs.values[i].Interface())
}
}
return vs
}
// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted
// directly, or whether it should be considered for sorting by surrogate keys
// (if the ConfigState allows it).
func canSortSimply(kind reflect.Kind) bool {
// This switch parallels valueSortLess, except for the default case.
switch kind {
case reflect.Bool:
return true
case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
return true
case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
return true
case reflect.Float32, reflect.Float64:
return true
case reflect.String:
return true
case reflect.Uintptr:
return true
case reflect.Array:
return true
}
return false
}
// Len returns the number of values in the slice. It is part of the
// sort.Interface implementation.
func (s *valuesSorter) Len() int {
return len(s.values)
}
// Swap swaps the values at the passed indices. It is part of the
// sort.Interface implementation.
func (s *valuesSorter) Swap(i, j int) {
s.values[i], s.values[j] = s.values[j], s.values[i]
if s.strings != nil {
s.strings[i], s.strings[j] = s.strings[j], s.strings[i]
}
}
// valueSortLess returns whether the first value should sort before the second
// value. It is used by valueSorter.Less as part of the sort.Interface
// implementation.
func valueSortLess(a, b reflect.Value) bool {
switch a.Kind() {
case reflect.Bool:
return !a.Bool() && b.Bool()
case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
return a.Int() < b.Int()
case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
return a.Uint() < b.Uint()
case reflect.Float32, reflect.Float64:
return a.Float() < b.Float()
case reflect.String:
return a.String() < b.String()
case reflect.Uintptr:
return a.Uint() < b.Uint()
case reflect.Array:
// Compare the contents of both arrays.
l := a.Len()
for i := 0; i < l; i++ {
av := a.Index(i)
bv := b.Index(i)
if av.Interface() == bv.Interface() {
continue
}
return valueSortLess(av, bv)
}
}
return a.String() < b.String()
}
// Less returns whether the value at index i should sort before the
// value at index j. It is part of the sort.Interface implementation.
func (s *valuesSorter) Less(i, j int) bool {
if s.strings == nil {
return valueSortLess(s.values[i], s.values[j])
}
return s.strings[i] < s.strings[j]
}
// sortValues is a sort function that handles both native types and any type that
// can be converted to error or Stringer. Other inputs are sorted according to
// their Value.String() value to ensure display stability.
func sortValues(values []reflect.Value, cs *ConfigState) {
if len(values) == 0 {
return
}
sort.Sort(newValuesSorter(values, cs))
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/config.go
================================================
/*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package spew
import (
"bytes"
"fmt"
"io"
"os"
)
// ConfigState houses the configuration options used by spew to format and
// display values. There is a global instance, Config, that is used to control
// all top-level Formatter and Dump functionality. Each ConfigState instance
// provides methods equivalent to the top-level functions.
//
// The zero value for ConfigState provides no indentation. You would typically
// want to set it to a space or a tab.
//
// Alternatively, you can use NewDefaultConfig to get a ConfigState instance
// with default settings. See the documentation of NewDefaultConfig for default
// values.
type ConfigState struct {
// Indent specifies the string to use for each indentation level. The
// global config instance that all top-level functions use set this to a
// single space by default. If you would like more indentation, you might
// set this to a tab with "\t" or perhaps two spaces with " ".
Indent string
// MaxDepth controls the maximum number of levels to descend into nested
// data structures. The default, 0, means there is no limit.
//
// NOTE: Circular data structures are properly detected, so it is not
// necessary to set this value unless you specifically want to limit deeply
// nested data structures.
MaxDepth int
// DisableMethods specifies whether or not error and Stringer interfaces are
// invoked for types that implement them.
DisableMethods bool
// DisablePointerMethods specifies whether or not to check for and invoke
// error and Stringer interfaces on types which only accept a pointer
// receiver when the current type is not a pointer.
//
// NOTE: This might be an unsafe action since calling one of these methods
// with a pointer receiver could technically mutate the value, however,
// in practice, types which choose to satisify an error or Stringer
// interface with a pointer receiver should not be mutating their state
// inside these interface methods. As a result, this option relies on
// access to the unsafe package, so it will not have any effect when
// running in environments without access to the unsafe package such as
// Google App Engine or with the "safe" build tag specified.
DisablePointerMethods bool
// DisablePointerAddresses specifies whether to disable the printing of
// pointer addresses. This is useful when diffing data structures in tests.
DisablePointerAddresses bool
// DisableCapacities specifies whether to disable the printing of capacities
// for arrays, slices, maps and channels. This is useful when diffing
// data structures in tests.
DisableCapacities bool
// ContinueOnMethod specifies whether or not recursion should continue once
// a custom error or Stringer interface is invoked. The default, false,
// means it will print the results of invoking the custom error or Stringer
// interface and return immediately instead of continuing to recurse into
// the internals of the data type.
//
// NOTE: This flag does not have any effect if method invocation is disabled
// via the DisableMethods or DisablePointerMethods options.
ContinueOnMethod bool
// SortKeys specifies map keys should be sorted before being printed. Use
// this to have a more deterministic, diffable output. Note that only
// native types (bool, int, uint, floats, uintptr and string) and types
// that support the error or Stringer interfaces (if methods are
// enabled) are supported, with other types sorted according to the
// reflect.Value.String() output which guarantees display stability.
SortKeys bool
// SpewKeys specifies that, as a last resort attempt, map keys should
// be spewed to strings and sorted by those strings. This is only
// considered if SortKeys is true.
SpewKeys bool
}
// Config is the active configuration of the top-level functions.
// The configuration can be changed by modifying the contents of spew.Config.
var Config = ConfigState{Indent: " "}
// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the formatted string as a value that satisfies error. See NewFormatter
// for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Errorf(format string, a ...interface{}) (err error) {
return fmt.Errorf(format, c.convertArgs(a)...)
}
// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) {
return fmt.Fprint(w, c.convertArgs(a)...)
}
// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {
return fmt.Fprintf(w, format, c.convertArgs(a)...)
}
// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it
// passed with a Formatter interface returned by c.NewFormatter. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
return fmt.Fprintln(w, c.convertArgs(a)...)
}
// Print is a wrapper for fmt.Print that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Print(c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Print(a ...interface{}) (n int, err error) {
return fmt.Print(c.convertArgs(a)...)
}
// Printf is a wrapper for fmt.Printf that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) {
return fmt.Printf(format, c.convertArgs(a)...)
}
// Println is a wrapper for fmt.Println that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Println(c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Println(a ...interface{}) (n int, err error) {
return fmt.Println(c.convertArgs(a)...)
}
// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the resulting string. See NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Sprint(c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Sprint(a ...interface{}) string {
return fmt.Sprint(c.convertArgs(a)...)
}
// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the resulting string. See NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Sprintf(format string, a ...interface{}) string {
return fmt.Sprintf(format, c.convertArgs(a)...)
}
// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it
// were passed with a Formatter interface returned by c.NewFormatter. It
// returns the resulting string. See NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Sprintln(a ...interface{}) string {
return fmt.Sprintln(c.convertArgs(a)...)
}
/*
NewFormatter returns a custom formatter that satisfies the fmt.Formatter
interface. As a result, it integrates cleanly with standard fmt package
printing functions. The formatter is useful for inline printing of smaller data
types similar to the standard %v format specifier.
The custom formatter only responds to the %v (most compact), %+v (adds pointer
addresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb
combinations. Any other verbs such as %x and %q will be sent to the the
standard fmt package for formatting. In addition, the custom formatter ignores
the width and precision arguments (however they will still work on the format
specifiers not handled by the custom formatter).
Typically this function shouldn't be called directly. It is much easier to make
use of the custom formatter by calling one of the convenience functions such as
c.Printf, c.Println, or c.Printf.
*/
func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter {
return newFormatter(c, v)
}
// Fdump formats and displays the passed arguments to io.Writer w. It formats
// exactly the same as Dump.
func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) {
fdump(c, w, a...)
}
/*
Dump displays the passed parameters to standard out with newlines, customizable
indentation, and additional debug information such as complete types and all
pointer addresses used to indirect to the final value. It provides the
following features over the built-in printing facilities provided by the fmt
package:
* Pointers are dereferenced and followed
* Circular data structures are detected and handled properly
* Custom Stringer/error interfaces are optionally invoked, including
on unexported types
* Custom types which only implement the Stringer/error interfaces via
a pointer receiver are optionally invoked when passing non-pointer
variables
* Byte arrays and slices are dumped like the hexdump -C command which
includes offsets, byte values in hex, and ASCII output
The configuration options are controlled by modifying the public members
of c. See ConfigState for options documentation.
See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to
get the formatted result as a string.
*/
func (c *ConfigState) Dump(a ...interface{}) {
fdump(c, os.Stdout, a...)
}
// Sdump returns a string with the passed arguments formatted exactly the same
// as Dump.
func (c *ConfigState) Sdump(a ...interface{}) string {
var buf bytes.Buffer
fdump(c, &buf, a...)
return buf.String()
}
// convertArgs accepts a slice of arguments and returns a slice of the same
// length with each argument converted to a spew Formatter interface using
// the ConfigState associated with s.
func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) {
formatters = make([]interface{}, len(args))
for index, arg := range args {
formatters[index] = newFormatter(c, arg)
}
return formatters
}
// NewDefaultConfig returns a ConfigState with the following default settings.
//
// Indent: " "
// MaxDepth: 0
// DisableMethods: false
// DisablePointerMethods: false
// ContinueOnMethod: false
// SortKeys: false
func NewDefaultConfig() *ConfigState {
return &ConfigState{Indent: " "}
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/doc.go
================================================
/*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
Package spew implements a deep pretty printer for Go data structures to aid in
debugging.
A quick overview of the additional features spew provides over the built-in
printing facilities for Go data types are as follows:
* Pointers are dereferenced and followed
* Circular data structures are detected and handled properly
* Custom Stringer/error interfaces are optionally invoked, including
on unexported types
* Custom types which only implement the Stringer/error interfaces via
a pointer receiver are optionally invoked when passing non-pointer
variables
* Byte arrays and slices are dumped like the hexdump -C command which
includes offsets, byte values in hex, and ASCII output (only when using
Dump style)
There are two different approaches spew allows for dumping Go data structures:
* Dump style which prints with newlines, customizable indentation,
and additional debug information such as types and all pointer addresses
used to indirect to the final value
* A custom Formatter interface that integrates cleanly with the standard fmt
package and replaces %v, %+v, %#v, and %#+v to provide inline printing
similar to the default %v while providing the additional functionality
outlined above and passing unsupported format verbs such as %x and %q
along to fmt
Quick Start
This section demonstrates how to quickly get started with spew. See the
sections below for further details on formatting and configuration options.
To dump a variable with full newlines, indentation, type, and pointer
information use Dump, Fdump, or Sdump:
spew.Dump(myVar1, myVar2, ...)
spew.Fdump(someWriter, myVar1, myVar2, ...)
str := spew.Sdump(myVar1, myVar2, ...)
Alternatively, if you would prefer to use format strings with a compacted inline
printing style, use the convenience wrappers Printf, Fprintf, etc with
%v (most compact), %+v (adds pointer addresses), %#v (adds types), or
%#+v (adds types and pointer addresses):
spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2)
spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2)
spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
Configuration Options
Configuration of spew is handled by fields in the ConfigState type. For
convenience, all of the top-level functions use a global state available
via the spew.Config global.
It is also possible to create a ConfigState instance that provides methods
equivalent to the top-level functions. This allows concurrent configuration
options. See the ConfigState documentation for more details.
The following configuration options are available:
* Indent
String to use for each indentation level for Dump functions.
It is a single space by default. A popular alternative is "\t".
* MaxDepth
Maximum number of levels to descend into nested data structures.
There is no limit by default.
* DisableMethods
Disables invocation of error and Stringer interface methods.
Method invocation is enabled by default.
* DisablePointerMethods
Disables invocation of error and Stringer interface methods on types
which only accept pointer receivers from non-pointer variables.
Pointer method invocation is enabled by default.
* DisablePointerAddresses
DisablePointerAddresses specifies whether to disable the printing of
pointer addresses. This is useful when diffing data structures in tests.
* DisableCapacities
DisableCapacities specifies whether to disable the printing of
capacities for arrays, slices, maps and channels. This is useful when
diffing data structures in tests.
* ContinueOnMethod
Enables recursion into types after invoking error and Stringer interface
methods. Recursion after method invocation is disabled by default.
* SortKeys
Specifies map keys should be sorted before being printed. Use
this to have a more deterministic, diffable output. Note that
only native types (bool, int, uint, floats, uintptr and string)
and types which implement error or Stringer interfaces are
supported with other types sorted according to the
reflect.Value.String() output which guarantees display
stability. Natural map order is used by default.
* SpewKeys
Specifies that, as a last resort attempt, map keys should be
spewed to strings and sorted by those strings. This is only
considered if SortKeys is true.
Dump Usage
Simply call spew.Dump with a list of variables you want to dump:
spew.Dump(myVar1, myVar2, ...)
You may also call spew.Fdump if you would prefer to output to an arbitrary
io.Writer. For example, to dump to standard error:
spew.Fdump(os.Stderr, myVar1, myVar2, ...)
A third option is to call spew.Sdump to get the formatted output as a string:
str := spew.Sdump(myVar1, myVar2, ...)
Sample Dump Output
See the Dump example for details on the setup of the types and variables being
shown here.
(main.Foo) {
unexportedField: (*main.Bar)(0xf84002e210)({
flag: (main.Flag) flagTwo,
data: (uintptr) <nil>
}),
ExportedField: (map[interface {}]interface {}) (len=1) {
(string) (len=3) "one": (bool) true
}
}
Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C
command as shown.
([]uint8) (len=32 cap=32) {
00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... |
00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0|
00000020 31 32 |12|
}
Custom Formatter
Spew provides a custom formatter that implements the fmt.Formatter interface
so that it integrates cleanly with standard fmt package printing functions. The
formatter is useful for inline printing of smaller data types similar to the
standard %v format specifier.
The custom formatter only responds to the %v (most compact), %+v (adds pointer
addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb
combinations. Any other verbs such as %x and %q will be sent to the the
standard fmt package for formatting. In addition, the custom formatter ignores
the width and precision arguments (however they will still work on the format
specifiers not handled by the custom formatter).
Custom Formatter Usage
The simplest way to make use of the spew custom formatter is to call one of the
convenience functions such as spew.Printf, spew.Println, or spew.Printf. The
functions have syntax you are most likely already familiar with:
spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2)
spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
spew.Println(myVar, myVar2)
spew.Fprintf(os.Stderr, "myVar1: %v -- myVar2: %+v", myVar1, myVar2)
spew.Fprintf(os.Stderr, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
See the Index for the full list convenience functions.
Sample Formatter Output
Double pointer to a uint8:
%v: <**>5
%+v: <**>(0xf8400420d0->0xf8400420c8)5
%#v: (**uint8)5
%#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5
Pointer to circular struct with a uint8 field and a pointer to itself:
%v: <*>{1 <*><shown>}
%+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)<shown>}
%#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)<shown>}
%#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)<shown>}
See the Printf example for details on the setup of variables being shown
here.
Errors
Since it is possible for custom Stringer/error interfaces to panic, spew
detects them and handles them internally by printing the panic information
inline with the output. Since spew is intended to provide deep pretty printing
capabilities on structures, it intentionally does not return any errors.
*/
package spew
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/dump.go
================================================
/*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package spew
import (
"bytes"
"encoding/hex"
"fmt"
"io"
"os"
"reflect"
"regexp"
"strconv"
"strings"
)
var (
// uint8Type is a reflect.Type representing a uint8. It is used to
// convert cgo types to uint8 slices for hexdumping.
uint8Type = reflect.TypeOf(uint8(0))
// cCharRE is a regular expression that matches a cgo char.
// It is used to detect character arrays to hexdump them.
cCharRE = regexp.MustCompile(`^.*\._Ctype_char$`)
// cUnsignedCharRE is a regular expression that matches a cgo unsigned
// char. It is used to detect unsigned character arrays to hexdump
// them.
cUnsignedCharRE = regexp.MustCompile(`^.*\._Ctype_unsignedchar$`)
// cUint8tCharRE is a regular expression that matches a cgo uint8_t.
// It is used to detect uint8_t arrays to hexdump them.
cUint8tCharRE = regexp.MustCompile(`^.*\._Ctype_uint8_t$`)
)
// dumpState contains information about the state of a dump operation.
type dumpState struct {
w io.Writer
depth int
pointers map[uintptr]int
ignoreNextType bool
ignoreNextIndent bool
cs *ConfigState
}
// indent performs indentation according to the depth level and cs.Indent
// option.
func (d *dumpState) indent() {
if d.ignoreNextIndent {
d.ignoreNextIndent = false
return
}
d.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth))
}
// unpackValue returns values inside of non-nil interfaces when possible.
// This is useful for data types like structs, arrays, slices, and maps which
// can contain varying types packed inside an interface.
func (d *dumpState) unpackValue(v reflect.Value) reflect.Value {
if v.Kind() == reflect.Interface && !v.IsNil() {
v = v.Elem()
}
return v
}
// dumpPtr handles formatting of pointers by indirecting them as necessary.
func (d *dumpState) dumpPtr(v reflect.Value) {
// Remove pointers at or below the current depth from map used to detect
// circular refs.
for k, depth := range d.pointers {
if depth >= d.depth {
delete(d.pointers, k)
}
}
// Keep list of all dereferenced pointers to show later.
pointerChain := make([]uintptr, 0)
// Figure out how many levels of indirection there are by dereferencing
// pointers and unpacking interfaces down the chain while detecting circular
// references.
nilFound := false
cycleFound := false
indirects := 0
ve := v
for ve.Kind() == reflect.Ptr {
if ve.IsNil() {
nilFound = true
break
}
indirects++
addr := ve.Pointer()
pointerChain = append(pointerChain, addr)
if pd, ok := d.pointers[addr]; ok && pd < d.depth {
cycleFound = true
indirects--
break
}
d.pointers[addr] = d.depth
ve = ve.Elem()
if ve.Kind() == reflect.Interface {
if ve.IsNil() {
nilFound = true
break
}
ve = ve.Elem()
}
}
// Display type information.
d.w.Write(openParenBytes)
d.w.Write(bytes.Repeat(asteriskBytes, indirects))
d.w.Write([]byte(ve.Type().String()))
d.w.Write(closeParenBytes)
// Display pointer information.
if !d.cs.DisablePointerAddresses && len(pointerChain) > 0 {
d.w.Write(openParenBytes)
for i, addr := range pointerChain {
if i > 0 {
d.w.Write(pointerChainBytes)
}
printHexPtr(d.w, addr)
}
d.w.Write(closeParenBytes)
}
// Display dereferenced value.
d.w.Write(openParenBytes)
switch {
case nilFound:
d.w.Write(nilAngleBytes)
case cycleFound:
d.w.Write(circularBytes)
default:
d.ignoreNextType = true
d.dump(ve)
}
d.w.Write(closeParenBytes)
}
// dumpSlice handles formatting of arrays and slices. Byte (uint8 under
// reflection) arrays and slices are dumped in hexdump -C fashion.
func (d *dumpState) dumpSlice(v reflect.Value) {
// Determine whether this type should be hex dumped or not. Also,
// for types which should be hexdumped, try to use the underlying data
// first, then fall back to trying to convert them to a uint8 slice.
var buf []uint8
doConvert := false
doHexDump := false
numEntries := v.Len()
if numEntries > 0 {
vt := v.Index(0).Type()
vts := vt.String()
switch {
// C types that need to be converted.
case cCharRE.MatchString(vts):
fallthrough
case cUnsignedCharRE.MatchString(vts):
fallthrough
case cUint8tCharRE.MatchString(vts):
doConvert = true
// Try to use existing uint8 slices and fall back to converting
// and copying if that fails.
case vt.Kind() == reflect.Uint8:
// We need an addressable interface to convert the type
// to a byte slice. However, the reflect package won't
// give us an interface on certain things like
// unexported struct fields in order to enforce
// visibility rules. We use unsafe, when available, to
// bypass these restrictions since this package does not
// mutate the values.
vs := v
if !vs.CanInterface() || !vs.CanAddr() {
vs = unsafeReflectValue(vs)
}
if !UnsafeDisabled {
vs = vs.Slice(0, numEntries)
// Use the existing uint8 slice if it can be
// type asserted.
iface := vs.Interface()
if slice, ok := iface.([]uint8); ok {
buf = slice
doHexDump = true
break
}
}
// The underlying data needs to be converted if it can't
// be type asserted to a uint8 slice.
doConvert = true
}
// Copy and convert the underlying type if needed.
if doConvert && vt.ConvertibleTo(uint8Type) {
// Convert and copy each element into a uint8 byte
// slice.
buf = make([]uint8, numEntries)
for i := 0; i < numEntries; i++ {
vv := v.Index(i)
buf[i] = uint8(vv.Convert(uint8Type).Uint())
}
doHexDump = true
}
}
// Hexdump the entire slice as needed.
if doHexDump {
indent := strings.Repeat(d.cs.Indent, d.depth)
str := indent + hex.Dump(buf)
str = strings.Replace(str, "\n", "\n"+indent, -1)
str = strings.TrimRight(str, d.cs.Indent)
d.w.Write([]byte(str))
return
}
// Recursively call dump for each item.
for i := 0; i < numEntries; i++ {
d.dump(d.unpackValue(v.Index(i)))
if i < (numEntries - 1) {
d.w.Write(commaNewlineBytes)
} else {
d.w.Write(newlineBytes)
}
}
}
// dump is the main workhorse for dumping a value. It uses the passed reflect
// value to figure out what kind of object we are dealing with and formats it
// appropriately. It is a recursive function, however circular data structures
// are detected and handled properly.
func (d *dumpState) dump(v reflect.Value) {
// Handle invalid reflect values immediately.
kind := v.Kind()
if kind == reflect.Invalid {
d.w.Write(invalidAngleBytes)
return
}
// Handle pointers specially.
if kind == reflect.Ptr {
d.indent()
d.dumpPtr(v)
return
}
// Print type information unless already handled elsewhere.
if !d.ignoreNextType {
d.indent()
d.w.Write(openParenBytes)
d.w.Write([]byte(v.Type().String()))
d.w.Write(closeParenBytes)
d.w.Write(spaceBytes)
}
d.ignoreNextType = false
// Display length and capacity if the built-in len and cap functions
// work with the value's kind and the len/cap itself is non-zero.
valueLen, valueCap := 0, 0
switch v.Kind() {
case reflect.Array, reflect.Slice, reflect.Chan:
valueLen, valueCap = v.Len(), v.Cap()
case reflect.Map, reflect.String:
valueLen = v.Len()
}
if valueLen != 0 || !d.cs.DisableCapacities && valueCap != 0 {
d.w.Write(openParenBytes)
if valueLen != 0 {
d.w.Write(lenEqualsBytes)
printInt(d.w, int64(valueLen), 10)
}
if !d.cs.DisableCapacities && valueCap != 0 {
if valueLen != 0 {
d.w.Write(spaceBytes)
}
d.w.Write(capEqualsBytes)
printInt(d.w, int64(valueCap), 10)
}
d.w.Write(closeParenBytes)
d.w.Write(spaceBytes)
}
// Call Stringer/error interfaces if they exist and the handle methods flag
// is enabled
if !d.cs.DisableMethods {
if (kind != reflect.Invalid) && (kind != reflect.Interface) {
if handled := handleMethods(d.cs, d.w, v); handled {
return
}
}
}
switch kind {
case reflect.Invalid:
// Do nothing. We should never get here since invalid has already
// been handled above.
case reflect.Bool:
printBool(d.w, v.Bool())
case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
printInt(d.w, v.Int(), 10)
case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
printUint(d.w, v.Uint(), 10)
case reflect.Float32:
printFloat(d.w, v.Float(), 32)
case reflect.Float64:
printFloat(d.w, v.Float(), 64)
case reflect.Complex64:
printComplex(d.w, v.Complex(), 32)
case reflect.Complex128:
printComplex(d.w, v.Complex(), 64)
case reflect.Slice:
if v.IsNil() {
d.w.Write(nilAngleBytes)
break
}
fallthrough
case reflect.Array:
d.w.Write(openBraceNewlineBytes)
d.depth++
if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {
d.indent()
d.w.Write(maxNewlineBytes)
} else {
d.dumpSlice(v)
}
d.depth--
d.indent()
d.w.Write(closeBraceBytes)
case reflect.String:
d.w.Write([]byte(strconv.Quote(v.String())))
case reflect.Interface:
// The only time we should get here is for nil interfaces due to
// unpackValue calls.
if v.IsNil() {
d.w.Write(nilAngleBytes)
}
case reflect.Ptr:
// Do nothing. We should never get here since pointers have already
// been handled above.
case reflect.Map:
// nil maps should be indicated as different than empty maps
if v.IsNil() {
d.w.Write(nilAngleBytes)
break
}
d.w.Write(openBraceNewlineBytes)
d.depth++
if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {
d.indent()
d.w.Write(maxNewlineBytes)
} else {
numEntries := v.Len()
keys := v.MapKeys()
if d.cs.SortKeys {
sortValues(keys, d.cs)
}
for i, key := range keys {
d.dump(d.unpackValue(key))
d.w.Write(colonSpaceBytes)
d.ignoreNextIndent = true
d.dump(d.unpackValue(v.MapIndex(key)))
if i < (numEntries - 1) {
d.w.Write(commaNewlineBytes)
} else {
d.w.Write(newlineBytes)
}
}
}
d.depth--
d.indent()
d.w.Write(closeBraceBytes)
case reflect.Struct:
d.w.Write(openBraceNewlineBytes)
d.depth++
if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {
d.indent()
d.w.Write(maxNewlineBytes)
} else {
vt := v.Type()
numFields := v.NumField()
for i := 0; i < numFields; i++ {
d.indent()
vtf := vt.Field(i)
d.w.Write([]byte(vtf.Name))
d.w.Write(colonSpaceBytes)
d.ignoreNextIndent = true
d.dump(d.unpackValue(v.Field(i)))
if i < (numFields - 1) {
d.w.Write(commaNewlineBytes)
} else {
d.w.Write(newlineBytes)
}
}
}
d.depth--
d.indent()
d.w.Write(closeBraceBytes)
case reflect.Uintptr:
printHexPtr(d.w, uintptr(v.Uint()))
case reflect.UnsafePointer, reflect.Chan, reflect.Func:
printHexPtr(d.w, v.Pointer())
// There were not any other types at the time this code was written, but
// fall back to letting the default fmt package handle it in case any new
// types are added.
default:
if v.CanInterface() {
fmt.Fprintf(d.w, "%v", v.Interface())
} else {
fmt.Fprintf(d.w, "%v", v.String())
}
}
}
// fdump is a helper function to consolidate the logic from the various public
// methods which take varying writers and config states.
func fdump(cs *ConfigState, w io.Writer, a ...interface{}) {
for _, arg := range a {
if arg == nil {
w.Write(interfaceBytes)
w.Write(spaceBytes)
w.Write(nilAngleBytes)
w.Write(newlineBytes)
continue
}
d := dumpState{w: w, cs: cs}
d.pointers = make(map[uintptr]int)
d.dump(reflect.ValueOf(arg))
d.w.Write(newlineBytes)
}
}
// Fdump formats and displays the passed arguments to io.Writer w. It formats
// exactly the same as Dump.
func Fdump(w io.Writer, a ...interface{}) {
fdump(&Config, w, a...)
}
// Sdump returns a string with the passed arguments formatted exactly the same
// as Dump.
func Sdump(a ...interface{}) string {
var buf bytes.Buffer
fdump(&Config, &buf, a...)
return buf.String()
}
/*
Dump displays the passed parameters to standard out with newlines, customizable
indentation, and additional debug information such as complete types and all
pointer addresses used to indirect to the final value. It provides the
following features over the built-in printing facilities provided by the fmt
package:
* Pointers are dereferenced and followed
* Circular data structures are detected and handled properly
* Custom Stringer/error interfaces are optionally invoked, including
on unexported types
* Custom types which only implement the Stringer/error interfaces via
a pointer receiver are optionally invoked when passing non-pointer
variables
* Byte arrays and slices are dumped like the hexdump -C command which
includes offsets, byte values in hex, and ASCII output
The configuration options are controlled by an exported package global,
spew.Config. See ConfigState for options documentation.
See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to
get the formatted result as a string.
*/
func Dump(a ...interface{}) {
fdump(&Config, os.Stdout, a...)
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/format.go
================================================
/*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package spew
import (
"bytes"
"fmt"
"reflect"
"strconv"
"strings"
)
// supportedFlags is a list of all the character flags supported by fmt package.
const supportedFlags = "0-+# "
// formatState implements the fmt.Formatter interface and contains information
// about the state of a formatting operation. The NewFormatter function can
// be used to get a new Formatter which can be used directly as arguments
// in standard fmt package printing calls.
type formatState struct {
value interface{}
fs fmt.State
depth int
pointers map[uintptr]int
ignoreNextType bool
cs *ConfigState
}
// buildDefaultFormat recreates the original format string without precision
// and width information to pass in to fmt.Sprintf in the case of an
// unrecognized type. Unless new types are added to the language, this
// function won't ever be called.
func (f *formatState) buildDefaultFormat() (format string) {
buf := bytes.NewBuffer(percentBytes)
for _, flag := range supportedFlags {
if f.fs.Flag(int(flag)) {
buf.WriteRune(flag)
}
}
buf.WriteRune('v')
format = buf.String()
return format
}
// constructOrigFormat recreates the original format string including precision
// and width information to pass along to the standard fmt package. This allows
// automatic deferral of all format strings this package doesn't support.
func (f *formatState) constructOrigFormat(verb rune) (format string) {
buf := bytes.NewBuffer(percentBytes)
for _, flag := range supportedFlags {
if f.fs.Flag(int(flag)) {
buf.WriteRune(flag)
}
}
if width, ok := f.fs.Width(); ok {
buf.WriteString(strconv.Itoa(width))
}
if precision, ok := f.fs.Precision(); ok {
buf.Write(precisionBytes)
buf.WriteString(strconv.Itoa(precision))
}
buf.WriteRune(verb)
format = buf.String()
return format
}
// unpackValue returns values inside of non-nil interfaces when possible and
// ensures that types for values which have been unpacked from an interface
// are displayed when the show types flag is also set.
// This is useful for data types like structs, arrays, slices, and maps which
// can contain varying types packed inside an interface.
func (f *formatState) unpackValue(v reflect.Value) reflect.Value {
if v.Kind() == reflect.Interface {
f.ignoreNextType = false
if !v.IsNil() {
v = v.Elem()
}
}
return v
}
// formatPtr handles formatting of pointers by indirecting them as necessary.
func (f *formatState) formatPtr(v reflect.Value) {
// Display nil if top level pointer is nil.
showTypes := f.fs.Flag('#')
if v.IsNil() && (!showTypes || f.ignoreNextType) {
f.fs.Write(nilAngleBytes)
return
}
// Remove pointers at or below the current depth from map used to detect
// circular refs.
for k, depth := range f.pointers {
if depth >= f.depth {
delete(f.pointers, k)
}
}
// Keep list of all dereferenced pointers to possibly show later.
pointerChain := make([]uintptr, 0)
// Figure out how many levels of indirection there are by derferencing
// pointers and unpacking interfaces down the chain while detecting circular
// references.
nilFound := false
cycleFound := false
indirects := 0
ve := v
for ve.Kind() == reflect.Ptr {
if ve.IsNil() {
nilFound = true
break
}
indirects++
addr := ve.Pointer()
pointerChain = append(pointerChain, addr)
if pd, ok := f.pointers[addr]; ok && pd < f.depth {
cycleFound = true
indirects--
break
}
f.pointers[addr] = f.depth
ve = ve.Elem()
if ve.Kind() == reflect.Interface {
if ve.IsNil() {
nilFound = true
break
}
ve = ve.Elem()
}
}
// Display type or indirection level depending on flags.
if showTypes && !f.ignoreNextType {
f.fs.Write(openParenBytes)
f.fs.Write(bytes.Repeat(asteriskBytes, indirects))
f.fs.Write([]byte(ve.Type().String()))
f.fs.Write(closeParenBytes)
} else {
if nilFound || cycleFound {
indirects += strings.Count(ve.Type().String(), "*")
}
f.fs.Write(openAngleBytes)
f.fs.Write([]byte(strings.Repeat("*", indirects)))
f.fs.Write(closeAngleBytes)
}
// Display pointer information depending on flags.
if f.fs.Flag('+') && (len(pointerChain) > 0) {
f.fs.Write(openParenBytes)
for i, addr := range pointerChain {
if i > 0 {
f.fs.Write(pointerChainBytes)
}
printHexPtr(f.fs, addr)
}
f.fs.Write(closeParenBytes)
}
// Display dereferenced value.
switch {
case nilFound:
f.fs.Write(nilAngleBytes)
case cycleFound:
f.fs.Write(circularShortBytes)
default:
f.ignoreNextType = true
f.format(ve)
}
}
// format is the main workhorse for providing the Formatter interface. It
// uses the passed reflect value to figure out what kind of object we are
// dealing with and formats it appropriately. It is a recursive function,
// however circular data structures are detected and handled properly.
func (f *formatState) format(v reflect.Value) {
// Handle invalid reflect values immediately.
kind := v.Kind()
if kind == reflect.Invalid {
f.fs.Write(invalidAngleBytes)
return
}
// Handle pointers specially.
if kind == reflect.Ptr {
f.formatPtr(v)
return
}
// Print type information unless already handled elsewhere.
if !f.ignoreNextType && f.fs.Flag('#') {
f.fs.Write(openParenBytes)
f.fs.Write([]byte(v.Type().String()))
f.fs.Write(closeParenBytes)
}
f.ignoreNextType = false
// Call Stringer/error interfaces if they exist and the handle methods
// flag is enabled.
if !f.cs.DisableMethods {
if (kind != reflect.Invalid) && (kind != reflect.Interface) {
if handled := handleMethods(f.cs, f.fs, v); handled {
return
}
}
}
switch kind {
case reflect.Invalid:
// Do nothing. We should never get here since invalid has already
// been handled above.
case reflect.Bool:
printBool(f.fs, v.Bool())
case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
printInt(f.fs, v.Int(), 10)
case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
printUint(f.fs, v.Uint(), 10)
case reflect.Float32:
printFloat(f.fs, v.Float(), 32)
case reflect.Float64:
printFloat(f.fs, v.Float(), 64)
case reflect.Complex64:
printComplex(f.fs, v.Complex(), 32)
case reflect.Complex128:
printComplex(f.fs, v.Complex(), 64)
case reflect.Slice:
if v.IsNil() {
f.fs.Write(nilAngleBytes)
break
}
fallthrough
case reflect.Array:
f.fs.Write(openBracketBytes)
f.depth++
if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {
f.fs.Write(maxShortBytes)
} else {
numEntries := v.Len()
for i := 0; i < numEntries; i++ {
if i > 0 {
f.fs.Write(spaceBytes)
}
f.ignoreNextType = true
f.format(f.unpackValue(v.Index(i)))
}
}
f.depth--
f.fs.Write(closeBracketBytes)
case reflect.String:
f.fs.Write([]byte(v.String()))
case reflect.Interface:
// The only time we should get here is for nil interfaces due to
// unpackValue calls.
if v.IsNil() {
f.fs.Write(nilAngleBytes)
}
case reflect.Ptr:
// Do nothing. We should never get here since pointers have already
// been handled above.
case reflect.Map:
// nil maps should be indicated as different than empty maps
if v.IsNil() {
f.fs.Write(nilAngleBytes)
break
}
f.fs.Write(openMapBytes)
f.depth++
if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {
f.fs.Write(maxShortBytes)
} else {
keys := v.MapKeys()
if f.cs.SortKeys {
sortValues(keys, f.cs)
}
for i, key := range keys {
if i > 0 {
f.fs.Write(spaceBytes)
}
f.ignoreNextType = true
f.format(f.unpackValue(key))
f.fs.Write(colonBytes)
f.ignoreNextType = true
f.format(f.unpackValue(v.MapIndex(key)))
}
}
f.depth--
f.fs.Write(closeMapBytes)
case reflect.Struct:
numFields := v.NumField()
f.fs.Write(openBraceBytes)
f.depth++
if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {
f.fs.Write(maxShortBytes)
} else {
vt := v.Type()
for i := 0; i < numFields; i++ {
if i > 0 {
f.fs.Write(spaceBytes)
}
vtf := vt.Field(i)
if f.fs.Flag('+') || f.fs.Flag('#') {
f.fs.Write([]byte(vtf.Name))
f.fs.Write(colonBytes)
}
f.format(f.unpackValue(v.Field(i)))
}
}
f.depth--
f.fs.Write(closeBraceBytes)
case reflect.Uintptr:
printHexPtr(f.fs, uintptr(v.Uint()))
case reflect.UnsafePointer, reflect.Chan, reflect.Func:
printHexPtr(f.fs, v.Pointer())
// There were not any other types at the time this code was written, but
// fall back to letting the default fmt package handle it if any get added.
default:
format := f.buildDefaultFormat()
if v.CanInterface() {
fmt.Fprintf(f.fs, format, v.Interface())
} else {
fmt.Fprintf(f.fs, format, v.String())
}
}
}
// Format satisfies the fmt.Formatter interface. See NewFormatter for usage
// details.
func (f *formatState) Format(fs fmt.State, verb rune) {
f.fs = fs
// Use standard formatting for verbs that are not v.
if verb != 'v' {
format := f.constructOrigFormat(verb)
fmt.Fprintf(fs, format, f.value)
return
}
if f.value == nil {
if fs.Flag('#') {
fs.Write(interfaceBytes)
}
fs.Write(nilAngleBytes)
return
}
f.format(reflect.ValueOf(f.value))
}
// newFormatter is a helper function to consolidate the logic from the various
// public methods which take varying config states.
func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter {
fs := &formatState{value: v, cs: cs}
fs.pointers = make(map[uintptr]int)
return fs
}
/*
NewFormatter returns a custom formatter that satisfies the fmt.Formatter
interface. As a result, it integrates cleanly with standard fmt package
printing functions. The formatter is useful for inline printing of smaller data
types similar to the standard %v format specifier.
The custom formatter only responds to the %v (most compact), %+v (adds pointer
addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb
combinations. Any other verbs such as %x and %q will be sent to the the
standard fmt package for formatting. In addition, the custom formatter ignores
the width and precision arguments (however they will still work on the format
specifiers not handled by the custom formatter).
Typically this function shouldn't be called directly. It is much easier to make
use of the custom formatter by calling one of the convenience functions such as
Printf, Println, or Fprintf.
*/
func NewFormatter(v interface{}) fmt.Formatter {
return newFormatter(&Config, v)
}
================================================
FILE: vendor/github.com/davecgh/go-spew/spew/spew.go
================================================
/*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package spew
import (
"fmt"
"io"
)
// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were
// passed with a default Formatter interface returned by NewFormatter. It
// returns the formatted string as a value that satisfies error. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b))
func Errorf(format string, a ...interface{}) (err error) {
return fmt.Errorf(format, convertArgs(a)...)
}
// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were
// passed with a default Formatter interface returned by NewFormatter. It
// returns the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b))
func Fprint(w io.Writer, a ...interface{}) (n int, err error) {
return fmt.Fprint(w, convertArgs(a)...)
}
// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were
// passed with a default Formatter interface returned by NewFormatter. It
// returns the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b))
func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {
return fmt.Fprintf(w, format, convertArgs(a)...)
}
// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it
// passed with a default Formatter interface returned by NewFormatter. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b))
func Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
return fmt.Fprintln(w, convertArgs(a)...)
}
// Print is a wrapper for fmt.Print that treats each argument as if it were
// passed with a default Formatter interface returned by NewFormatter. It
// returns the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Print(spew.NewFormatter(a), spew.NewFormatter(b))
func Print(a ...interface{}) (n int, err error) {
return fmt.Print(convertArgs(a)...)
}
// Printf is a wrapper for fmt.Printf that treats each argument as if it were
// passed with a default Formatter interface returned by NewFormatter. It
// returns the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b))
func Printf(format string, a ...interface{}) (n int, err error) {
return fmt.Printf(format, convertArgs(a)...)
}
// Println is a wrapper for fmt.Println that treats each argument as if it were
// passed with a default Formatter interface returned by NewFormatter. It
// returns the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Println(spew.NewFormatter(a), spew.NewFormatter(b))
func Println(a ...interface{}) (n int, err error) {
return fmt.Println(convertArgs(a)...)
}
// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were
// passed with a default Formatter interface returned by NewFormatter. It
// returns the resulting string. See NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b))
func Sprint(a ...interface{}) string {
return fmt.Sprint(convertArgs(a)...)
}
// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were
// passed with a default Formatter interface returned by NewFormatter. It
// returns the resulting string. See NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b))
func Sprintf(format string, a ...interface{}) string {
return fmt.Sprintf(format, convertArgs(a)...)
}
// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it
// were passed with a default Formatter interface returned by NewFormatter. It
// returns the resulting string. See NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b))
func Sprintln(a ...interface{}) string {
return fmt.Sprintln(convertArgs(a)...)
}
// convertArgs accepts a slice of arguments and returns a slice of the same
// length with each argument converted to a default spew Formatter interface.
func convertArgs(args []interface{}) (formatters []interface{}) {
formatters = make([]interface{}, len(args))
for index, arg := range args {
formatters[index] = NewFormatter(arg)
}
return formatters
}
================================================
FILE: vendor/github.com/go-chi/chi/.gitignore
================================================
.idea
*.sw?
.vscode
================================================
FILE: vendor/github.com/go-chi/chi/.travis.yml
================================================
language: go
go:
- 1.10.x
- 1.11.x
- 1.12.x
- 1.13.x
- 1.14.x
script:
- go get -d -t ./...
- go vet ./...
- go test ./...
- >
go_version=$(go version);
if [ ${go_version:13:4} = "1.12" ]; then
go get -u golang.org/x/tools/cmd/goimports;
goimports -d -e ./ | grep '.*' && { echo; echo "Aborting due to non-empty goimports output."; exit 1; } || :;
fi
================================================
FILE: vendor/github.com/go-chi/chi/CHANGELOG.md
================================================
# Changelog
## v4.1.2 (2020-06-02)
- fix that handles MethodNotAllowed with path variables, thank you @caseyhadden for your contribution
- fix to replace nested wildcards correctly in RoutePattern, thank you @@unmultimedio for your contribution
- History of changes: see https://github.com/go-chi/chi/compare/v4.1.1...v4.1.2
## v4.1.1 (2020-04-16)
- fix for issue https://github.com/go-chi/chi/issues/411 which allows for overlapping regexp
route to the correct handler through a recursive tree search, thanks to @Jahaja for the PR/fix!
- new middleware.RouteHeaders as a simple router for request headers with wildcard support
- History of changes: see https://github.com/go-chi/chi/compare/v4.1.0...v4.1.1
## v4.1.0 (2020-04-1)
- middleware.LogEntry: Write method on interface now passes the response header
and an extra interface type useful for custom logger implementations.
- middleware.WrapResponseWriter: minor fix
- middleware.Recoverer: a bit prettier
- History of changes: see https://github.com/go-chi/chi/compare/v4.0.4...v4.1.0
## v4.0.4 (2020-03-24)
- middleware.Recoverer: new pretty stack trace printing (https://github.com/go-chi/chi/pull/496)
- a few minor improvements and fixes
- History of changes: see https://github.com/go-chi/chi/compare/v4.0.3...v4.0.4
## v4.0.3 (2020-01-09)
- core: fix regexp routing to include default value when param is not matched
- middleware: rewrite of middleware.Compress
- middleware: suppress http.ErrAbortHandler in middleware.Recoverer
- History of changes: see https://github.com/go-chi/chi/compare/v4.0.2...v4.0.3
## v4.0.2 (2019-02-26)
- Minor fixes
- History of changes: see https://github.com/go-chi/chi/compare/v4.0.1...v4.0.2
## v4.0.1 (2019-01-21)
- Fixes issue with compress middleware: #382 #385
- History of changes: see https://github.com/go-chi/chi/compare/v4.0.0...v4.0.1
## v4.0.0 (2019-01-10)
- chi v4 requires Go 1.10.3+ (or Go 1.9.7+) - we have deprecated support for Go 1.7 and 1.8
- router: respond with 404 on router with no routes (#362)
- router: additional check to ensure wildcard is at the end of a url pattern (#333)
- middleware: deprecate use of http.CloseNotifier (#347)
- middleware: fix RedirectSlashes to include query params on redirect (#334)
- History of changes: see https://github.com/go-chi/chi/compare/v3.3.4...v4.0.0
## v3.3.4 (2019-01-07)
- Minor middleware improvements. No changes to core library/router. Moving v3 into its
- own branch as a version of chi for Go 1.7, 1.8, 1.9, 1.10, 1.11
- History of changes: see https://github.com/go-chi/chi/compare/v3.3.3...v3.3.4
## v3.3.3 (2018-08-27)
- Minor release
- See https://github.com/go-chi/chi/compare/v3.3.2...v3.3.3
## v3.3.2 (2017-12-22)
- Support to route trailing slashes on mounted sub-routers (#281)
- middleware: new `ContentCharset` to check matching charsets. Thank you
@csucu for your community contribution!
## v3.3.1 (2017-11-20)
- middleware: new `AllowContentType` handler for explicit whitelist of accepted request Content-Types
- middleware: new `SetHeader` handler for short-hand middleware to set a response header key/value
- Minor bug fixes
## v3.3.0 (2017-10-10)
- New chi.RegisterMethod(method) to add support for custom HTTP methods, see _examples/custom-method for usage
- Deprecated LINK and UNLINK methods from the default list, please use `chi.RegisterMethod("LINK")` and `chi.RegisterMethod("UNLINK")` in an `init()` function
## v3.2.1 (2017-08-31)
- Add new `Match(rctx *Context, method, path string) bool` method to `Routes` interface
and `Mux`. Match searches the mux's routing tree for a handler that matches the method/path
- Add new `RouteMethod` to `*Context`
- Add new `Routes` pointer to `*Context`
- Add new `middleware.GetHead` to route missing HEAD requests to GET handler
- Updated benchmarks (see README)
## v3.1.5 (2017-08-02)
- Setup golint and go vet for the project
- As per golint, we've redefined `func ServerBaseContext(h http.Handler, baseCtx context.Context) http.Handler`
to `func ServerBaseContext(baseCtx context.Context, h http.Handler) http.Handler`
## v3.1.0 (2017-07-10)
- Fix a few minor issues after v3 release
- Move `docgen` sub-pkg to https://github.com/go-chi/docgen
- Move `render` sub-pkg to https://github.com/go-chi/render
- Add new `URLFormat` handler to chi/middleware sub-pkg to make working with url mime
suffixes easier, ie. parsing `/articles/1.json` and `/articles/1.xml`. See comments in
https://github.com/go-chi/chi/blob/master/middleware/url_format.go for example usage.
## v3.0.0 (2017-06-21)
- Major update to chi library with many exciting updates, but also some *breaking changes*
- URL parameter syntax changed from `/:id` to `/{id}` for even more flexible routing, such as
`/articles/{month}-{day}-{year}-{slug}`, `/articles/{id}`, and `/articles/{id}.{ext}` on the
same router
- Support for regexp for routing patterns, in the form of `/{paramKey:regExp}` for example:
`r.Get("/articles/{name:[a-z]+}", h)` and `chi.URLParam(r, "name")`
- Add `Method` and `MethodFunc` to `chi.Router` to allow routing definitions such as
`r.Method("GET", "/", h)` which provides a cleaner interface for custom handlers like
in `_examples/custom-handler`
- Deprecating `mux#FileServer` helper function. Instead, we encourage users to create their
own using file handler with the stdlib, see `_examples/fileserver` for an example
- Add support for LINK/UNLINK http methods via `r.Method()` and `r.MethodFunc()`
- Moved the chi project to its own organization, to allow chi-related community packages to
be easily discovered and supported, at: https://github.com/go-chi
- *NOTE:* please update your import paths to `"github.com/go-chi/chi"`
- *NOTE:* chi v2 is still available at https://github.com/go-chi/chi/tree/v2
## v2.1.0 (2017-03-30)
- Minor improvements and update to the chi core library
- Introduced a brand new `chi/render` sub-package to complete the story of building
APIs to offer a pattern for managing well-defined request / response payloads. Please
check out the updated `_examples/rest` example for how it works.
- Added `MethodNotAllowed(h http.HandlerFunc)` to chi.Router interface
## v2.0.0 (2017-01-06)
- After many months of v2 being in an RC state with many companies and users running it in
production, the inclusion of some improvements to the middlewares, we are very pleased to
announce v2.0.0 of chi.
## v2.0.0-rc1 (2016-07-26)
- Huge update! chi v2 is a large refactor targetting Go 1.7+. As of Go 1.7, the popular
community `"net/context"` package has been included in the standard library as `"context"` and
utilized by `"net/http"` and `http.Request` to managing deadlines, cancelation signals and other
request-scoped values. We're very excited about the new context addition and are proud to
introduce chi v2, a minimal and powerful routing package for building large HTTP services,
with zero external dependencies. Chi focuses on idiomatic design and encourages the use of
stdlib HTTP handlers and middlwares.
- chi v2 deprecates its `chi.Handler` interface and requires `http.Handler` or `http.HandlerFunc`
- chi v2 stores URL routing parameters and patterns in the standard request context: `r.Context()`
- chi v2 lower-level routing context is accessible by `chi.RouteContext(r.Context()) *chi.Context`,
which provides direct access to URL routing parameters, the routing path and the matching
routing patterns.
- Users upgrading from chi v1 to v2, need to:
1. Update the old chi.Handler signature, `func(ctx context.Context, w http.ResponseWriter, r *http.Request)` to
the standard http.Handler: `func(w http.ResponseWriter, r *http.Request)`
2. Use `chi.URLParam(r *http.Request, paramKey string) string`
or `URLParamFromCtx(ctx context.Context, paramKey string) string` to access a url parameter value
## v1.0.0 (2016-07-01)
- Released chi v1 stable https://github.com/go-chi/chi/tree/v1.0.0 for Go 1.6 and older.
## v0.9.0 (2016-03-31)
- Reuse context objects via sync.Pool for zero-allocation routing [#33](https://github.com/go-chi/chi/pull/33)
- BREAKING NOTE: due to subtle API changes, previously `chi.URLParams(ctx)["id"]` used to access url parameters
has changed to: `chi.URLParam(ctx, "id")`
================================================
FILE: vendor/github.com/go-chi/chi/CONTRIBUTING.md
================================================
# Contributing
## Prerequisites
1. [Install Go][go-install].
2. Download the sources and switch the working directory:
```bash
go get -u -d github.com/go-chi/chi
cd $GOPATH/src/github.com/go-chi/chi
```
## Submitting a Pull Request
A typical workflow is:
1. [Fork the repository.][fork] [This tip maybe also helpful.][go-fork-tip]
2. [Create a topic branch.][branch]
3. Add tests for your change.
4. Run `go test`. If your tests pass, return to the step 3.
5. Implement the change and ensure the steps from the previous step pass.
6. Run `goimports -w .`, to ensure the new code conforms to Go formatting guideline.
7. [Add, commit and push your changes.][git-help]
8. [Submit a pull request.][pull-req]
[go-install]: https://golang.org/doc/install
[go-fork-tip]: http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html
[fork]: https://help.github.com/articles/fork-a-repo
[branch]: http://learn.github.com/p/branching.html
[git-help]: https://guides.github.com
[pull-req]: https://help.github.com/articles/using-pull-requests
================================================
FILE: vendor/github.com/go-chi/chi/LICENSE
================================================
Copyright (c) 2015-present Peter Kieltyka (https://github.com/pkieltyka), Google Inc.
MIT License
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.
================================================
FILE: vendor/github.com/go-chi/chi/README.md
================================================
# <img alt="chi" src="https://cdn.rawgit.com/go-chi/chi/master/_examples/chi.svg" width="220" />
[![GoDoc Widget]][GoDoc] [![Travis Widget]][Travis]
`chi` is a lightweight, idiomatic and composable router for building Go HTTP services. It's
especially good at helping you write large REST API services that are kept maintainable as your
project grows and changes. `chi` is built on the new `context` package introduced in Go 1.7 to
handle signaling, cancelation and request-scoped values across a handler chain.
The focus of the project has been to seek out an elegant and comfortable design for writing
REST API servers, written during the development of the Pressly API service that powers our
public API service, which in turn powers all of our client-side applications.
The key considerations of chi's design are: project structure, maintainability, standard http
handlers (stdlib-only), developer productivity, and deconstructing a large system into many small
parts. The core router `github.com/go-chi/chi` is quite small (less than 1000 LOC), but we've also
included some useful/optional subpackages: [middleware](/middleware), [render](https://github.com/go-chi/render) and [docgen](https://github.com/go-chi/docgen). We hope you enjoy it too!
## Install
`go get -u github.com/go-chi/chi`
## Features
* **Lightweight** - cloc'd in ~1000 LOC for the chi router
* **Fast** - yes, see [benchmarks](#benchmarks)
* **100% compatible with net/http** - use any http or middleware pkg in the ecosystem that is also compatible with `net/http`
* **Designed for modular/composable APIs** - middlewares, inline middlewares, route groups and subrouter mounting
* **Context control** - built on new `context` package, providing value chaining, cancellations and timeouts
* **Robust** - in production at Pressly, CloudFlare, Heroku, 99Designs, and many others (see [discussion](https://github.com/go-chi/chi/issues/91))
* **Doc generation** - `docgen` auto-generates routing documentation from your source to JSON or Markdown
* **No external dependencies** - plain ol' Go stdlib + net/http
## Examples
See [_examples/](https://github.com/go-chi/chi/blob/master/_examples/) for a variety of examples.
**As easy as:**
```go
package main
import (
"net/http"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
)
func main() {
r := chi.NewRouter()
r.Use(middleware.Logger)
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("welcome"))
})
http.ListenAndServe(":3000", r)
}
```
**REST Preview:**
Here is a little preview of how routing looks like with chi. Also take a look at the generated routing docs
in JSON ([routes.json](https://github.com/go-chi/chi/blob/master/_examples/rest/routes.json)) and in
Markdown ([routes.md](https://github.com/go-chi/chi/blob/master/_examples/rest/routes.md)).
I highly recommend reading the source of the [examples](https://github.com/go-chi/chi/blob/master/_examples/) listed
above, they will show you all the features of chi and serve as a good form of documentation.
```go
import (
//...
"context"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
)
func main() {
r := chi.NewRouter()
// A good base middleware stack
r.Use(middleware.RequestID)
r.Use(middleware.RealIP)
r.Use(middleware.Logger)
r.Use(middleware.Recoverer)
// Set a timeout value on the request context (ctx), that will signal
// through ctx.Done() that the request has timed out and further
// processing should be stopped.
r.Use(middleware.Timeout(60 * time.Second))
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("hi"))
})
// RESTy routes for "articles" resource
r.Route("/articles", func(r chi.Router) {
r.With(paginate).Get("/", listArticles) // GET /articles
r.With(paginate).Get("/{month}-{day}-{year}", listArticlesByDate) // GET /articles/01-16-2017
r.Post("/", createArticle) // POST /articles
r.Get("/search", searchArticles) // GET /articles/search
// Regexp url parameters:
r.Get("/{articleSlug:[a-z-]+}", getArticleBySlug) // GET /articles/home-is-toronto
// Subrouters:
r.Route("/{articleID}", func(r chi.Router) {
r.Use(ArticleCtx)
r.Get("/", getArticle) // GET /articles/123
r.Put("/", updateArticle) // PUT /articles/123
r.Delete("/", deleteArticle) // DELETE /articles/123
})
})
// Mount the admin sub-router
r.Mount("/admin", adminRouter())
http.ListenAndServe(":3333", r)
}
func ArticleCtx(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
articleID := chi.URLParam(r, "articleID")
article, err := dbGetArticle(articleID)
if err != nil {
http.Error(w, http.StatusText(404), 404)
return
}
ctx := context.WithValue(r.Context(), "article", article)
next.ServeHTTP(w, r.WithContext(ctx))
})
}
func getArticle(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
article, ok := ctx.Value("article").(*Article)
if !ok {
http.Error(w, http.StatusText(422), 422)
return
}
w.Write([]byte(fmt.Sprintf("title:%s", article.Title)))
}
// A completely separate router for administrator routes
func adminRouter() http.Handler {
r := chi.NewRouter()
r.Use(AdminOnly)
r.Get("/", adminIndex)
r.Get("/accounts", adminListAccounts)
return r
}
func AdminOnly(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
perm, ok := ctx.Value("acl.permission").(YourPermissionType)
if !ok || !perm.IsAdmin() {
http.Error(w, http.StatusText(403), 403)
return
}
next.ServeHTTP(w, r)
})
}
```
## Router design
chi's router is based on a kind of [Patricia Radix trie](https://en.wikipedia.org/wiki/Radix_tree).
The router is fully compatible with `net/http`.
Built on top of the tree is the `Router` interface:
```go
// Router consisting of the core routing methods used by chi's Mux,
// using only the standard net/http.
type Router interface {
http.Handler
Routes
// Use appends one or more middlewares onto the Router stack.
Use(middlewares ...func(http.Handler) http.Handler)
// With adds inline middlewares for an endpoint handler.
With(middlewares ...func(http.Handler) http.Handler) Router
// Group adds a new inline-Router along the current routing
// path, with a fresh middleware stack for the inline-Router.
Group(fn func(r Router)) Router
// Route mounts a sub-Router along a `pattern`` string.
Route(pattern string, fn func(r Router)) Router
// Mount attaches another http.Handler along ./pattern/*
Mount(pattern string, h http.Handler)
// Handle and HandleFunc adds routes for `pattern` that matches
// all HTTP methods.
Handle(pattern string, h http.Handler)
HandleFunc(pattern string, h http.HandlerFunc)
// Method and MethodFunc adds routes for `pattern` that matches
// the `method` HTTP method.
Method(method, pattern string, h http.Handler)
MethodFunc(method, pattern string, h http.HandlerFunc)
// HTTP-method routing along `pattern`
Connect(pattern string, h http.HandlerFunc)
Delete(pattern string, h http.HandlerFunc)
Get(pattern string, h http.HandlerFunc)
Head(pattern string, h http.HandlerFunc)
Options(pattern string, h http.HandlerFunc)
Patch(pattern string, h http.HandlerFunc)
Post(pattern string, h http.HandlerFunc)
Put(pattern string, h http.HandlerFunc)
Trace(pattern string, h http.HandlerFunc)
// NotFound defines a handler to respond whenever a route could
// not be found.
NotFound(h http.HandlerFunc)
// MethodNotAllowed defines a handler to respond whenever a method is
// not allowed.
MethodNotAllowed(h http.HandlerFunc)
}
// Routes interface adds two methods for router traversal, which is also
// used by the github.com/go-chi/docgen package to generate documentation for Routers.
type Routes interface {
// Routes returns the routing tree in an easily traversable structure.
Routes() []Route
// Middlewares returns the list of middlewares in use by the router.
Middlewares() Middlewares
// Match searches the routing tree for a handler that matches
// the method/path - similar to routing a http request, but without
// executing the handler thereafter.
Match(rctx *Context, method, path string) bool
}
```
Each routing method accepts a URL `pattern` and chain of `handlers`. The URL pattern
supports named params (ie. `/users/{userID}`) and wildcards (ie. `/admin/*`). URL parameters
can be fetched at runtime by calling `chi.URLParam(r, "userID")` for named parameters
and `chi.URLParam(r, "*")` for a wildcard parameter.
### Middleware handlers
chi's middlewares are just stdlib net/http middleware handlers. There is nothing special
about them, which means the router and all the tooling is designed to be compatible and
friendly with any middleware in the community. This offers much better extensibility and reuse
of packages and is at the heart of chi's purpose.
Here is an example of a standard net/http middleware handler using the new request context
available in Go. This middleware sets a hypothetical user identifier on the request
context and calls the next handler in the chain.
```go
// HTTP middleware setting a value on the request context
func MyMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := context.WithValue(r.Context(), "user", "123")
next.ServeHTTP(w, r.WithContext(ctx))
})
}
```
### Request handlers
chi uses standard net/http request handlers. This little snippet is an example of a http.Handler
func that reads a user identifier from the request context - hypothetically, identifying
the user sending an authenticated request, validated+set by a previous middleware handler.
```go
// HTTP handler accessing data from the request context.
func MyRequestHandler(w http.ResponseWriter, r *http.Request) {
user := r.Context().Value("user").(string)
w.Write([]byte(fmt.Sprintf("hi %s", user)))
}
```
### URL parameters
chi's router parses and stores URL parameters right onto the request context. Here is
an example of how to access URL params in your net/http handlers. And of course, middlewares
are able to access the same information.
```go
// HTTP handler accessing the url routing parameters.
func MyRequestHandler(w http.ResponseWriter, r *http.Request) {
userID := chi.URLParam(r, "userID") // from a route like /users/{userID}
ctx := r.Context()
key := ctx.Value("key").(string)
w.Write([]byte(fmt.Sprintf("hi %v, %v", userID, key)))
}
```
## Middlewares
chi comes equipped with an optional `middleware` package, providing a suite of standard
`net/http` middlewares. Please note, any middleware in the ecosystem that is also compatible
with `net/http` can be used with chi's mux.
### Core middlewares
-----------------------------------------------------------------------------------------------------------
| chi/middleware Handler | description |
|:----------------------|:---------------------------------------------------------------------------------
| AllowContentType | Explicit whitelist of accepted request Content-Types |
| BasicAuth | Basic HTTP authentication |
| Compress | Gzip compression for clients that accept compressed responses |
| GetHead | Automatically route undefined HEAD requests to GET handlers |
| Heartbeat | Monitoring endpoint to check the servers pulse |
| Logger | Logs the start and end of each request with the elapsed processing time |
| NoCache | Sets response headers to prevent clients from caching |
| Profiler | Easily attach net/http/pprof to your routers |
| RealIP | Sets a http.Request's RemoteAddr to either X-Forwarded-For or X-Real-IP |
| Recoverer | Gracefully absorb panics and prints the stack trace |
| RequestID | Injects a request ID into the context of each request |
| RedirectSlashes | Redirect slashes on routing paths |
| SetHeader | Short-hand middleware to set a response header key/value |
| StripSlashes | Strip slashes on routing paths |
| Throttle | Puts a ceiling on the number of concurrent requests |
| Timeout | Signals to the request context when the timeout deadline is reached |
| URLFormat | Parse extension from url and put it on request context |
| WithValue | Short-hand middleware to set a key/value on the request context |
-----------------------------------------------------------------------------------------------------------
### Extra middlewares & packages
Please see https://github.com/go-chi for additional packages.
--------------------------------------------------------------------------------------------------------------------
| package | description |
|:---------------------------------------------------|:-------------------------------------------------------------
| [cors](https://github.com/go-chi/cors) | Cross-origin resource sharing (CORS) |
| [docgen](https://github.com/go-chi/docgen) | Print chi.Router routes at runtime |
| [jwtauth](https://github.com/go-chi/jwtauth) | JWT authentication |
| [hostrouter](https://github.com/go-chi/hostrouter) | Domain/host based request routing |
| [httplog](https://github.com/go-chi/httplog) | Small but powerful structured HTTP request logging |
| [httprate](https://github.com/go-chi/httprate) | HTTP request rate limiter |
| [httptracer](https://github.com/go-chi/httptracer) | HTTP request performance tracing library |
| [httpvcr](https://github.com/go-chi/httpvcr) | Write deterministic tests for external sources |
| [stampede](https://github.com/go-chi/stampede) | HTTP request coalescer |
--------------------------------------------------------------------------------------------------------------------
please [submit a PR](./CONTRIBUTING.md) if you'd like to include a link to a chi-compatible middleware
## context?
`context` is a tiny pkg that provides simple interface to signal context across call stacks
and goroutines. It was originally written by [Sameer Ajmani](https://github.com/Sajmani)
and is available in stdlib since go1.7.
Learn more at https://blog.golang.org/context
and..
* Docs: https://golang.org/pkg/context
* Source: https://github.com/golang/go/tree/master/src/context
## Benchmarks
The benchmark suite: https://github.com/pkieltyka/go-http-routing-benchmark
Results as of Jan 9, 2019 with Go 1.11.4 on Linux X1 Carbon laptop
```shell
BenchmarkChi_Param 3000000 475 ns/op 432 B/op 3 allocs/op
BenchmarkChi_Param5 2000000 696 ns/op 432 B/op 3 allocs/op
BenchmarkChi_Param20 1000000 1275 ns/op 432 B/op 3 allocs/op
BenchmarkChi_ParamWrite 3000000 505 ns/op 432 B/op 3 allocs/op
BenchmarkChi_GithubStatic 3000000 508 ns/op 432 B/op 3 allocs/op
BenchmarkChi_GithubParam 2000000 669 ns/op 432 B/op 3 allocs/op
BenchmarkChi_GithubAll 10000 134627 ns/op 87699 B/op 609 allocs/op
BenchmarkChi_GPlusStatic 3000000 402 ns/op 432 B/op 3 allocs/op
BenchmarkChi_GPlusParam 3000000 500 ns/op 432 B/op 3 allocs/op
BenchmarkChi_GPlus2Params 3000000 586 ns/op 432 B/op 3 allocs/op
BenchmarkChi_GPlusAll 200000 7237 ns/op 5616 B/op 39 allocs/op
BenchmarkChi_ParseStatic 3000000 408 ns/op 432 B/op 3 allocs/op
BenchmarkChi_ParseParam 3000000 488 ns/op 432 B/op 3 allocs/op
BenchmarkChi_Parse2Params 3000000 551 ns/op 432 B/op 3 allocs/op
BenchmarkChi_ParseAll 100000 13508 ns/op 11232 B/op 78 allocs/op
BenchmarkChi_StaticAll 20000 81933 ns/op 67826 B/op 471 allocs/op
```
Comparison with other routers: https://gist.github.com/pkieltyka/123032f12052520aaccab752bd3e78cc
NOTE: the allocs in the benchmark above are from the calls to http.Request's
`WithContext(context.Context)` method that clones the http.Request, sets the `Context()`
on the duplicated (alloc'd) request and returns it the new request object. This is just
how setting context on a request in Go works.
## Credits
* Carl Jackson for https://github.com/zenazn/goji
* Parts of chi's thinking comes from goji, and chi's middleware package
sources from goji.
* Armon Dadgar for https://github.com/armon/go-radix
* Contributions: [@VojtechVitek](https://github.com/VojtechVitek)
We'll be more than happy to see [your contributions](./CONTRIBUTING.md)!
## Beyond REST
chi is just a http router that lets you decompose request handling into many smaller layers.
Many companies use chi to write REST services for their public APIs. But, REST is just a convention
for managing state via HTTP, and there's a lot of other pieces required to write a complete client-server
system or network of microservices.
Looking beyond REST, I also recommend some newer works in the field:
* [webrpc](https://github.com/webrpc/webrpc) - Web-focused RPC client+server framework with code-gen
* [gRPC](https://github.com/grpc/grpc-go) - Google's RPC framework via protobufs
* [graphql](https://github.com/99designs/gqlgen) - Declarative query language
* [NATS](https://nats.io) - lightweight pub-sub
## License
Copyright (c) 2015-present [Peter Kieltyka](https://github.com/pkieltyka)
Licensed under [MIT License](./LICENSE)
[GoDoc]: https://godoc.org/github.com/go-chi/chi
[GoDoc Widget]: https://godoc.org/github.com/go-chi/chi?status.svg
[Travis]: https://travis-ci.org/go-chi/chi
[Travis Widget]: https://travis-ci.org/go-chi/chi.svg?branch=master
================================================
FILE: vendor/github.com/go-chi/chi/chain.go
================================================
package chi
import "net/http"
// Chain returns a Middlewares type from a slice of middleware handlers.
func Chain(middlewares ...func(http.Handler) http.Handler) Middlewares {
return Middlewares(middlewares)
}
// Handler builds and returns a http.Handler from the chain of middlewares,
// with `h http.Handler` as the final handler.
func (mws Middlewares) Handler(h http.Handler) http.Handler {
return &ChainHandler{mws, h, chain(mws, h)}
}
// HandlerFunc builds and returns a http.Handler from the chain of middlewares,
// with `h http.Handler` as the final handler.
func (mws Middlewares) HandlerFunc(h http.HandlerFunc) http.Handler {
return &ChainHandler{mws, h, chain(mws, h)}
}
// ChainHandler is a http.Handler with support for handler composition and
// execution.
type ChainHandler struct {
Middlewares Middlewares
Endpoint http.Handler
chain http.Handler
}
func (c *ChainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
c.chain.ServeHTTP(w, r)
}
// chain builds a http.Handler composed of an inline middleware stack and endpoint
// handler in the order they are passed.
func chain(middlewares []func(http.Handler) http.Handler, endpoint http.Handler) http.Handler {
// Return ahead of time if there aren't any middlewares for the chain
if len(middlewares) == 0 {
return endpoint
}
// Wrap the end handler with the middleware chain
h := middlewares[len(middlewares)-1](endpoint)
for i := len(middlewares) - 2; i >= 0; i-- {
h = middlewares[i](h)
}
return h
}
================================================
FILE: vendor/github.com/go-chi/chi/chi.go
================================================
//
// Package chi is a small, idiomatic and composable router for building HTTP services.
//
// chi requires Go 1.10 or newer.
//
// Example:
// package main
//
// import (
// "net/http"
//
// "github.com/go-chi/chi"
// "github.com/go-chi/chi/middleware"
// )
//
// func main() {
// r := chi.NewRouter()
// r.Use(middleware.Logger)
// r.Use(middleware.Recoverer)
//
// r.Get("/", func(w http.ResponseWriter, r *http.Request) {
// w.Write([]byte("root."))
// })
//
// http.ListenAndServe(":3333", r)
// }
//
// See github.com/go-chi/chi/_examples/ for more in-depth examples.
//
// URL patterns allow for easy matching of path components in HTTP
// requests. The matching components can then be accessed using
// chi.URLParam(). All patterns must begin with a slash.
//
// A simple named placeholder {name} matches any sequence of characters
// up to the next / or the end of the URL. Trailing slashes on paths must
// be handled explicitly.
//
// A placeholder with a name followed by a colon allows a regular
// expression match, for example {number:\\d+}. The regular expression
// syntax is Go's normal regexp RE2 syntax, except that regular expressions
// including { or } are not supported, and / will never be
// matched. An anonymous regexp pattern is allowed, using an empty string
// before the colon in the placeholder, such as {:\\d+}
//
// The special placeholder of asterisk matches the rest of the requested
// URL. Any trailing characters in the pattern are ignored. This is the only
// placeholder which will match / characters.
//
// Examples:
// "/user/{name}" matches "/user/jsmith" but not "/user/jsmith/info" or "/user/jsmith/"
// "/user/{name}/info" matches "/user/jsmith/info"
// "/page/*" matches "/page/intro/latest"
// "/page/*/index" also matches "/page/intro/latest"
// "/date/{yyyy:\\d\\d\\d\\d}/{mm:\\d\\d}/{dd:\\d\\d}" matches "/date/2017/04/01"
//
package chi
import "net/http"
// NewRouter returns a new Mux object that implements the Router interface.
func NewRouter() *Mux {
return NewMux()
}
// Router consisting of the core routing methods used by chi's Mux,
// using only the standard net/http.
type Router interface {
http.Handler
Routes
// Use appends one or more middlewares onto the Router stack.
Use(middlewares ...func(http.Handler) http.Handler)
// With adds inline middlewares for an endpoint handler.
With(middlewares ...func(http.Handler) http.Handler) Router
// Group adds a new inline-Router along the current routing
// path, with a fresh middleware stack for the inline-Router.
Group(fn func(r Router)) Router
// Route mounts a sub-Router along a `pattern`` string.
Route(pattern string, fn func(r Router)) Router
// Mount attaches another http.Handler along ./pattern/*
Mount(pattern string, h http.Handler)
// Handle and HandleFunc adds routes for `pattern` that matches
// all HTTP methods.
Handle(pattern string, h http.Handler)
HandleFunc(pattern string, h http.HandlerFunc)
// Method and MethodFunc adds routes for `pattern` that matches
// the `method` HTTP method.
Method(method, pattern string, h http.Handler)
MethodFunc(method, pattern string, h http.HandlerFunc)
// HTTP-method routing along `pattern`
Connect(pattern string, h http.HandlerFunc)
Delete(pattern string, h http.HandlerFunc)
Get(pattern string, h http.HandlerFunc)
Head(pattern string, h http.HandlerFunc)
Options(pattern string, h http.HandlerFunc)
Patch(pattern string, h http.HandlerFunc)
Post(pattern string, h http.HandlerFunc)
Put(pattern string, h http.HandlerFunc)
Trace(pattern string, h http.HandlerFunc)
// NotFound defines a handler to respond whenever a route could
// not be found.
NotFound(h http.HandlerFunc)
// MethodNotAllowed defines a handler to respond whenever a method is
// not allowed.
MethodNotAllowed(h http.HandlerFunc)
}
// Routes interface adds two methods for router traversal, which is also
// used by the `docgen` subpackage to generation documentation for Routers.
type Routes interface {
// Routes returns the routing tree in an easily traversable structure.
Routes() []Route
// Middlewares returns the list of middlewares in use by the router.
Middlewares() Middlewares
// Match searches the routing tree for a handler that matches
// the method/path - similar to routing a http request, but without
// executing the handler thereafter.
Match(rctx *Context, method, path string) bool
}
// Middlewares type is a slice of standard middleware handlers with methods
// to compose middleware chains and http.Handler's.
type Middlewares []func(http.Handler) http.Handler
================================================
FILE: vendor/github.com/go-chi/chi/context.go
================================================
package chi
import (
"context"
"net"
"net/http"
"strings"
)
// URLParam returns the url parameter from a http.Request object.
func URLParam(r *http.Request, key string) string {
if rctx := RouteContext(r.Context()); rctx != nil {
return rctx.URLParam(key)
}
return ""
}
// URLParamFromCtx returns the url parameter from a http.Request Context.
func URLParamFromCtx(ctx context.Context, key string) string {
if rctx := RouteContext(ctx); rctx != nil {
return rctx.URLParam(key)
}
return ""
}
// RouteContext returns chi's routing Context object from a
// http.Request Context.
func RouteContext(ctx context.Context) *Context {
val, _ := ctx.Value(RouteCtxKey).(*Context)
return val
}
// ServerBaseContext wraps an http.Handler to set the request context to the
// `baseCtx`.
func ServerBaseContext(baseCtx context.Context, h http.Handler) http.Handler {
fn := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
baseCtx := baseCtx
// Copy over default net/http server context keys
if v, ok := ctx.Value(http.ServerContextKey).(*http.Server); ok {
baseCtx = context.WithValue(baseCtx, http.ServerContextKey, v)
}
if v, ok := ctx.Value(http.LocalAddrContextKey).(net.Addr); ok {
baseCtx = context.WithValue(baseCtx, http.LocalAddrContextKey, v)
}
h.ServeHTTP(w, r.WithContext(baseCtx))
})
return fn
}
// NewRouteContext returns a new routing Context object.
func NewRouteContext() *Context {
return &Context{}
}
var (
// RouteCtxKey is the context.Context key to store the request context.
RouteCtxKey = &contextKey{"RouteContext"}
)
// Context is the default routing context set on the root node of a
// request context to track route patterns, URL parameters and
// an optional routing path.
type Context struct {
Routes Routes
// Routing path/method override used during the route search.
// See Mux#routeHTTP method.
RoutePath string
RouteMethod string
// Routing pattern stack throughout the lifecycle of the request,
// across all connected routers. It is a record of all matching
// patterns across a stack of sub-routers.
RoutePatterns []string
// URLParams are the stack of routeParams captured during the
// routing lifecycle across a stack of sub-routers.
URLParams RouteParams
// The endpoint routing pattern that matched the request URI path
// or `RoutePath` of the current sub-router. This value will update
// during the lifecycle of a request passing through a stack of
// sub-routers.
routePattern string
// Route parameters matched for the current sub-router. It is
// intentionally unexported so it cant be tampered.
routeParams RouteParams
// methodNotAllowed hint
methodNotAllowed bool
}
// Reset a routing context to its initial state.
func (x *Context) Reset() {
x.Routes = nil
x.RoutePath = ""
x.RouteMethod = ""
x.RoutePatterns = x.RoutePatterns[:0]
x.URLParams.Keys = x.URLParams.Keys[:0]
x.URLParams.Values = x.URLParams.Values[:0]
x.routePattern = ""
x.routeParams.Keys = x.routeParams.Keys[:0]
x.routeParams.Values = x.routeParams.Values[:0]
x.methodNotAllowed = false
}
// URLParam returns the corresponding URL parameter value from the request
// routing context.
func (x *Context) URLParam(key string) string {
for k := len(x.URLParams.Keys) - 1; k >= 0; k-- {
if x.URLParams.Keys[k] == key {
return x.URLParams.Values[k]
}
}
return ""
}
// RoutePattern builds the routing pattern string for the particular
// request, at the particular point during routing. This means, the value
// will change throughout the execution of a request in a router. That is
// why its advised to only use this value after calling the next handler.
//
// For example,
//
// func Instrument(next http.Handler) http.Handler {
// return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// next.ServeHTTP(w, r)
// routePattern := chi.RouteContext(r.Context()).RoutePattern()
// measure(w, r, routePattern)
// })
// }
func (x *Context) RoutePattern() string {
routePattern := strings.Join(x.RoutePatterns, "")
return replaceWildcards(routePattern)
}
// replaceWildcards takes a route pattern and recursively replaces all
// occurrences of "/*/" to "/".
func replaceWildcards(p string) string {
if strings.Contains(p, "/*/") {
return replaceWildcards(strings.Replace(p, "/*/", "/", -1))
}
return p
}
// RouteParams is a structure to track URL routing parameters efficiently.
type RouteParams struct {
Keys, Values []string
}
// Add will append a URL parameter to the end of the route param
func (s *RouteParams) Add(key, value string) {
s.Keys = append(s.Keys, key)
s.Values = append(s.Values, value)
}
// contextKey is a value for use with context.WithValue. It's used as
// a pointer so it fits in an interface{} without allocation. This technique
// for defining context keys was copied from Go 1.7's new use of context in net/http.
type contextKey struct {
name string
}
func (k *contextKey) String() string {
return "chi context value " + k.name
}
================================================
FILE: vendor/github.com/go-chi/chi/middleware/basic_auth.go
================================================
package middleware
import (
"fmt"
"net/http"
)
// BasicAuth implements a simple middleware handler for adding basic http auth to a route.
func BasicAuth(realm string, creds map[string]string) func(next http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
user, pass, ok := r.BasicAuth()
if !ok {
basicAuthFailed(w, realm)
return
}
credPass, credUserOk := creds[user]
if !credUserOk || pass != credPass {
basicAuthFailed(w, realm)
return
}
next.ServeHTTP(w, r)
})
}
}
func basicAuthFailed(w http.ResponseWriter, realm string) {
w.Header().Add("WWW-Authenticate", fmt.Sprintf(`Basic realm="%s"`, realm))
w.WriteHeader(http.StatusUnauthorized)
}
================================================
FILE: vendor/github.com/go-chi/chi/middleware/compress.go
================================================
package middleware
import (
"bufio"
"compress/flate"
"compress/gzip"
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"strings"
"sync"
)
var defaultCompressibleContentTypes = []string{
"text/html",
"text/css",
"text/plain",
"text/javascript",
"application/javascript",
"application/x-javascript",
"application/json",
"application/atom+xml",
"application/rss+xml",
"image/svg+xml",
}
// Compress is a middleware that compresses response
// body of a given content types to a data format based
// on Accept-Encoding request header. It uses a given
// compression level.
//
// NOTE: make sure to set the Content-Type header on your response
// otherwise this middleware will not compress the response body. For ex, in
// your handler you should set w.Header().Set("Content-Type", http.DetectContentType(yourBody))
// or set it manually.
//
// Passing a compression level of 5 is sensible value
func Compress(level int, types ...string) func(next http.Handler) http.Handler {
compressor := NewCompressor(level, types...)
return compressor.Handler
}
// Compressor represents a set of encoding configurations.
type Compressor struct {
level int // The compression level.
// The mapping of encoder names to encoder functions.
encoders map[string]EncoderFunc
// The mapping of pooled encoders to pools.
pooledEncoders map[string]*sync.Pool
// The set of content types allowed to be compressed.
allowedTypes map[string]struct{}
allowedWildcards map[string]struct{}
// The list of encoders in order of decreasing precedence.
encodingPrecedence []string
}
// NewCompressor creates a new Compressor that will handle encoding responses.
//
// The level should be one of the ones defined in the flate package.
// The types are the content types that are allowed to be compressed.
func NewCompressor(level int, types ...string) *Compressor {
// If types are provided, set those as the allowed types. If none are
// provided, use the default list.
allowedTypes := make(map[string]struct{})
allowedWildcards := make(map[string]struct{})
if len(types) > 0 {
for _, t := range types {
if strings.Contains(strings.TrimSuffix(t, "/*"), "*") {
panic(fmt.Sprintf("middleware/compress: Unsupported content-type wildcard pattern '%s'. Only '/*' supported", t))
}
if strings.HasSuffix(t, "/*") {
allowedWildcards[strings.TrimSuffix(t, "/*")] = struct{}{}
} else {
allowedTypes[t] = struct{}{}
}
}
} else {
for _, t := range defaultCompressibleContentTypes {
allowedTypes[t] = struct{}{}
}
}
c := &Compressor{
level: level,
encoders: make(map[string]EncoderFunc),
pooledEncoders: make(map[string]*sync.Pool),
allowedTypes: allowedTypes,
allowedWildcards: allowedWildcards,
}
// Set the default encoders. The precedence order uses the reverse
// ordering that the encoders were added. This means adding new encoders
// will move them to the front of the order.
//
// TODO:
// lzma: Opera.
// sdch: Chrome, Android. Gzip output + dictionary header.
// br: Brotli, see https://github.com/go-chi/chi/pull/326
// HTTP 1.1 "deflate" (RFC 2616) stands for DEFLATE data (RFC 1951)
// wrapped with zlib (RFC 1950). The zlib wrapper uses Adler-32
// checksum compared to CRC-32 used in "gzip" and thus is faster.
//
// But.. some old browsers (MSIE, Safari 5.1) incorrectly expect
// raw DEFLATE data only, without the mentioned zlib wrapper.
// Because of this major confusion, most modern browsers try it
// both ways, first looking for zlib headers.
// Quote by Mark Adler: http://stackoverflow.com/a/9186091/385548
//
// The list of browsers having problems is quite big, see:
// http://zoompf.com/blog/2012/02/lose-the-wait-http-compression
// https://web.archive.org/web/20120321182910/http://www.vervestudios.co/projects/compression-tests/results
//
// That's why we prefer gzip over deflate. It's just more reliable
// and not significantly slower than gzip.
c.SetEncoder("deflate", encoderDeflate)
// TODO: Exception for old MSIE browsers that can't handle non-HTML?
// https://zoompf.com/blog/2012/02/lose-the-wait-http-compression
c.SetEncoder("gzip", encoderGzip)
// NOTE: Not implemented, intentionally:
// case "compress": // LZW. Deprecated.
// case "bzip2": // Too slow on-the-fly.
// case "zopfli": // Too slow on-the-fly.
// case "xz": // Too slow on-the-fly.
return c
}
// SetEncoder can be used to set the implementation of a compression algorithm.
//
// The encoding should be a standardised identifier. See:
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding
//
// For example, add the Brotli algortithm:
//
// import brotli_enc "gopkg.in/kothar/brotli-go.v0/enc"
//
// compressor := middleware.NewCompressor(5, "text/html")
// compressor.SetEncoder("br", func(w http.ResponseWriter, level int) io.Writer {
// params := brotli_enc.NewBrotliParams()
// params.SetQuality(level)
// return brotli_enc.NewBrotliWriter(params, w)
// })
func (c *Compressor) SetEncoder(encoding string, fn EncoderFunc) {
encoding = strings.ToLower(encoding)
if encoding == "" {
panic("the encoding can not be empty")
}
if fn == nil {
panic("attempted to set a nil encoder function")
}
// If we are adding a new encoder that is already registered, we have to
// clear that one out first.
if _, ok := c.pooledEncoders[encoding]; ok {
delete(c.pooledEncoders, encoding)
}
if _, ok := c.encoders[encoding]; ok {
delete(c.encoders, encoding)
}
// If the encoder supports Resetting (IoReseterWriter), then it can be pooled.
encoder := fn(ioutil.Discard, c.level)
if encoder != nil {
if _, ok := encoder.(ioResetterWriter); ok {
pool := &sync.Pool{
New: func() interface{} {
return fn(ioutil.Discard, c.level)
},
}
c.pooledEncoders[encoding] = pool
}
}
// If the encoder is not in the pooledEncoders, add it to the normal encoders.
if _, ok := c.pooledEncoders[encoding]; !ok {
c.encoders[encoding] = fn
}
for i, v := range c.encodingPrecedence {
if v == encoding {
c.encodingPrecedence = append(c.encodingPrecedence[:i], c.encodingPrecedence[i+1:]...)
}
}
c.encodingPrecedence = append([]string{encoding}, c.encodingPrecedence...)
}
// Handler returns a new middleware that will compress the response based on the
// current Compressor.
func (c *Compressor) Handler(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
encoder, encoding, cleanup := c.selectEncoder(r.Header, w)
cw := &compressResponseWriter{
ResponseWriter: w,
w: w,
contentTypes: c.allowedTypes,
contentWildcards: c.allowedWildcards,
encoding: encoding,
compressable: false, // determined in post-handler
}
if encoder != nil {
cw.w = encoder
}
// Re-add the encoder to the pool if applicable.
defer cleanup()
defer cw.Close()
next.ServeHTTP(cw, r)
})
}
// selectEncoder returns the encoder, the name of the encoder, and a closer function.
func (c *Compressor) selectEncoder(h http.Header, w io.Writer) (io.Writer, string, func()) {
header := h.Get("Accept-Encoding")
// Parse the names of all accepted algorithms from the header.
accepted := strings.Split(strings.ToLower(header), ",")
// Find supported encoder by accepted list by precedence
for _, name := range c.encodingPrecedence {
if matchAcceptEncoding(accepted, name) {
if pool, ok := c.pooledEncoders[name]; ok {
encoder := pool.Get().(ioResetterWriter)
cleanup := func() {
pool.Put(encoder)
}
encoder.Reset(w)
return encoder, name, cleanup
}
if fn, ok := c.encoders[name]; ok {
return fn(w, c.level), name, func() {}
}
}
}
// No encoder found to match the accepted encoding
return nil, "", func() {}
}
func matchAcceptEncoding(accepted []string, encoding string) bool {
for _, v := range accepted {
if strings.Contains(v, encoding) {
return true
}
}
return false
}
// An EncoderFunc is a function that wraps the provided io.Writer with a
// streaming compression algorithm and returns it.
//
// In case of failure, the function should return nil.
type EncoderFunc func(w io.Writer, level int) io.Writer
// Interface for types that allow resetting io.Writers.
type ioResetterWriter interface {
io.Writer
Reset(w io.Writer)
}
type compressResponseWriter struct {
http.ResponseWriter
// The streaming encoder writer to be used if there is one. Otherwise,
// this is just the normal writer.
w io.Writer
encoding string
contentTypes map[string]struct{}
contentWildcards map[string]struct{}
wroteHeader bool
compressable bool
}
func (cw *compressResponseWriter) isCompressable() bool {
// Parse the first part of the Content-Type response header.
contentType := cw.Header().Get("Content-Type")
if idx := strings.Index(contentType, ";"); idx >= 0 {
contentType = contentType[0:idx]
}
// Is the content type compressable?
if _, ok := cw.contentTypes[contentType]; ok {
return true
}
if idx := strings.Index(contentType, "/"); idx > 0 {
contentType = contentType[0:idx]
_, ok := cw.contentWildcards[contentType]
return ok
}
return false
}
func (cw *compressResponseWriter) WriteHeader(code int) {
if cw.wroteHeader {
cw.ResponseWriter.WriteHeader(code) // Allow multiple calls to propagate.
return
}
cw.wroteHeader = true
defer cw.ResponseWriter.WriteHeader(code)
// Already compressed data?
if cw.Header().Get("Content-Encoding") != "" {
return
}
if !cw.isCompressable() {
cw.compressable = false
return
}
if cw.encoding != "" {
cw.compressable = true
cw.Header().Set("Content-Encoding", cw.encoding)
cw.Header().Set("Vary", "Accept-Encoding")
// The content-length after compression is unknown
cw.Header().Del("Content-Length")
}
}
func (cw *compressResponseWriter) Write(p []byte) (int, error) {
if !cw.wroteHeader {
cw.WriteHeader(http.StatusOK)
}
return cw.writer().Write(p)
}
func (cw *compressResponseWriter) writer() io.Writer {
if cw.compressable {
return cw.w
} else {
return cw.ResponseWriter
}
}
type compressFlusher interface {
Flush() error
}
func (cw *compressResponseWriter) Flush() {
if f, ok := cw.writer().(http.Flusher); ok {
f.Flush()
}
// If the underlying writer has a compression flush signature,
// call this Flush() method instead
if f, ok := cw.writer().(compressFlusher); ok {
f.Flush()
// Also flush the underlying response writer
if f, ok := cw.ResponseWriter.(http.Flusher); ok {
f.Flush()
}
}
}
func (cw *compressResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
if hj, ok := cw.writer().(http.Hijacker); ok {
return hj.Hijack()
}
return nil, nil, errors.New("chi/middleware: http.Hijacker is unavailable on the writer")
}
func (cw *compressResponseWriter) Push(target string, opts *http.PushOptions) error {
if ps, ok := cw.writer().(http.Pusher); ok {
return ps.Push(target, opts)
}
return errors.New("chi/middleware: http.Pusher is unavailable on the writer")
}
func (cw *compressResponseWriter) Close() error {
if c, ok := cw.writer().(io.WriteCloser); ok {
return c.Close()
}
return errors.New("chi/middleware: io.WriteCloser is unavailable on the writer")
}
func encoderGzip(w io.Writer, level int) io.Writer {
gw, err := gzip.NewWriterLevel(w, level)
if err != nil {
return nil
}
return gw
}
func encoderDeflate(w io.Writer, level int) io.Writer {
dw, err := flate.NewWriter(w, level)
if err != nil {
return nil
}
return dw
}
================================================
FILE: vendor/github.com/go-chi/chi/middleware/content_charset.go
================================================
package middleware
import (
"net/http"
"strings"
)
// ContentCharset generates a handler that writes a 415 Unsupported Media Type response if none of the charsets match.
// An empty charset will allow requests with no Content-Type header or no specified charset.
func ContentCharset(charsets ...string) func(next http.Handler) http.Handler {
for i, c := range charsets {
charsets[i] = strings.ToLower(c)
}
retu
gitextract_5k9udub5/
├── .github/
│ ├── FUNDING.yml
│ └── dependabot.yml
├── .gitignore
├── .tool-versions
├── .travis.yml
├── LICENSE
├── Makefile
├── Procfile
├── README.md
├── api/
│ ├── README.md
│ ├── api.go
│ ├── handler/
│ │ ├── README.md
│ │ ├── handler.go
│ │ ├── handler_test.go
│ │ ├── healthz.go
│ │ ├── healthz_test.go
│ │ ├── score.go
│ │ ├── score_test.go
│ │ ├── todos.go
│ │ └── todos_test.go
│ └── middleware/
│ └── README.md
├── cmd/
│ ├── README.md
│ └── api/
│ └── main.go
├── db/
│ ├── README.md
│ └── migrations/
│ ├── 20202806225100_create_todos.go
│ ├── 20203006230600_create_scores.go
│ └── 20203006230700_create_points.go
├── deploy/
│ ├── README.md
│ └── api/
│ └── Dockerfile
├── docker-compose.yml
├── go.mod
├── go.sum
├── scores/
│ ├── earn.go
│ ├── earn_test.go
│ ├── point.go
│ ├── score.go
│ ├── scorestest/
│ │ └── service.go
│ └── service.go
├── todos/
│ ├── README.md
│ ├── clear.go
│ ├── clear_test.go
│ ├── create.go
│ ├── create_test.go
│ ├── delete.go
│ ├── delete_test.go
│ ├── search.go
│ ├── search_test.go
│ ├── service.go
│ ├── todo.go
│ ├── todo_test.go
│ ├── todostest/
│ │ ├── README.md
│ │ ├── service.go
│ │ └── todos.go
│ ├── update.go
│ └── update_test.go
└── vendor/
├── github.com/
│ ├── davecgh/
│ │ └── go-spew/
│ │ ├── LICENSE
│ │ └── spew/
│ │ ├── bypass.go
│ │ ├── bypasssafe.go
│ │ ├── common.go
│ │ ├── config.go
│ │ ├── doc.go
│ │ ├── dump.go
│ │ ├── format.go
│ │ └── spew.go
│ ├── go-chi/
│ │ └── chi/
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── CHANGELOG.md
│ │ ├── CONTRIBUTING.md
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── chain.go
│ │ ├── chi.go
│ │ ├── context.go
│ │ ├── middleware/
│ │ │ ├── basic_auth.go
│ │ │ ├── compress.go
│ │ │ ├── content_charset.go
│ │ │ ├── content_encoding.go
│ │ │ ├── content_type.go
│ │ │ ├── get_head.go
│ │ │ ├── heartbeat.go
│ │ │ ├── logger.go
│ │ │ ├── middleware.go
│ │ │ ├── nocache.go
│ │ │ ├── profiler.go
│ │ │ ├── realip.go
│ │ │ ├── recoverer.go
│ │ │ ├── request_id.go
│ │ │ ├── route_headers.go
│ │ │ ├── strip.go
│ │ │ ├── terminal.go
│ │ │ ├── throttle.go
│ │ │ ├── timeout.go
│ │ │ ├── url_format.go
│ │ │ ├── value.go
│ │ │ └── wrap_writer.go
│ │ ├── mux.go
│ │ └── tree.go
│ ├── goware/
│ │ └── cors/
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── cors.go
│ │ └── utils.go
│ ├── jinzhu/
│ │ └── inflection/
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── inflections.go
│ │ └── wercker.yml
│ ├── lib/
│ │ └── pq/
│ │ ├── .gitignore
│ │ ├── LICENSE.md
│ │ ├── README.md
│ │ ├── TESTS.md
│ │ ├── array.go
│ │ ├── buf.go
│ │ ├── conn.go
│ │ ├── conn_go115.go
│ │ ├── conn_go18.go
│ │ ├── connector.go
│ │ ├── copy.go
│ │ ├── doc.go
│ │ ├── encode.go
│ │ ├── error.go
│ │ ├── krb.go
│ │ ├── notice.go
│ │ ├── notify.go
│ │ ├── oid/
│ │ │ ├── doc.go
│ │ │ └── types.go
│ │ ├── rows.go
│ │ ├── scram/
│ │ │ └── scram.go
│ │ ├── ssl.go
│ │ ├── ssl_permissions.go
│ │ ├── ssl_windows.go
│ │ ├── url.go
│ │ ├── user_other.go
│ │ ├── user_posix.go
│ │ ├── user_windows.go
│ │ └── uuid.go
│ ├── pmezard/
│ │ └── go-difflib/
│ │ ├── LICENSE
│ │ └── difflib/
│ │ └── difflib.go
│ ├── serenize/
│ │ └── snaker/
│ │ ├── .travis.yml
│ │ ├── LICENSE.txt
│ │ ├── README.md
│ │ └── snaker.go
│ └── stretchr/
│ ├── objx/
│ │ ├── .codeclimate.yml
│ │ ├── .gitignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── Taskfile.yml
│ │ ├── accessors.go
│ │ ├── conversions.go
│ │ ├── doc.go
│ │ ├── map.go
│ │ ├── mutations.go
│ │ ├── security.go
│ │ ├── tests.go
│ │ ├── type_specific.go
│ │ ├── type_specific_codegen.go
│ │ └── value.go
│ └── testify/
│ ├── LICENSE
│ ├── assert/
│ │ ├── assertion_compare.go
│ │ ├── assertion_compare_can_convert.go
│ │ ├── assertion_compare_legacy.go
│ │ ├── assertion_format.go
│ │ ├── assertion_format.go.tmpl
│ │ ├── assertion_forward.go
│ │ ├── assertion_forward.go.tmpl
│ │ ├── assertion_order.go
│ │ ├── assertions.go
│ │ ├── doc.go
│ │ ├── errors.go
│ │ ├── forward_assertions.go
│ │ └── http_assertions.go
│ └── mock/
│ ├── doc.go
│ └── mock.go
├── gopkg.in/
│ └── yaml.v3/
│ ├── LICENSE
│ ├── NOTICE
│ ├── README.md
│ ├── apic.go
│ ├── decode.go
│ ├── emitterc.go
│ ├── encode.go
│ ├── parserc.go
│ ├── readerc.go
│ ├── resolve.go
│ ├── scannerc.go
│ ├── sorter.go
│ ├── writerc.go
│ ├── yaml.go
│ ├── yamlh.go
│ └── yamlprivateh.go
└── modules.txt
SYMBOL INDEX (2180 symbols across 128 files)
FILE: api/api.go
function NewMux (line 14) | func NewMux(repository rel.Repository) *chi.Mux {
FILE: api/handler/handler.go
function render (line 17) | func render(w http.ResponseWriter, body interface{}, status int) {
FILE: api/handler/handler_test.go
function TestRender (line 11) | func TestRender(t *testing.T) {
FILE: api/handler/healthz.go
type Pinger (line 13) | type Pinger interface
type ping (line 17) | type ping struct
type Healthz (line 23) | type Healthz struct
method Show (line 29) | func (h Healthz) Show(w http.ResponseWriter, r *http.Request) {
method Add (line 61) | func (h *Healthz) Add(name string, ping Pinger) {
function NewHealthz (line 66) | func NewHealthz() Healthz {
FILE: api/handler/healthz_test.go
type pinger (line 14) | type pinger struct
method Ping (line 18) | func (p pinger) Ping(ctx context.Context) error {
function TestHealthz_Show (line 22) | func TestHealthz_Show(t *testing.T) {
FILE: api/handler/score.go
type Score (line 12) | type Score struct
method Index (line 18) | func (s Score) Index(w http.ResponseWriter, r *http.Request) {
method Points (line 29) | func (s Score) Points(w http.ResponseWriter, r *http.Request) {
function NewScore (line 40) | func NewScore(repository rel.Repository) Score {
FILE: api/handler/score_test.go
function TestScore_Index (line 14) | func TestScore_Index(t *testing.T) {
function TestScore_Points (line 55) | func TestScore_Points(t *testing.T) {
FILE: api/handler/todos.go
type ctx (line 18) | type ctx
constant bodyKey (line 21) | bodyKey ctx = 0
constant loadKey (line 22) | loadKey ctx = 1
type Todos (line 26) | type Todos struct
method Index (line 33) | func (t Todos) Index(w http.ResponseWriter, r *http.Request) {
method Create (line 53) | func (t Todos) Create(w http.ResponseWriter, r *http.Request) {
method Show (line 75) | func (t Todos) Show(w http.ResponseWriter, r *http.Request) {
method Update (line 85) | func (t Todos) Update(w http.ResponseWriter, r *http.Request) {
method Destroy (line 107) | func (t Todos) Destroy(w http.ResponseWriter, r *http.Request) {
method Clear (line 118) | func (t Todos) Clear(w http.ResponseWriter, r *http.Request) {
method Load (line 128) | func (t Todos) Load(next http.Handler) http.Handler {
function NewTodos (line 150) | func NewTodos(repository rel.Repository, todos todos.Service) Todos {
FILE: api/handler/todos_test.go
function TestTodos_Index (line 17) | func TestTodos_Index(t *testing.T) {
function TestTodos_Create (line 76) | func TestTodos_Create(t *testing.T) {
function TestTodos_Show (line 143) | func TestTodos_Show(t *testing.T) {
function TestTodos_Update (line 210) | func TestTodos_Update(t *testing.T) {
function TestTodos_Destroy (line 288) | func TestTodos_Destroy(t *testing.T) {
function TestTodos_Clear (line 336) | func TestTodos_Clear(t *testing.T) {
FILE: cmd/api/main.go
function main (line 25) | func main() {
function initRepository (line 48) | func initRepository() rel.Repository {
function gracefulShutdown (line 88) | func gracefulShutdown(ctx context.Context, server *http.Server, shutdown...
FILE: db/migrations/20202806225100_create_todos.go
function MigrateCreateTodos (line 8) | func MigrateCreateTodos(schema *rel.Schema) {
function RollbackCreateTodos (line 22) | func RollbackCreateTodos(schema *rel.Schema) {
FILE: db/migrations/20203006230600_create_scores.go
function MigrateCreateScores (line 8) | func MigrateCreateScores(schema *rel.Schema) {
function RollbackCreateScores (line 18) | func RollbackCreateScores(schema *rel.Schema) {
FILE: db/migrations/20203006230700_create_points.go
function MigrateCreatePoints (line 8) | func MigrateCreatePoints(schema *rel.Schema) {
function RollbackCreatePoints (line 22) | func RollbackCreatePoints(schema *rel.Schema) {
FILE: scores/earn.go
type earn (line 10) | type earn struct
method Earn (line 14) | func (e earn) Earn(ctx context.Context, name string, count int) error {
FILE: scores/earn_test.go
function TestEarn (line 12) | func TestEarn(t *testing.T) {
function TestEarn_insertScore (line 31) | func TestEarn_insertScore(t *testing.T) {
function TestEarn_findError (line 50) | func TestEarn_findError(t *testing.T) {
FILE: scores/point.go
type Point (line 8) | type Point struct
FILE: scores/score.go
type Score (line 8) | type Score struct
FILE: scores/scorestest/service.go
type Service (line 12) | type Service struct
method Earn (line 17) | func (_m *Service) Earn(ctx context.Context, name string, count int) e...
FILE: scores/service.go
type Service (line 13) | type Service interface
type service (line 19) | type service struct
function New (line 26) | func New(repository rel.Repository) Service {
FILE: todos/clear.go
type clear (line 9) | type clear struct
method Clear (line 13) | func (c clear) Clear(ctx context.Context) {
FILE: todos/clear_test.go
function TestClear (line 12) | func TestClear(t *testing.T) {
FILE: todos/create.go
type create (line 11) | type create struct
method Create (line 16) | func (c create) Create(ctx context.Context, todo *Todo) error {
FILE: todos/create_test.go
function TestCreate (line 13) | func TestCreate(t *testing.T) {
function TestCreate_completed (line 31) | func TestCreate_completed(t *testing.T) {
function TestCreate_validateError (line 52) | func TestCreate_validateError(t *testing.T) {
FILE: todos/delete.go
type delete (line 9) | type delete struct
method Delete (line 13) | func (d delete) Delete(ctx context.Context, todo *Todo) {
FILE: todos/delete_test.go
function TestDelete (line 11) | func TestDelete(t *testing.T) {
FILE: todos/search.go
type Filter (line 10) | type Filter struct
type search (line 15) | type search struct
method Search (line 19) | func (s search) Search(ctx context.Context, todos *[]Todo, filter Filt...
FILE: todos/search_test.go
function TestSearch (line 12) | func TestSearch(t *testing.T) {
FILE: todos/service.go
type Service (line 19) | type Service interface
type service (line 29) | type service struct
function New (line 40) | func New(repository rel.Repository, scores scores.Service) Service {
FILE: todos/todo.go
type Todo (line 19) | type Todo struct
method Validate (line 29) | func (t Todo) Validate() error {
method MarshalJSON (line 40) | func (t Todo) MarshalJSON() ([]byte, error) {
FILE: todos/todo_test.go
function init (line 10) | func init() {
function TestTodo_Validate (line 14) | func TestTodo_Validate(t *testing.T) {
function TestTodo_MarshalJSON (line 27) | func TestTodo_MarshalJSON(t *testing.T) {
FILE: todos/todostest/service.go
type Service (line 15) | type Service struct
method Clear (line 20) | func (_m *Service) Clear(ctx context.Context) {
method Create (line 25) | func (_m *Service) Create(ctx context.Context, todo *todos.Todo) error {
method Delete (line 39) | func (_m *Service) Delete(ctx context.Context, todo *todos.Todo) {
method Search (line 44) | func (_m *Service) Search(ctx context.Context, _a1 *[]todos.Todo, filt...
method Update (line 58) | func (_m *Service) Update(ctx context.Context, todo *todos.Todo, chang...
FILE: todos/todostest/todos.go
type MockFunc (line 12) | type MockFunc
function Mock (line 15) | func Mock(service *Service, funcs ...MockFunc) {
function MockSearch (line 24) | func MockSearch(result []todos.Todo, filter todos.Filter, err error) Moc...
function MockCreate (line 35) | func MockCreate(result todos.Todo, err error) MockFunc {
function MockUpdate (line 46) | func MockUpdate(result todos.Todo, err error) MockFunc {
function MockClear (line 61) | func MockClear() MockFunc {
function MockDelete (line 68) | func MockDelete() MockFunc {
FILE: todos/update.go
type update (line 11) | type update struct
method Update (line 16) | func (u update) Update(ctx context.Context, todo *Todo, changes rel.Ch...
FILE: todos/update_test.go
function TestUpdate (line 14) | func TestUpdate(t *testing.T) {
function TestUpdate_completed (line 35) | func TestUpdate_completed(t *testing.T) {
function TestUpdate_uncompleted (line 59) | func TestUpdate_uncompleted(t *testing.T) {
function TestUpdate_validateError (line 83) | func TestUpdate_validateError(t *testing.T) {
FILE: vendor/github.com/davecgh/go-spew/spew/bypass.go
constant UnsafeDisabled (line 33) | UnsafeDisabled = false
constant ptrSize (line 36) | ptrSize = unsafe.Sizeof((*byte)(nil))
type flag (line 39) | type flag
constant flagKindMask (line 54) | flagKindMask = flag(0x1f)
function flagField (line 80) | func flagField(v *reflect.Value) *flag {
function unsafeReflectValue (line 93) | func unsafeReflectValue(v reflect.Value) reflect.Value {
function init (line 105) | func init() {
FILE: vendor/github.com/davecgh/go-spew/spew/bypasssafe.go
constant UnsafeDisabled (line 28) | UnsafeDisabled = true
function unsafeReflectValue (line 36) | func unsafeReflectValue(v reflect.Value) reflect.Value {
FILE: vendor/github.com/davecgh/go-spew/spew/common.go
function catchPanic (line 72) | func catchPanic(w io.Writer, v reflect.Value) {
function handleMethods (line 85) | func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handl...
function printBool (line 144) | func printBool(w io.Writer, val bool) {
function printInt (line 153) | func printInt(w io.Writer, val int64, base int) {
function printUint (line 158) | func printUint(w io.Writer, val uint64, base int) {
function printFloat (line 164) | func printFloat(w io.Writer, val float64, precision int) {
function printComplex (line 170) | func printComplex(w io.Writer, c complex128, floatPrecision int) {
function printHexPtr (line 185) | func printHexPtr(w io.Writer, p uintptr) {
type valuesSorter (line 219) | type valuesSorter struct
method Len (line 279) | func (s *valuesSorter) Len() int {
method Swap (line 285) | func (s *valuesSorter) Swap(i, j int) {
method Less (line 326) | func (s *valuesSorter) Less(i, j int) bool {
function newValuesSorter (line 228) | func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Inter...
function canSortSimply (line 256) | func canSortSimply(kind reflect.Kind) bool {
function valueSortLess (line 295) | func valueSortLess(a, b reflect.Value) bool {
function sortValues (line 336) | func sortValues(values []reflect.Value, cs *ConfigState) {
FILE: vendor/github.com/davecgh/go-spew/spew/config.go
type ConfigState (line 37) | type ConfigState struct
method Errorf (line 115) | func (c *ConfigState) Errorf(format string, a ...interface{}) (err err...
method Fprint (line 127) | func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, er...
method Fprintf (line 139) | func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interfa...
method Fprintln (line 150) | func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, ...
method Print (line 162) | func (c *ConfigState) Print(a ...interface{}) (n int, err error) {
method Printf (line 174) | func (c *ConfigState) Printf(format string, a ...interface{}) (n int, ...
method Println (line 186) | func (c *ConfigState) Println(a ...interface{}) (n int, err error) {
method Sprint (line 197) | func (c *ConfigState) Sprint(a ...interface{}) string {
method Sprintf (line 208) | func (c *ConfigState) Sprintf(format string, a ...interface{}) string {
method Sprintln (line 219) | func (c *ConfigState) Sprintln(a ...interface{}) string {
method NewFormatter (line 240) | func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter {
method Fdump (line 246) | func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) {
method Dump (line 273) | func (c *ConfigState) Dump(a ...interface{}) {
method Sdump (line 279) | func (c *ConfigState) Sdump(a ...interface{}) string {
method convertArgs (line 288) | func (c *ConfigState) convertArgs(args []interface{}) (formatters []in...
function NewDefaultConfig (line 304) | func NewDefaultConfig() *ConfigState {
FILE: vendor/github.com/davecgh/go-spew/spew/dump.go
type dumpState (line 51) | type dumpState struct
method indent (line 62) | func (d *dumpState) indent() {
method unpackValue (line 73) | func (d *dumpState) unpackValue(v reflect.Value) reflect.Value {
method dumpPtr (line 81) | func (d *dumpState) dumpPtr(v reflect.Value) {
method dumpSlice (line 161) | func (d *dumpState) dumpSlice(v reflect.Value) {
method dump (line 251) | func (d *dumpState) dump(v reflect.Value) {
function fdump (line 453) | func fdump(cs *ConfigState, w io.Writer, a ...interface{}) {
function Fdump (line 472) | func Fdump(w io.Writer, a ...interface{}) {
function Sdump (line 478) | func Sdump(a ...interface{}) string {
function Dump (line 507) | func Dump(a ...interface{}) {
FILE: vendor/github.com/davecgh/go-spew/spew/format.go
constant supportedFlags (line 28) | supportedFlags = "0-+# "
type formatState (line 34) | type formatState struct
method buildDefaultFormat (line 47) | func (f *formatState) buildDefaultFormat() (format string) {
method constructOrigFormat (line 65) | func (f *formatState) constructOrigFormat(verb rune) (format string) {
method unpackValue (line 94) | func (f *formatState) unpackValue(v reflect.Value) reflect.Value {
method formatPtr (line 105) | func (f *formatState) formatPtr(v reflect.Value) {
method format (line 201) | func (f *formatState) format(v reflect.Value) {
method Format (line 371) | func (f *formatState) Format(fs fmt.State, verb rune) {
function newFormatter (line 394) | func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter {
function NewFormatter (line 417) | func NewFormatter(v interface{}) fmt.Formatter {
FILE: vendor/github.com/davecgh/go-spew/spew/spew.go
function Errorf (line 32) | func Errorf(format string, a ...interface{}) (err error) {
function Fprint (line 44) | func Fprint(w io.Writer, a ...interface{}) (n int, err error) {
function Fprintf (line 56) | func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err e...
function Fprintln (line 67) | func Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
function Print (line 79) | func Print(a ...interface{}) (n int, err error) {
function Printf (line 91) | func Printf(format string, a ...interface{}) (n int, err error) {
function Println (line 103) | func Println(a ...interface{}) (n int, err error) {
function Sprint (line 114) | func Sprint(a ...interface{}) string {
function Sprintf (line 125) | func Sprintf(format string, a ...interface{}) string {
function Sprintln (line 136) | func Sprintln(a ...interface{}) string {
function convertArgs (line 142) | func convertArgs(args []interface{}) (formatters []interface{}) {
FILE: vendor/github.com/go-chi/chi/chain.go
function Chain (line 6) | func Chain(middlewares ...func(http.Handler) http.Handler) Middlewares {
method Handler (line 12) | func (mws Middlewares) Handler(h http.Handler) http.Handler {
method HandlerFunc (line 18) | func (mws Middlewares) HandlerFunc(h http.HandlerFunc) http.Handler {
type ChainHandler (line 24) | type ChainHandler struct
method ServeHTTP (line 30) | func (c *ChainHandler) ServeHTTP(w http.ResponseWriter, r *http.Reques...
function chain (line 36) | func chain(middlewares []func(http.Handler) http.Handler, endpoint http....
FILE: vendor/github.com/go-chi/chi/chi.go
function NewRouter (line 61) | func NewRouter() *Mux {
type Router (line 67) | type Router interface
type Routes (line 119) | type Routes interface
type Middlewares (line 134) | type Middlewares
FILE: vendor/github.com/go-chi/chi/context.go
function URLParam (line 11) | func URLParam(r *http.Request, key string) string {
function URLParamFromCtx (line 19) | func URLParamFromCtx(ctx context.Context, key string) string {
function RouteContext (line 28) | func RouteContext(ctx context.Context) *Context {
function ServerBaseContext (line 35) | func ServerBaseContext(baseCtx context.Context, h http.Handler) http.Han...
function NewRouteContext (line 54) | func NewRouteContext() *Context {
type Context (line 66) | type Context struct
method Reset (line 98) | func (x *Context) Reset() {
method URLParam (line 114) | func (x *Context) URLParam(key string) string {
method RoutePattern (line 137) | func (x *Context) RoutePattern() string {
function replaceWildcards (line 144) | func replaceWildcards(p string) string {
type RouteParams (line 153) | type RouteParams struct
method Add (line 158) | func (s *RouteParams) Add(key, value string) {
type contextKey (line 166) | type contextKey struct
method String (line 170) | func (k *contextKey) String() string {
FILE: vendor/github.com/go-chi/chi/middleware/basic_auth.go
function BasicAuth (line 9) | func BasicAuth(realm string, creds map[string]string) func(next http.Han...
function basicAuthFailed (line 29) | func basicAuthFailed(w http.ResponseWriter, realm string) {
FILE: vendor/github.com/go-chi/chi/middleware/compress.go
function Compress (line 41) | func Compress(level int, types ...string) func(next http.Handler) http.H...
type Compressor (line 47) | type Compressor struct
method SetEncoder (line 148) | func (c *Compressor) SetEncoder(encoding string, fn EncoderFunc) {
method Handler (line 194) | func (c *Compressor) Handler(next http.Handler) http.Handler {
method selectEncoder (line 218) | func (c *Compressor) selectEncoder(h http.Header, w io.Writer) (io.Wri...
function NewCompressor (line 64) | func NewCompressor(level int, types ...string) *Compressor {
function matchAcceptEncoding (line 247) | func matchAcceptEncoding(accepted []string, encoding string) bool {
type EncoderFunc (line 260) | type EncoderFunc
type ioResetterWriter (line 263) | type ioResetterWriter interface
type compressResponseWriter (line 268) | type compressResponseWriter struct
method isCompressable (line 281) | func (cw *compressResponseWriter) isCompressable() bool {
method WriteHeader (line 300) | func (cw *compressResponseWriter) WriteHeader(code int) {
method Write (line 328) | func (cw *compressResponseWriter) Write(p []byte) (int, error) {
method writer (line 336) | func (cw *compressResponseWriter) writer() io.Writer {
method Flush (line 348) | func (cw *compressResponseWriter) Flush() {
method Hijack (line 364) | func (cw *compressResponseWriter) Hijack() (net.Conn, *bufio.ReadWrite...
method Push (line 371) | func (cw *compressResponseWriter) Push(target string, opts *http.PushO...
method Close (line 378) | func (cw *compressResponseWriter) Close() error {
type compressFlusher (line 344) | type compressFlusher interface
function encoderGzip (line 385) | func encoderGzip(w io.Writer, level int) io.Writer {
function encoderDeflate (line 393) | func encoderDeflate(w io.Writer, level int) io.Writer {
FILE: vendor/github.com/go-chi/chi/middleware/content_charset.go
function ContentCharset (line 10) | func ContentCharset(charsets ...string) func(next http.Handler) http.Han...
function contentEncoding (line 28) | func contentEncoding(ce string, charsets ...string) bool {
function split (line 42) | func split(str, sep string) (string, string) {
FILE: vendor/github.com/go-chi/chi/middleware/content_encoding.go
function AllowContentEncoding (line 10) | func AllowContentEncoding(contentEncoding ...string) func(next http.Hand...
FILE: vendor/github.com/go-chi/chi/middleware/content_type.go
function SetHeader (line 9) | func SetHeader(key, value string) func(next http.Handler) http.Handler {
function AllowContentType (line 21) | func AllowContentType(contentTypes ...string) func(next http.Handler) ht...
FILE: vendor/github.com/go-chi/chi/middleware/get_head.go
function GetHead (line 10) | func GetHead(next http.Handler) http.Handler {
FILE: vendor/github.com/go-chi/chi/middleware/heartbeat.go
function Heartbeat (line 12) | func Heartbeat(endpoint string) func(http.Handler) http.Handler {
FILE: vendor/github.com/go-chi/chi/middleware/logger.go
function Logger (line 30) | func Logger(next http.Handler) http.Handler {
function RequestLogger (line 35) | func RequestLogger(f LogFormatter) func(next http.Handler) http.Handler {
type LogFormatter (line 54) | type LogFormatter interface
type LogEntry (line 60) | type LogEntry interface
function GetLogEntry (line 66) | func GetLogEntry(r *http.Request) LogEntry {
function WithLogEntry (line 72) | func WithLogEntry(r *http.Request, entry LogEntry) *http.Request {
type LoggerInterface (line 78) | type LoggerInterface interface
type DefaultLogFormatter (line 83) | type DefaultLogFormatter struct
method NewLogEntry (line 89) | func (l *DefaultLogFormatter) NewLogEntry(r *http.Request) LogEntry {
type defaultLogEntry (line 118) | type defaultLogEntry struct
method Write (line 125) | func (l *defaultLogEntry) Write(status, bytes int, header http.Header,...
method Panic (line 153) | func (l *defaultLogEntry) Panic(v interface{}, stack []byte) {
FILE: vendor/github.com/go-chi/chi/middleware/middleware.go
function New (line 6) | func New(h http.Handler) func(next http.Handler) http.Handler {
type contextKey (line 17) | type contextKey struct
method String (line 21) | func (k *contextKey) String() string {
FILE: vendor/github.com/go-chi/chi/middleware/nocache.go
function NoCache (line 39) | func NoCache(h http.Handler) http.Handler {
FILE: vendor/github.com/go-chi/chi/middleware/profiler.go
function Profiler (line 21) | func Profiler() http.Handler {
function expVars (line 43) | func expVars(w http.ResponseWriter, r *http.Request) {
FILE: vendor/github.com/go-chi/chi/middleware/realip.go
function RealIP (line 29) | func RealIP(h http.Handler) http.Handler {
function realIP (line 40) | func realIP(r *http.Request) string {
FILE: vendor/github.com/go-chi/chi/middleware/recoverer.go
function Recoverer (line 21) | func Recoverer(next http.Handler) http.Handler {
function PrintPrettyStack (line 43) | func PrintPrettyStack(rvr interface{}) {
type prettyStack (line 55) | type prettyStack struct
method parse (line 58) | func (s prettyStack) parse(debugStack []byte, rvr interface{}) ([]byte...
method decorateLine (line 101) | func (s prettyStack) decorateLine(line string, useColor bool, num int)...
method decorateFuncCallLine (line 116) | func (s prettyStack) decorateFuncCallLine(line string, useColor bool, ...
method decorateSourceLine (line 155) | func (s prettyStack) decorateSourceLine(line string, useColor bool, nu...
FILE: vendor/github.com/go-chi/chi/middleware/request_id.go
type ctxKeyRequestID (line 18) | type ctxKeyRequestID
constant RequestIDKey (line 21) | RequestIDKey ctxKeyRequestID = 0
function init (line 46) | func init() {
function RequestID (line 67) | func RequestID(next http.Handler) http.Handler {
function GetReqID (line 83) | func GetReqID(ctx context.Context) string {
function NextRequestID (line 94) | func NextRequestID() uint64 {
FILE: vendor/github.com/go-chi/chi/middleware/route_headers.go
function RouteHeaders (line 47) | func RouteHeaders() HeaderRouter {
type HeaderRouter (line 51) | type HeaderRouter
method Route (line 53) | func (hr HeaderRouter) Route(header string, match string, middlewareHa...
method RouteAny (line 63) | func (hr HeaderRouter) RouteAny(header string, match []string, middlew...
method RouteDefault (line 77) | func (hr HeaderRouter) RouteDefault(handler func(next http.Handler) ht...
method Handler (line 82) | func (hr HeaderRouter) Handler(next http.Handler) http.Handler {
type HeaderRoute (line 114) | type HeaderRoute struct
method IsMatch (line 120) | func (r HeaderRoute) IsMatch(value string) bool {
type Pattern (line 133) | type Pattern struct
method Match (line 151) | func (p Pattern) Match(v string) bool {
function NewPattern (line 139) | func NewPattern(value string) Pattern {
FILE: vendor/github.com/go-chi/chi/middleware/strip.go
function StripSlashes (line 13) | func StripSlashes(next http.Handler) http.Handler {
function RedirectSlashes (line 35) | func RedirectSlashes(next http.Handler) http.Handler {
FILE: vendor/github.com/go-chi/chi/middleware/terminal.go
function init (line 37) | func init() {
function cW (line 55) | func cW(w io.Writer, useColor bool, color []byte, s string, args ...inte...
FILE: vendor/github.com/go-chi/chi/middleware/throttle.go
constant errCapacityExceeded (line 10) | errCapacityExceeded = "Server capacity exceeded."
constant errTimedOut (line 11) | errTimedOut = "Timed out while waiting for a pending request to ...
constant errContextCanceled (line 12) | errContextCanceled = "Context was canceled."
type ThrottleOpts (line 20) | type ThrottleOpts struct
function Throttle (line 31) | func Throttle(limit int) func(http.Handler) http.Handler {
function ThrottleBacklog (line 38) | func ThrottleBacklog(limit int, backlogLimit int, backlogTimeout time.Du...
function ThrottleWithOpts (line 43) | func ThrottleWithOpts(opts ThrottleOpts) func(http.Handler) http.Handler {
type token (line 116) | type token struct
type throttler (line 119) | type throttler struct
method setRetryAfterHeaderIfNeeded (line 127) | func (t throttler) setRetryAfterHeaderIfNeeded(w http.ResponseWriter, ...
FILE: vendor/github.com/go-chi/chi/middleware/timeout.go
function Timeout (line 33) | func Timeout(timeout time.Duration) func(next http.Handler) http.Handler {
FILE: vendor/github.com/go-chi/chi/middleware/url_format.go
function URLFormat (line 47) | func URLFormat(next http.Handler) http.Handler {
FILE: vendor/github.com/go-chi/chi/middleware/value.go
function WithValue (line 9) | func WithValue(key interface{}, val interface{}) func(next http.Handler)...
FILE: vendor/github.com/go-chi/chi/middleware/wrap_writer.go
function NewWrapResponseWriter (line 15) | func NewWrapResponseWriter(w http.ResponseWriter, protoMajor int) WrapRe...
type WrapResponseWriter (line 41) | type WrapResponseWriter interface
type basicWriter (line 61) | type basicWriter struct
method WriteHeader (line 69) | func (b *basicWriter) WriteHeader(code int) {
method Write (line 77) | func (b *basicWriter) Write(buf []byte) (int, error) {
method maybeWriteHeader (line 91) | func (b *basicWriter) maybeWriteHeader() {
method Status (line 97) | func (b *basicWriter) Status() int {
method BytesWritten (line 101) | func (b *basicWriter) BytesWritten() int {
method Tee (line 105) | func (b *basicWriter) Tee(w io.Writer) {
method Unwrap (line 109) | func (b *basicWriter) Unwrap() http.ResponseWriter {
type flushWriter (line 113) | type flushWriter struct
method Flush (line 117) | func (f *flushWriter) Flush() {
type httpFancyWriter (line 129) | type httpFancyWriter struct
method Flush (line 133) | func (f *httpFancyWriter) Flush() {
method Hijack (line 139) | func (f *httpFancyWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
method ReadFrom (line 148) | func (f *httpFancyWriter) ReadFrom(r io.Reader) (int64, error) {
type http2FancyWriter (line 170) | type http2FancyWriter struct
method Push (line 144) | func (f *http2FancyWriter) Push(target string, opts *http.PushOptions)...
method Flush (line 174) | func (f *http2FancyWriter) Flush() {
FILE: vendor/github.com/go-chi/chi/mux.go
type Mux (line 21) | type Mux struct
method ServeHTTP (line 60) | func (mx *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
method Use (line 96) | func (mx *Mux) Use(middlewares ...func(http.Handler) http.Handler) {
method Handle (line 105) | func (mx *Mux) Handle(pattern string, handler http.Handler) {
method HandleFunc (line 111) | func (mx *Mux) HandleFunc(pattern string, handlerFn http.HandlerFunc) {
method Method (line 117) | func (mx *Mux) Method(method, pattern string, handler http.Handler) {
method MethodFunc (line 127) | func (mx *Mux) MethodFunc(method, pattern string, handlerFn http.Handl...
method Connect (line 133) | func (mx *Mux) Connect(pattern string, handlerFn http.HandlerFunc) {
method Delete (line 139) | func (mx *Mux) Delete(pattern string, handlerFn http.HandlerFunc) {
method Get (line 145) | func (mx *Mux) Get(pattern string, handlerFn http.HandlerFunc) {
method Head (line 151) | func (mx *Mux) Head(pattern string, handlerFn http.HandlerFunc) {
method Options (line 157) | func (mx *Mux) Options(pattern string, handlerFn http.HandlerFunc) {
method Patch (line 163) | func (mx *Mux) Patch(pattern string, handlerFn http.HandlerFunc) {
method Post (line 169) | func (mx *Mux) Post(pattern string, handlerFn http.HandlerFunc) {
method Put (line 175) | func (mx *Mux) Put(pattern string, handlerFn http.HandlerFunc) {
method Trace (line 181) | func (mx *Mux) Trace(pattern string, handlerFn http.HandlerFunc) {
method NotFound (line 187) | func (mx *Mux) NotFound(handlerFn http.HandlerFunc) {
method MethodNotAllowed (line 207) | func (mx *Mux) MethodNotAllowed(handlerFn http.HandlerFunc) {
method With (line 226) | func (mx *Mux) With(middlewares ...func(http.Handler) http.Handler) Ro...
method Group (line 252) | func (mx *Mux) Group(fn func(r Router)) Router {
method Route (line 263) | func (mx *Mux) Route(pattern string, fn func(r Router)) Router {
method Mount (line 279) | func (mx *Mux) Mount(pattern string, handler http.Handler) {
method Routes (line 321) | func (mx *Mux) Routes() []Route {
method Middlewares (line 326) | func (mx *Mux) Middlewares() Middlewares {
method Match (line 336) | func (mx *Mux) Match(rctx *Context, method, path string) bool {
method NotFoundHandler (line 354) | func (mx *Mux) NotFoundHandler() http.HandlerFunc {
method MethodNotAllowedHandler (line 363) | func (mx *Mux) MethodNotAllowedHandler() http.HandlerFunc {
method buildRouteHandler (line 374) | func (mx *Mux) buildRouteHandler() {
method handle (line 380) | func (mx *Mux) handle(method methodTyp, pattern string, handler http.H...
method routeHTTP (line 405) | func (mx *Mux) routeHTTP(w http.ResponseWriter, r *http.Request) {
method nextRoutePath (line 441) | func (mx *Mux) nextRoutePath(rctx *Context) string {
method updateSubRoutes (line 451) | func (mx *Mux) updateSubRoutes(fn func(subMux *Mux)) {
function NewMux (line 49) | func NewMux() *Mux {
function methodNotAllowedHandler (line 463) | func methodNotAllowedHandler(w http.ResponseWriter, r *http.Request) {
FILE: vendor/github.com/go-chi/chi/tree.go
type methodTyp (line 17) | type methodTyp
constant mSTUB (line 20) | mSTUB methodTyp = 1 << iota
constant mCONNECT (line 21) | mCONNECT
constant mDELETE (line 22) | mDELETE
constant mGET (line 23) | mGET
constant mHEAD (line 24) | mHEAD
constant mOPTIONS (line 25) | mOPTIONS
constant mPATCH (line 26) | mPATCH
constant mPOST (line 27) | mPOST
constant mPUT (line 28) | mPUT
constant mTRACE (line 29) | mTRACE
function RegisterMethod (line 49) | func RegisterMethod(method string) {
type nodeTyp (line 66) | type nodeTyp
constant ntStatic (line 69) | ntStatic nodeTyp = iota
constant ntRegexp (line 70) | ntRegexp
constant ntParam (line 71) | ntParam
constant ntCatchAll (line 72) | ntCatchAll
type node (line 75) | type node struct
method InsertRoute (line 126) | func (n *node) InsertRoute(method methodTyp, pattern string, handler h...
method addChild (line 222) | func (n *node) addChild(child *node, prefix string) *node {
method replaceChild (line 306) | func (n *node) replaceChild(label, tail byte, child *node) {
method getEdge (line 318) | func (n *node) getEdge(ntyp nodeTyp, label, tail byte, prefix string) ...
method setEndpoint (line 331) | func (n *node) setEndpoint(method methodTyp, handler http.Handler, pat...
method FindRoute (line 361) | func (n *node) FindRoute(rctx *Context, method methodTyp, path string)...
method findRoute (line 388) | func (n *node) findRoute(rctx *Context, method methodTyp, path string)...
method findEdge (line 519) | func (n *node) findEdge(ntyp nodeTyp, label byte) *node {
method isLeaf (line 547) | func (n *node) isLeaf() bool {
method findPattern (line 551) | func (n *node) findPattern(pattern string) bool {
method routes (line 593) | func (n *node) routes() []Route {
method walk (line 643) | func (n *node) walk(fn func(eps endpoints, subroutes Routes) bool) bool {
type endpoints (line 104) | type endpoints
method Value (line 117) | func (s endpoints) Value(method methodTyp) *endpoint {
type endpoint (line 106) | type endpoint struct
function patNextSegment (line 662) | func patNextSegment(pattern string) (nodeTyp, string, string, byte, int,...
function patParamKeys (line 732) | func patParamKeys(pattern string) []string {
function longestPrefix (line 752) | func longestPrefix(k1, k2 string) int {
function methodTypString (line 766) | func methodTypString(method methodTyp) string {
type nodes (line 775) | type nodes
method Sort (line 778) | func (ns nodes) Sort() { sort.Sort(ns); ns.tailSort() }
method Len (line 779) | func (ns nodes) Len() int { return len(ns) }
method Swap (line 780) | func (ns nodes) Swap(i, j int) { ns[i], ns[j] = ns[j], ns[i] }
method Less (line 781) | func (ns nodes) Less(i, j int) bool { return ns[i].label < ns[j].label }
method tailSort (line 785) | func (ns nodes) tailSort() {
method findEdge (line 794) | func (ns nodes) findEdge(label byte) *node {
type Route (line 816) | type Route struct
type WalkFunc (line 823) | type WalkFunc
function Walk (line 826) | func Walk(r Routes, walkFn WalkFunc) error {
function walk (line 830) | func walk(r Routes, walkFn WalkFunc, parentRoute string, parentMw ...fun...
FILE: vendor/github.com/goware/cors/cors.go
type Options (line 30) | type Options struct
type Logger (line 75) | type Logger interface
type Cors (line 80) | type Cors struct
method Handler (line 211) | func (c *Cors) Handler(next http.Handler) http.Handler {
method handlePreflight (line 234) | func (c *Cors) handlePreflight(w http.ResponseWriter, r *http.Request) {
method handleActualRequest (line 292) | func (c *Cors) handleActualRequest(w http.ResponseWriter, r *http.Requ...
method logf (line 331) | func (c *Cors) logf(format string, a ...interface{}) {
method isOriginAllowed (line 339) | func (c *Cors) isOriginAllowed(r *http.Request, origin string) bool {
method isMethodAllowed (line 362) | func (c *Cors) isMethodAllowed(method string) bool {
method areHeadersAllowed (line 382) | func (c *Cors) areHeadersAllowed(requestedHeaders []string) bool {
function New (line 114) | func New(options Options) *Cors {
function Handler (line 186) | func Handler(options Options) func(next http.Handler) http.Handler {
function AllowAll (line 193) | func AllowAll() *Cors {
FILE: vendor/github.com/goware/cors/utils.go
constant toLower (line 5) | toLower = 'a' - 'A'
type converter (line 7) | type converter
type wildcard (line 9) | type wildcard struct
method match (line 14) | func (w wildcard) match(s string) bool {
function convert (line 19) | func convert(s []string, c converter) []string {
function parseHeaderList (line 28) | func parseHeaderList(headerList string) []string {
FILE: vendor/github.com/jinzhu/inflection/inflections.go
type inflection (line 31) | type inflection struct
type Regular (line 37) | type Regular struct
type Irregular (line 44) | type Irregular struct
type RegularSlice (line 50) | type RegularSlice
type IrregularSlice (line 53) | type IrregularSlice
function compile (line 124) | func compile() {
function init (line 175) | func init() {
function AddPlural (line 180) | func AddPlural(find, replace string) {
function AddSingular (line 186) | func AddSingular(find, replace string) {
function AddIrregular (line 192) | func AddIrregular(singular, plural string) {
function AddUncountable (line 198) | func AddUncountable(values ...string) {
function GetPlural (line 204) | func GetPlural() RegularSlice {
function GetSingular (line 211) | func GetSingular() RegularSlice {
function GetIrregular (line 218) | func GetIrregular() IrregularSlice {
function GetUncountable (line 225) | func GetUncountable() []string {
function SetPlural (line 232) | func SetPlural(inflections RegularSlice) {
function SetSingular (line 238) | func SetSingular(inflections RegularSlice) {
function SetIrregular (line 244) | func SetIrregular(inflections IrregularSlice) {
function SetUncountable (line 250) | func SetUncountable(inflections []string) {
function Plural (line 256) | func Plural(str string) string {
function Singular (line 266) | func Singular(str string) string {
FILE: vendor/github.com/lib/pq/array.go
function Array (line 29) | func Array(a interface{}) interface {
type ArrayDelimiter (line 70) | type ArrayDelimiter interface
type BoolArray (line 76) | type BoolArray
method Scan (line 79) | func (a *BoolArray) Scan(src interface{}) error {
method scanBytes (line 93) | func (a *BoolArray) scanBytes(src []byte) error {
method Value (line 121) | func (a BoolArray) Value() (driver.Value, error) {
type ByteaArray (line 150) | type ByteaArray
method Scan (line 153) | func (a *ByteaArray) Scan(src interface{}) error {
method scanBytes (line 167) | func (a *ByteaArray) scanBytes(src []byte) error {
method Value (line 189) | func (a ByteaArray) Value() (driver.Value, error) {
type Float64Array (line 222) | type Float64Array
method Scan (line 225) | func (a *Float64Array) Scan(src interface{}) error {
method scanBytes (line 239) | func (a *Float64Array) scanBytes(src []byte) error {
method Value (line 259) | func (a Float64Array) Value() (driver.Value, error) {
type Float32Array (line 284) | type Float32Array
method Scan (line 287) | func (a *Float32Array) Scan(src interface{}) error {
method scanBytes (line 301) | func (a *Float32Array) scanBytes(src []byte) error {
method Value (line 323) | func (a Float32Array) Value() (driver.Value, error) {
type GenericArray (line 348) | type GenericArray struct
method evaluateDestination (line 350) | func (GenericArray) evaluateDestination(rt reflect.Type) (reflect.Type...
method Scan (line 386) | func (a GenericArray) Scan(src interface{}) error {
method scanBytes (line 418) | func (a GenericArray) scanBytes(src []byte, dv reflect.Value) error {
method Value (line 472) | func (a GenericArray) Value() (driver.Value, error) {
type Int64Array (line 502) | type Int64Array
method Scan (line 505) | func (a *Int64Array) Scan(src interface{}) error {
method scanBytes (line 519) | func (a *Int64Array) scanBytes(src []byte) error {
method Value (line 539) | func (a Int64Array) Value() (driver.Value, error) {
type Int32Array (line 563) | type Int32Array
method Scan (line 566) | func (a *Int32Array) Scan(src interface{}) error {
method scanBytes (line 580) | func (a *Int32Array) scanBytes(src []byte) error {
method Value (line 602) | func (a Int32Array) Value() (driver.Value, error) {
type StringArray (line 626) | type StringArray
method Scan (line 629) | func (a *StringArray) Scan(src interface{}) error {
method scanBytes (line 643) | func (a *StringArray) scanBytes(src []byte) error {
method Value (line 663) | func (a StringArray) Value() (driver.Value, error) {
function appendArray (line 690) | func appendArray(b []byte, rv reflect.Value, n int) ([]byte, string, err...
function appendArrayElement (line 718) | func appendArrayElement(b []byte, rv reflect.Value) ([]byte, string, err...
function appendArrayQuotedBytes (line 754) | func appendArrayQuotedBytes(b, v []byte) []byte {
function appendValue (line 771) | func appendValue(b []byte, v driver.Value) ([]byte, error) {
function parseArray (line 781) | func parseArray(src, del []byte) (dims []int, elems [][]byte, err error) {
function scanLinearArray (line 886) | func scanLinearArray(src, del []byte, typ string) (elems [][]byte, err e...
FILE: vendor/github.com/lib/pq/buf.go
type readBuf (line 10) | type readBuf
method int32 (line 12) | func (b *readBuf) int32() (n int) {
method oid (line 18) | func (b *readBuf) oid() (n oid.Oid) {
method int16 (line 25) | func (b *readBuf) int16() (n int) {
method string (line 31) | func (b *readBuf) string() string {
method next (line 41) | func (b *readBuf) next(n int) (v []byte) {
method byte (line 47) | func (b *readBuf) byte() byte {
type writeBuf (line 51) | type writeBuf struct
method int32 (line 56) | func (b *writeBuf) int32(n int) {
method int16 (line 62) | func (b *writeBuf) int16(n int) {
method string (line 68) | func (b *writeBuf) string(s string) {
method byte (line 72) | func (b *writeBuf) byte(c byte) {
method bytes (line 76) | func (b *writeBuf) bytes(v []byte) {
method wrap (line 80) | func (b *writeBuf) wrap() []byte {
method next (line 86) | func (b *writeBuf) next(c byte) {
FILE: vendor/github.com/lib/pq/conn.go
type Driver (line 51) | type Driver struct
method Open (line 56) | func (d Driver) Open(name string) (driver.Conn, error) {
function init (line 60) | func init() {
type parameterStatus (line 64) | type parameterStatus struct
type transactionStatus (line 74) | type transactionStatus
method String (line 82) | func (s transactionStatus) String() string {
constant txnStatusIdle (line 77) | txnStatusIdle transactionStatus = 'I'
constant txnStatusIdleInTransaction (line 78) | txnStatusIdleInTransaction transactionStatus = 'T'
constant txnStatusInFailedTransaction (line 79) | txnStatusInFailedTransaction transactionStatus = 'E'
type Dialer (line 99) | type Dialer interface
type DialerContext (line 105) | type DialerContext interface
type defaultDialer (line 109) | type defaultDialer struct
method Dial (line 113) | func (d defaultDialer) Dial(network, address string) (net.Conn, error) {
method DialTimeout (line 116) | func (d defaultDialer) DialTimeout(
method DialContext (line 123) | func (d defaultDialer) DialContext(ctx context.Context, network, addre...
type conn (line 127) | type conn struct
method handleDriverSettings (line 210) | func (cn *conn) handleDriverSettings(o values) (err error) {
method handlePgpass (line 231) | func (cn *conn) handlePgpass(o values) {
method writeBuf (line 318) | func (cn *conn) writeBuf(b byte) *writeBuf {
method isInTransaction (line 560) | func (cn *conn) isInTransaction() bool {
method checkIsInTransaction (line 565) | func (cn *conn) checkIsInTransaction(intxn bool) {
method Begin (line 572) | func (cn *conn) Begin() (_ driver.Tx, err error) {
method begin (line 576) | func (cn *conn) begin(mode string) (_ driver.Tx, err error) {
method closeTxn (line 598) | func (cn *conn) closeTxn() {
method Commit (line 604) | func (cn *conn) Commit() (err error) {
method Rollback (line 640) | func (cn *conn) Rollback() (err error) {
method rollback (line 649) | func (cn *conn) rollback() (err error) {
method gname (line 665) | func (cn *conn) gname() string {
method simpleExec (line 670) | func (cn *conn) simpleExec(q string) (res driver.Result, commandTag st...
method simpleQuery (line 700) | func (cn *conn) simpleQuery(q string) (res *rows, err error) {
method prepareTo (line 830) | func (cn *conn) prepareTo(q, stmtName string) *stmt {
method Prepare (line 852) | func (cn *conn) Prepare(q string) (_ driver.Stmt, err error) {
method Close (line 868) | func (cn *conn) Close() (err error) {
method Query (line 887) | func (cn *conn) Query(query string, args []driver.Value) (driver.Rows,...
method query (line 891) | func (cn *conn) query(query string, args []driver.Value) (_ *rows, err...
method Exec (line 925) | func (cn *conn) Exec(query string, args []driver.Value) (res driver.Re...
method send (line 968) | func (cn *conn) send(m *writeBuf) {
method sendStartupPacket (line 978) | func (cn *conn) sendStartupPacket(m *writeBuf) error {
method sendSimpleMessage (line 986) | func (cn *conn) sendSimpleMessage(typ byte) (err error) {
method saveMessage (line 996) | func (cn *conn) saveMessage(typ byte, buf *readBuf) {
method recvMessage (line 1007) | func (cn *conn) recvMessage(r *readBuf) (byte, error) {
method recv (line 1044) | func (cn *conn) recv() (t byte, r *readBuf) {
method recv1Buf (line 1071) | func (cn *conn) recv1Buf(r *readBuf) byte {
method recv1 (line 1098) | func (cn *conn) recv1() (t byte, r *readBuf) {
method ssl (line 1104) | func (cn *conn) ssl(o values) error {
method startup (line 1163) | func (cn *conn) startup(o values) {
method auth (line 1206) | func (cn *conn) auth(r *readBuf, o values) {
method parseComplete (line 1475) | func (cn *conn) parseComplete(commandTag string) (driver.Result, strin...
method sendBinaryParameters (line 1715) | func (cn *conn) sendBinaryParameters(b *writeBuf, args []driver.Value) {
method sendBinaryModeQuery (line 1750) | func (cn *conn) sendBinaryModeQuery(query string, args []driver.Value) {
method processParameterStatus (line 1777) | func (cn *conn) processParameterStatus(r *readBuf) {
method processReadyForQuery (line 1801) | func (cn *conn) processReadyForQuery(r *readBuf) {
method readReadyForQuery (line 1805) | func (cn *conn) readReadyForQuery() {
method processBackendKeyData (line 1817) | func (cn *conn) processBackendKeyData(r *readBuf) {
method readParseResponse (line 1822) | func (cn *conn) readParseResponse() {
method readStatementDescribeResponse (line 1837) | func (cn *conn) readStatementDescribeResponse() (
method readPortalDescribeResponse (line 1867) | func (cn *conn) readPortalDescribeResponse() rowsHeader {
method readBindResponse (line 1885) | func (cn *conn) readBindResponse() {
method postExecuteWorkaround (line 1900) | func (cn *conn) postExecuteWorkaround() {
method readExecuteResponse (line 1929) | func (cn *conn) readExecuteResponse(
method ResetSession (line 2103) | func (cn *conn) ResetSession(ctx context.Context) error {
method IsValid (line 2110) | func (cn *conn) IsValid() bool {
type syncErr (line 175) | type syncErr struct
method get (line 181) | func (e *syncErr) get() error {
method getForNext (line 191) | func (e *syncErr) getForNext() error {
method set (line 198) | func (e *syncErr) set(err error) {
function getFields (line 275) | func getFields(s string) []string {
function scanText (line 298) | func scanText(line string, o values) bool {
function Open (line 329) | func Open(dsn string) (_ driver.Conn, err error) {
function DialOpen (line 334) | func DialOpen(d Dialer, dsn string) (_ driver.Conn, err error) {
method open (line 343) | func (c *Connector) open(ctx context.Context) (cn *conn, err error) {
function dial (line 400) | func dial(ctx context.Context, d Dialer, o values) (net.Conn, error) {
function network (line 436) | func network(o values) (string, string) {
type values (line 447) | type values
type scanner (line 450) | type scanner struct
method Next (line 462) | func (s *scanner) Next() (rune, bool) {
method SkipSpaces (line 473) | func (s *scanner) SkipSpaces() (rune, bool) {
function newScanner (line 456) | func newScanner(s string) *scanner {
function parseOpts (line 484) | func parseOpts(name string, o values) error {
type noRows (line 764) | type noRows struct
method LastInsertId (line 770) | func (noRows) LastInsertId() (int64, error) {
method RowsAffected (line 774) | func (noRows) RowsAffected() (int64, error) {
function decideColumnFormats (line 780) | func decideColumnFormats(
type safeRetryError (line 960) | type safeRetryError struct
method Error (line 964) | func (se *safeRetryError) Error() string {
function isDriverSetting (line 1138) | func isDriverSetting(key string) bool {
type format (line 1344) | type format
constant formatText (line 1346) | formatText format = 0
constant formatBinary (line 1347) | formatBinary format = 1
type stmt (line 1355) | type stmt struct
method Close (line 1364) | func (st *stmt) Close() (err error) {
method Query (line 1397) | func (st *stmt) Query(v []driver.Value) (r driver.Rows, err error) {
method query (line 1401) | func (st *stmt) query(v []driver.Value) (r *rows, err error) {
method Exec (line 1414) | func (st *stmt) Exec(v []driver.Value) (res driver.Result, err error) {
method exec (line 1425) | func (st *stmt) exec(v []driver.Value) {
method NumInput (line 1467) | func (st *stmt) NumInput() int {
type rowsHeader (line 1520) | type rowsHeader struct
type rows (line 1526) | type rows struct
method Close (line 1538) | func (rs *rows) Close() error {
method Columns (line 1560) | func (rs *rows) Columns() []string {
method Result (line 1564) | func (rs *rows) Result() driver.Result {
method Tag (line 1571) | func (rs *rows) Tag() string {
method Next (line 1575) | func (rs *rows) Next(dest []driver.Value) (err error) {
method HasNextResultSet (line 1631) | func (rs *rows) HasNextResultSet() bool {
method NextResultSet (line 1636) | func (rs *rows) NextResultSet() error {
function QuoteIdentifier (line 1656) | func QuoteIdentifier(name string) string {
function BufferQuoteIdentifier (line 1666) | func BufferQuoteIdentifier(name string, buffer *bytes.Buffer) {
function QuoteLiteral (line 1686) | func QuoteLiteral(literal string) string {
function md5s (line 1709) | func md5s(s string) string {
function parseStatementRowDescribe (line 1965) | func parseStatementRowDescribe(r *readBuf) (colNames []string, colTyps [...
function parsePortalRowDescribe (line 1981) | func parsePortalRowDescribe(r *readBuf) rowsHeader {
function parseEnviron (line 2009) | func parseEnviron(env []string) (out map[string]string) {
function isUTF8 (line 2082) | func isUTF8(name string) bool {
function alnumLowerASCII (line 2088) | func alnumLowerASCII(ch rune) rune {
FILE: vendor/github.com/lib/pq/conn_go18.go
constant watchCancelDialContextTimeout (line 14) | watchCancelDialContextTimeout = time.Second * 10
method QueryContext (line 18) | func (cn *conn) QueryContext(ctx context.Context, query string, args []d...
method ExecContext (line 36) | func (cn *conn) ExecContext(ctx context.Context, query string, args []dr...
method PrepareContext (line 50) | func (cn *conn) PrepareContext(ctx context.Context, query string) (drive...
method BeginTx (line 58) | func (cn *conn) BeginTx(ctx context.Context, opts driver.TxOptions) (dri...
method Ping (line 90) | func (cn *conn) Ping(ctx context.Context) error {
method watchCancel (line 102) | func (cn *conn) watchCancel(ctx context.Context) func() {
method cancel (line 142) | func (cn *conn) cancel(ctx context.Context) error {
method QueryContext (line 185) | func (st *stmt) QueryContext(ctx context.Context, args []driver.NamedVal...
method ExecContext (line 203) | func (st *stmt) ExecContext(ctx context.Context, args []driver.NamedValu...
method watchCancel (line 217) | func (st *stmt) watchCancel(ctx context.Context) func() {
method cancel (line 245) | func (st *stmt) cancel(ctx context.Context) error {
FILE: vendor/github.com/lib/pq/connector.go
type Connector (line 19) | type Connector struct
method Connect (line 26) | func (c *Connector) Connect(ctx context.Context) (driver.Conn, error) {
method Dialer (line 31) | func (c *Connector) Dialer(dialer Dialer) {
method Driver (line 36) | func (c *Connector) Driver() driver.Driver {
function NewConnector (line 47) | func NewConnector(dsn string) (*Connector, error) {
FILE: vendor/github.com/lib/pq/copy.go
function CopyIn (line 23) | func CopyIn(table string, columns ...string) string {
function makeStmt (line 32) | func makeStmt(buffer *bytes.Buffer, columns ...string) {
function CopyInSchema (line 45) | func CopyInSchema(schema, table string, columns ...string) string {
type copyin (line 55) | type copyin struct
method flush (line 142) | func (ci *copyin) flush(buf []byte) {
method resploop (line 152) | func (ci *copyin) resploop() {
method setBad (line 187) | func (ci *copyin) setBad(err error) {
method getBad (line 191) | func (ci *copyin) getBad() error {
method err (line 195) | func (ci *copyin) err() error {
method setError (line 204) | func (ci *copyin) setError(err error) {
method setResult (line 212) | func (ci *copyin) setResult(result driver.Result) {
method getResult (line 218) | func (ci *copyin) getResult() driver.Result {
method NumInput (line 228) | func (ci *copyin) NumInput() int {
method Query (line 232) | func (ci *copyin) Query(v []driver.Value) (r driver.Rows, err error) {
method Exec (line 243) | func (ci *copyin) Exec(v []driver.Value) (r driver.Result, err error) {
method CopyData (line 291) | func (ci *copyin) CopyData(ctx context.Context, line string) (r driver...
method Close (line 321) | func (ci *copyin) Close() (err error) {
constant ciBufferSize (line 70) | ciBufferSize = 64 * 1024
constant ciBufferFlushSize (line 73) | ciBufferFlushSize = 63 * 1024
method prepareCopyIn (line 75) | func (cn *conn) prepareCopyIn(q string) (_ driver.Stmt, err error) {
FILE: vendor/github.com/lib/pq/encode.go
function binaryEncode (line 22) | func binaryEncode(parameterStatus *parameterStatus, x interface{}) []byte {
function encode (line 31) | func encode(parameterStatus *parameterStatus, x interface{}, pgtypOid oi...
function decode (line 61) | func decode(parameterStatus *parameterStatus, s []byte, typ oid.Oid, f f...
function binaryDecode (line 72) | func binaryDecode(parameterStatus *parameterStatus, s []byte, typ oid.Oi...
function textDecode (line 96) | func textDecode(parameterStatus *parameterStatus, s []byte, typ oid.Oid)...
function appendEncodedText (line 138) | func appendEncodedText(parameterStatus *parameterStatus, buf []byte, x i...
function appendEscapedText (line 162) | func appendEscapedText(buf []byte, text string) []byte {
function mustParse (line 200) | func mustParse(f string, typ oid.Oid, s []byte) time.Time {
type timestampParser (line 240) | type timestampParser struct
method expect (line 244) | func (p *timestampParser) expect(str string, char byte, pos int) {
method mustAtoi (line 257) | func (p *timestampParser) mustAtoi(str string, begin int, end int) int {
type locationCache (line 276) | type locationCache struct
method getLocation (line 293) | func (c *locationCache) getLocation(offset int) *time.Location {
function newLocationCache (line 287) | func newLocationCache() *locationCache {
constant infinityTsEnabledAlready (line 311) | infinityTsEnabledAlready = "pq: infinity timestamp enabled already"
constant infinityTsNegativeMustBeSmaller (line 312) | infinityTsNegativeMustBeSmaller = "pq: infinity timestamp: negative valu...
function EnableInfinityTs (line 335) | func EnableInfinityTs(negative time.Time, positive time.Time) {
function disableInfinityTs (line 350) | func disableInfinityTs() {
function parseTs (line 358) | func parseTs(currentLocation *time.Location, str string) interface{} {
function ParseTimestamp (line 382) | func ParseTimestamp(currentLocation *time.Location, str string) (time.Ti...
function formatTs (line 492) | func formatTs(t time.Time) []byte {
function FormatTimestamp (line 507) | func FormatTimestamp(t time.Time) []byte {
function parseBytea (line 542) | func parseBytea(s []byte) (result []byte, err error) {
function encodeBytea (line 589) | func encodeBytea(serverVersion int, v []byte) (result []byte) {
type NullTime (line 615) | type NullTime struct
method Scan (line 621) | func (nt *NullTime) Scan(value interface{}) error {
method Value (line 627) | func (nt NullTime) Value() (driver.Value, error) {
FILE: vendor/github.com/lib/pq/error.go
constant Efatal (line 13) | Efatal = "FATAL"
constant Epanic (line 14) | Epanic = "PANIC"
constant Ewarning (line 15) | Ewarning = "WARNING"
constant Enotice (line 16) | Enotice = "NOTICE"
constant Edebug (line 17) | Edebug = "DEBUG"
constant Einfo (line 18) | Einfo = "INFO"
constant Elog (line 19) | Elog = "LOG"
type Error (line 25) | type Error struct
method Fatal (line 401) | func (err *Error) Fatal() bool {
method SQLState (line 406) | func (err *Error) SQLState() string {
method Get (line 412) | func (err *Error) Get(k byte) (v string) {
method Error (line 452) | func (err *Error) Error() string {
type ErrorCode (line 46) | type ErrorCode
method Name (line 53) | func (ec ErrorCode) Name() string {
method Class (line 71) | func (ec ErrorCode) Class() ErrorClass {
type ErrorClass (line 58) | type ErrorClass
method Name (line 63) | func (ec ErrorClass) Name() string {
function parseError (line 356) | func parseError(r *readBuf) *Error {
type PGError (line 458) | type PGError interface
function errorf (line 464) | func errorf(s string, args ...interface{}) {
function fmterrorf (line 469) | func fmterrorf(s string, args ...interface{}) error {
function errRecoverNoErrBadConn (line 473) | func errRecoverNoErrBadConn(err *error) {
method errRecover (line 486) | func (cn *conn) errRecover(err *error) {
FILE: vendor/github.com/lib/pq/krb.go
type NewGSSFunc (line 5) | type NewGSSFunc
function RegisterGSSProvider (line 18) | func RegisterGSSProvider(newGssArg NewGSSFunc) {
type GSS (line 23) | type GSS interface
FILE: vendor/github.com/lib/pq/notice.go
function NoticeHandler (line 14) | func NoticeHandler(c driver.Conn) func(*Error) {
function SetNoticeHandler (line 25) | func SetNoticeHandler(c driver.Conn, handler func(*Error)) {
type NoticeHandlerConnector (line 31) | type NoticeHandlerConnector struct
method Connect (line 38) | func (n *NoticeHandlerConnector) Connect(ctx context.Context) (driver....
function ConnectorNoticeHandler (line 49) | func ConnectorNoticeHandler(c driver.Connector) func(*Error) {
function ConnectorWithNoticeHandler (line 66) | func ConnectorWithNoticeHandler(c driver.Connector, handler func(*Error)...
FILE: vendor/github.com/lib/pq/notify.go
type Notification (line 17) | type Notification struct
function recvNotification (line 26) | func recvNotification(r *readBuf) *Notification {
function SetNotificationHandler (line 40) | func SetNotificationHandler(c driver.Conn, handler func(*Notification)) {
type NotificationHandlerConnector (line 46) | type NotificationHandlerConnector struct
method Connect (line 53) | func (n *NotificationHandlerConnector) Connect(ctx context.Context) (d...
function ConnectorNotificationHandler (line 64) | func ConnectorNotificationHandler(c driver.Connector) func(*Notification) {
function ConnectorWithNotificationHandler (line 81) | func ConnectorWithNotificationHandler(c driver.Connector, handler func(*...
constant connStateIdle (line 90) | connStateIdle int32 = iota
constant connStateExpectResponse (line 91) | connStateExpectResponse
constant connStateExpectReadyForQuery (line 92) | connStateExpectReadyForQuery
type message (line 95) | type message struct
type ListenerConn (line 104) | type ListenerConn struct
method acquireSenderLock (line 149) | func (l *ListenerConn) acquireSenderLock() error {
method releaseSenderLock (line 163) | func (l *ListenerConn) releaseSenderLock() {
method setState (line 169) | func (l *ListenerConn) setState(newState int32) bool {
method listenerConnLoop (line 191) | func (l *ListenerConn) listenerConnLoop() (err error) {
method listenerConnMain (line 248) | func (l *ListenerConn) listenerConnMain() {
method Listen (line 279) | func (l *ListenerConn) Listen(channel string) (bool, error) {
method Unlisten (line 284) | func (l *ListenerConn) Unlisten(channel string) (bool, error) {
method UnlistenAll (line 289) | func (l *ListenerConn) UnlistenAll() (bool, error) {
method Ping (line 295) | func (l *ListenerConn) Ping() error {
method sendSimpleQuery (line 311) | func (l *ListenerConn) sendSimpleQuery(q string) (err error) {
method ExecSimpleQuery (line 342) | func (l *ListenerConn) ExecSimpleQuery(q string) (executed bool, err e...
method Close (line 398) | func (l *ListenerConn) Close() error {
method Err (line 413) | func (l *ListenerConn) Err() error {
function NewListenerConn (line 121) | func NewListenerConn(name string, notificationChan chan<- *Notification)...
function newDialListenerConn (line 125) | func newDialListenerConn(d Dialer, name string, c chan<- *Notification) ...
type ListenerEventType (line 427) | type ListenerEventType
constant ListenerEventConnected (line 433) | ListenerEventConnected ListenerEventType = iota
constant ListenerEventDisconnected (line 439) | ListenerEventDisconnected
constant ListenerEventReconnected (line 445) | ListenerEventReconnected
constant ListenerEventConnectionAttemptFailed (line 451) | ListenerEventConnectionAttemptFailed
type EventCallbackType (line 456) | type EventCallbackType
type Listener (line 463) | type Listener struct
method NotificationChannel (line 533) | func (l *Listener) NotificationChannel() <-chan *Notification {
method Listen (line 552) | func (l *Listener) Listen(channel string) error {
method Unlisten (line 602) | func (l *Listener) Unlisten(channel string) error {
method UnlistenAll (line 636) | func (l *Listener) UnlistenAll() error {
method Ping (line 661) | func (l *Listener) Ping() error {
method disconnectCleanup (line 677) | func (l *Listener) disconnectCleanup() error {
method resync (line 699) | func (l *Listener) resync(cn *ListenerConn, notificationChan <-chan *N...
method closed (line 743) | func (l *Listener) closed() bool {
method connect (line 750) | func (l *Listener) connect() error {
method Close (line 776) | func (l *Listener) Close() error {
method emitEvent (line 795) | func (l *Listener) emitEvent(event ListenerEventType, err error) {
method listenerConnLoop (line 803) | func (l *Listener) listenerConnLoop() {
method listenerMain (line 855) | func (l *Listener) listenerMain() {
function NewListener (line 498) | func NewListener(name string,
function NewDialListener (line 506) | func NewDialListener(d Dialer,
FILE: vendor/github.com/lib/pq/oid/doc.go
type Oid (line 6) | type Oid
FILE: vendor/github.com/lib/pq/oid/types.go
constant T_bool (line 6) | T_bool Oid = 16
constant T_bytea (line 7) | T_bytea Oid = 17
constant T_char (line 8) | T_char Oid = 18
constant T_name (line 9) | T_name Oid = 19
constant T_int8 (line 10) | T_int8 Oid = 20
constant T_int2 (line 11) | T_int2 Oid = 21
constant T_int2vector (line 12) | T_int2vector Oid = 22
constant T_int4 (line 13) | T_int4 Oid = 23
constant T_regproc (line 14) | T_regproc Oid = 24
constant T_text (line 15) | T_text Oid = 25
constant T_oid (line 16) | T_oid Oid = 26
constant T_tid (line 17) | T_tid Oid = 27
constant T_xid (line 18) | T_xid Oid = 28
constant T_cid (line 19) | T_cid Oid = 29
constant T_oidvector (line 20) | T_oidvector Oid = 30
constant T_pg_ddl_command (line 21) | T_pg_ddl_command Oid = 32
constant T_pg_type (line 22) | T_pg_type Oid = 71
constant T_pg_attribute (line 23) | T_pg_attribute Oid = 75
constant T_pg_proc (line 24) | T_pg_proc Oid = 81
constant T_pg_class (line 25) | T_pg_class Oid = 83
constant T_json (line 26) | T_json Oid = 114
constant T_xml (line 27) | T_xml Oid = 142
constant T__xml (line 28) | T__xml Oid = 143
constant T_pg_node_tree (line 29) | T_pg_node_tree Oid = 194
constant T__json (line 30) | T__json Oid = 199
constant T_smgr (line 31) | T_smgr Oid = 210
constant T_index_am_handler (line 32) | T_index_am_handler Oid = 325
constant T_point (line 33) | T_point Oid = 600
constant T_lseg (line 34) | T_lseg Oid = 601
constant T_path (line 35) | T_path Oid = 602
constant T_box (line 36) | T_box Oid = 603
constant T_polygon (line 37) | T_polygon Oid = 604
constant T_line (line 38) | T_line Oid = 628
constant T__line (line 39) | T__line Oid = 629
constant T_cidr (line 40) | T_cidr Oid = 650
constant T__cidr (line 41) | T__cidr Oid = 651
constant T_float4 (line 42) | T_float4 Oid = 700
constant T_float8 (line 43) | T_float8 Oid = 701
constant T_abstime (line 44) | T_abstime Oid = 702
constant T_reltime (line 45) | T_reltime Oid = 703
constant T_tinterval (line 46) | T_tinterval Oid = 704
constant T_unknown (line 47) | T_unknown Oid = 705
constant T_circle (line 48) | T_circle Oid = 718
constant T__circle (line 49) | T__circle Oid = 719
constant T_money (line 50) | T_money Oid = 790
constant T__money (line 51) | T__money Oid = 791
constant T_macaddr (line 52) | T_macaddr Oid = 829
constant T_inet (line 53) | T_inet Oid = 869
constant T__bool (line 54) | T__bool Oid = 1000
constant T__bytea (line 55) | T__bytea Oid = 1001
constant T__char (line 56) | T__char Oid = 1002
constant T__name (line 57) | T__name Oid = 1003
constant T__int2 (line 58) | T__int2 Oid = 1005
constant T__int2vector (line 59) | T__int2vector Oid = 1006
constant T__int4 (line 60) | T__int4 Oid = 1007
constant T__regproc (line 61) | T__regproc Oid = 1008
constant T__text (line 62) | T__text Oid = 1009
constant T__tid (line 63) | T__tid Oid = 1010
constant T__xid (line 64) | T__xid Oid = 1011
constant T__cid (line 65) | T__cid Oid = 1012
constant T__oidvector (line 66) | T__oidvector Oid = 1013
constant T__bpchar (line 67) | T__bpchar Oid = 1014
constant T__varchar (line 68) | T__varchar Oid = 1015
constant T__int8 (line 69) | T__int8 Oid = 1016
constant T__point (line 70) | T__point Oid = 1017
constant T__lseg (line 71) | T__lseg Oid = 1018
constant T__path (line 72) | T__path Oid = 1019
constant T__box (line 73) | T__box Oid = 1020
constant T__float4 (line 74) | T__float4 Oid = 1021
constant T__float8 (line 75) | T__float8 Oid = 1022
constant T__abstime (line 76) | T__abstime Oid = 1023
constant T__reltime (line 77) | T__reltime Oid = 1024
constant T__tinterval (line 78) | T__tinterval Oid = 1025
constant T__polygon (line 79) | T__polygon Oid = 1027
constant T__oid (line 80) | T__oid Oid = 1028
constant T_aclitem (line 81) | T_aclitem Oid = 1033
constant T__aclitem (line 82) | T__aclitem Oid = 1034
constant T__macaddr (line 83) | T__macaddr Oid = 1040
constant T__inet (line 84) | T__inet Oid = 1041
constant T_bpchar (line 85) | T_bpchar Oid = 1042
constant T_varchar (line 86) | T_varchar Oid = 1043
constant T_date (line 87) | T_date Oid = 1082
constant T_time (line 88) | T_time Oid = 1083
constant T_timestamp (line 89) | T_timestamp Oid = 1114
constant T__timestamp (line 90) | T__timestamp Oid = 1115
constant T__date (line 91) | T__date Oid = 1182
constant T__time (line 92) | T__time Oid = 1183
constant T_timestamptz (line 93) | T_timestamptz Oid = 1184
constant T__timestamptz (line 94) | T__timestamptz Oid = 1185
constant T_interval (line 95) | T_interval Oid = 1186
constant T__interval (line 96) | T__interval Oid = 1187
constant T__numeric (line 97) | T__numeric Oid = 1231
constant T_pg_database (line 98) | T_pg_database Oid = 1248
constant T__cstring (line 99) | T__cstring Oid = 1263
constant T_timetz (line 100) | T_timetz Oid = 1266
constant T__timetz (line 101) | T__timetz Oid = 1270
constant T_bit (line 102) | T_bit Oid = 1560
constant T__bit (line 103) | T__bit Oid = 1561
constant T_varbit (line 104) | T_varbit Oid = 1562
constant T__varbit (line 105) | T__varbit Oid = 1563
constant T_numeric (line 106) | T_numeric Oid = 1700
constant T_refcursor (line 107) | T_refcursor Oid = 1790
constant T__refcursor (line 108) | T__refcursor Oid = 2201
constant T_regprocedure (line 109) | T_regprocedure Oid = 2202
constant T_regoper (line 110) | T_regoper Oid = 2203
constant T_regoperator (line 111) | T_regoperator Oid = 2204
constant T_regclass (line 112) | T_regclass Oid = 2205
constant T_regtype (line 113) | T_regtype Oid = 2206
constant T__regprocedure (line 114) | T__regprocedure Oid = 2207
constant T__regoper (line 115) | T__regoper Oid = 2208
constant T__regoperator (line 116) | T__regoperator Oid = 2209
constant T__regclass (line 117) | T__regclass Oid = 2210
constant T__regtype (line 118) | T__regtype Oid = 2211
constant T_record (line 119) | T_record Oid = 2249
constant T_cstring (line 120) | T_cstring Oid = 2275
constant T_any (line 121) | T_any Oid = 2276
constant T_anyarray (line 122) | T_anyarray Oid = 2277
constant T_void (line 123) | T_void Oid = 2278
constant T_trigger (line 124) | T_trigger Oid = 2279
constant T_language_handler (line 125) | T_language_handler Oid = 2280
constant T_internal (line 126) | T_internal Oid = 2281
constant T_opaque (line 127) | T_opaque Oid = 2282
constant T_anyelement (line 128) | T_anyelement Oid = 2283
constant T__record (line 129) | T__record Oid = 2287
constant T_anynonarray (line 130) | T_anynonarray Oid = 2776
constant T_pg_authid (line 131) | T_pg_authid Oid = 2842
constant T_pg_auth_members (line 132) | T_pg_auth_members Oid = 2843
constant T__txid_snapshot (line 133) | T__txid_snapshot Oid = 2949
constant T_uuid (line 134) | T_uuid Oid = 2950
constant T__uuid (line 135) | T__uuid Oid = 2951
constant T_txid_snapshot (line 136) | T_txid_snapshot Oid = 2970
constant T_fdw_handler (line 137) | T_fdw_handler Oid = 3115
constant T_pg_lsn (line 138) | T_pg_lsn Oid = 3220
constant T__pg_lsn (line 139) | T__pg_lsn Oid = 3221
constant T_tsm_handler (line 140) | T_tsm_handler Oid = 3310
constant T_anyenum (line 141) | T_anyenum Oid = 3500
constant T_tsvector (line 142) | T_tsvector Oid = 3614
constant T_tsquery (line 143) | T_tsquery Oid = 3615
constant T_gtsvector (line 144) | T_gtsvector Oid = 3642
constant T__tsvector (line 145) | T__tsvector Oid = 3643
constant T__gtsvector (line 146) | T__gtsvector Oid = 3644
constant T__tsquery (line 147) | T__tsquery Oid = 3645
constant T_regconfig (line 148) | T_regconfig Oid = 3734
constant T__regconfig (line 149) | T__regconfig Oid = 3735
constant T_regdictionary (line 150) | T_regdictionary Oid = 3769
constant T__regdictionary (line 151) | T__regdictionary Oid = 3770
constant T_jsonb (line 152) | T_jsonb Oid = 3802
constant T__jsonb (line 153) | T__jsonb Oid = 3807
constant T_anyrange (line 154) | T_anyrange Oid = 3831
constant T_event_trigger (line 155) | T_event_trigger Oid = 3838
constant T_int4range (line 156) | T_int4range Oid = 3904
constant T__int4range (line 157) | T__int4range Oid = 3905
constant T_numrange (line 158) | T_numrange Oid = 3906
constant T__numrange (line 159) | T__numrange Oid = 3907
constant T_tsrange (line 160) | T_tsrange Oid = 3908
constant T__tsrange (line 161) | T__tsrange Oid = 3909
constant T_tstzrange (line 162) | T_tstzrange Oid = 3910
constant T__tstzrange (line 163) | T__tstzrange Oid = 3911
constant T_daterange (line 164) | T_daterange Oid = 3912
constant T__daterange (line 165) | T__daterange Oid = 3913
constant T_int8range (line 166) | T_int8range Oid = 3926
constant T__int8range (line 167) | T__int8range Oid = 3927
constant T_pg_shseclabel (line 168) | T_pg_shseclabel Oid = 4066
constant T_regnamespace (line 169) | T_regnamespace Oid = 4089
constant T__regnamespace (line 170) | T__regnamespace Oid = 4090
constant T_regrole (line 171) | T_regrole Oid = 4096
constant T__regrole (line 172) | T__regrole Oid = 4097
FILE: vendor/github.com/lib/pq/rows.go
constant headerSize (line 11) | headerSize = 4
type fieldDesc (line 13) | type fieldDesc struct
method Type (line 24) | func (fd fieldDesc) Type() reflect.Type {
method Name (line 45) | func (fd fieldDesc) Name() string {
method Length (line 49) | func (fd fieldDesc) Length() (length int64, ok bool) {
method PrecisionScale (line 60) | func (fd fieldDesc) PrecisionScale() (precision, scale int64, ok bool) {
method ColumnTypeScanType (line 73) | func (rs *rows) ColumnTypeScanType(index int) reflect.Type {
method ColumnTypeDatabaseTypeName (line 78) | func (rs *rows) ColumnTypeDatabaseTypeName(index int) string {
method ColumnTypeLength (line 85) | func (rs *rows) ColumnTypeLength(index int) (length int64, ok bool) {
method ColumnTypePrecisionScale (line 91) | func (rs *rows) ColumnTypePrecisionScale(index int) (precision, scale in...
FILE: vendor/github.com/lib/pq/scram/scram.go
type Client (line 57) | type Client struct
method Out (line 90) | func (c *Client) Out() []byte {
method Err (line 98) | func (c *Client) Err() error {
method SetNonce (line 104) | func (c *Client) SetNonce(nonce []byte) {
method Step (line 114) | func (c *Client) Step(in []byte) bool {
method step1 (line 131) | func (c *Client) step1(in []byte) error {
method step2 (line 153) | func (c *Client) step2(in []byte) error {
method step3 (line 198) | func (c *Client) step3(in []byte) error {
method saltPassword (line 216) | func (c *Client) saltPassword(salt []byte, iterCount int) {
method clientProof (line 234) | func (c *Client) clientProof() []byte {
method serverSignature (line 252) | func (c *Client) serverSignature() []byte {
function NewClient (line 78) | func NewClient(newHash func() hash.Hash, user, pass string) *Client {
FILE: vendor/github.com/lib/pq/ssl.go
function ssl (line 16) | func ssl(o values) (func(net.Conn) (net.Conn, error), error) {
function sslClientCertificates (line 96) | func sslClientCertificates(tlsConf *tls.Config, o values) error {
function sslCertificateAuthority (line 154) | func sslCertificateAuthority(tlsConf *tls.Config, o values) error {
function sslVerifyCertificateAuthority (line 185) | func sslVerifyCertificateAuthority(client *tls.Conn, tlsConf *tls.Config...
FILE: vendor/github.com/lib/pq/ssl_permissions.go
constant rootUserID (line 13) | rootUserID = uint32(0)
constant maxUserOwnedKeyPermissions (line 17) | maxUserOwnedKeyPermissions os.FileMode = 0600
constant maxRootOwnedKeyPermissions (line 21) | maxRootOwnedKeyPermissions os.FileMode = 0640
function sslKeyPermissions (line 33) | func sslKeyPermissions(sslkey string) error {
function hasCorrectPermissions (line 59) | func hasCorrectPermissions(info os.FileInfo) error {
FILE: vendor/github.com/lib/pq/ssl_windows.go
function sslKeyPermissions (line 10) | func sslKeyPermissions(string) error { return nil }
FILE: vendor/github.com/lib/pq/url.go
function ParseURL (line 32) | func ParseURL(url string) (string, error) {
FILE: vendor/github.com/lib/pq/user_other.go
function userCurrent (line 8) | func userCurrent() (string, error) {
FILE: vendor/github.com/lib/pq/user_posix.go
function userCurrent (line 13) | func userCurrent() (string, error) {
FILE: vendor/github.com/lib/pq/user_windows.go
function userCurrent (line 17) | func userCurrent() (string, error) {
FILE: vendor/github.com/lib/pq/uuid.go
function decodeUUIDBinary (line 9) | func decodeUUIDBinary(src []byte) ([]byte, error) {
FILE: vendor/github.com/pmezard/go-difflib/difflib/difflib.go
function min (line 26) | func min(a, b int) int {
function max (line 33) | func max(a, b int) int {
function calculateRatio (line 40) | func calculateRatio(matches, length int) float64 {
type Match (line 47) | type Match struct
type OpCode (line 53) | type OpCode struct
type SequenceMatcher (line 87) | type SequenceMatcher struct
method SetSeqs (line 115) | func (m *SequenceMatcher) SetSeqs(a, b []string) {
method SetSeq1 (line 129) | func (m *SequenceMatcher) SetSeq1(a []string) {
method SetSeq2 (line 140) | func (m *SequenceMatcher) SetSeq2(b []string) {
method chainB (line 151) | func (m *SequenceMatcher) chainB() {
method isBJunk (line 192) | func (m *SequenceMatcher) isBJunk(s string) bool {
method findLongestMatch (line 221) | func (m *SequenceMatcher) findLongestMatch(alo, ahi, blo, bhi int) Mat...
method GetMatchingBlocks (line 305) | func (m *SequenceMatcher) GetMatchingBlocks() []Match {
method GetOpCodes (line 373) | func (m *SequenceMatcher) GetOpCodes() []OpCode {
method GetGroupedOpCodes (line 413) | func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode {
method Ratio (line 465) | func (m *SequenceMatcher) Ratio() float64 {
method QuickRatio (line 477) | func (m *SequenceMatcher) QuickRatio() float64 {
method RealQuickRatio (line 509) | func (m *SequenceMatcher) RealQuickRatio() float64 {
function NewMatcher (line 100) | func NewMatcher(a, b []string) *SequenceMatcher {
function NewMatcherWithJunk (line 106) | func NewMatcherWithJunk(a, b []string, autoJunk bool,
function formatRangeUnified (line 515) | func formatRangeUnified(start, stop int) string {
type UnifiedDiff (line 529) | type UnifiedDiff struct
function WriteUnifiedDiff (line 559) | func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error {
function GetUnifiedDiffString (line 635) | func GetUnifiedDiffString(diff UnifiedDiff) (string, error) {
function formatRangeContext (line 642) | func formatRangeContext(start, stop int) string {
type ContextDiff (line 655) | type ContextDiff
function WriteContextDiff (line 674) | func WriteContextDiff(writer io.Writer, diff ContextDiff) error {
function GetContextDiffString (line 760) | func GetContextDiffString(diff ContextDiff) (string, error) {
function SplitLines (line 768) | func SplitLines(s string) []string {
FILE: vendor/github.com/serenize/snaker/snaker.go
function CamelToSnake (line 11) | func CamelToSnake(s string) string {
function snakeToCamel (line 48) | func snakeToCamel(s string, upperCase bool) string {
function SnakeToCamel (line 79) | func SnakeToCamel(s string) string {
function SnakeToCamelLower (line 84) | func SnakeToCamelLower(s string) string {
function startsWithInitialism (line 89) | func startsWithInitialism(s string) string {
FILE: vendor/github.com/stretchr/objx/accessors.go
constant PathSeparator (line 15) | PathSeparator string = "."
constant arrayAccesRegexString (line 19) | arrayAccesRegexString = `^(.+)\[([0-9]+)\]$`
constant mapAccessRegexString (line 23) | mapAccessRegexString = `^([^\[]*)\[([^\]]+)\](.*)$`
method Get (line 45) | func (m Map) Get(selector string) *Value {
method Set (line 60) | func (m Map) Set(selector string, value interface{}) Map {
function getIndex (line 68) | func getIndex(s string) (int, string) {
function getKey (line 83) | func getKey(s string) (string, string) {
function access (line 116) | func access(current interface{}, selector string, value interface{}, isS...
function interSlice (line 180) | func interSlice(slice interface{}) ([]interface{}, bool) {
FILE: vendor/github.com/stretchr/objx/conversions.go
constant SignatureSeparator (line 15) | SignatureSeparator = "_"
constant URLValuesSliceKeySuffixEmpty (line 27) | URLValuesSliceKeySuffixEmpty = ""
constant URLValuesSliceKeySuffixArray (line 28) | URLValuesSliceKeySuffixArray = "[]"
constant URLValuesSliceKeySuffixIndex (line 29) | URLValuesSliceKeySuffixIndex = "[i]"
function SetURLValuesSliceKeySuffix (line 39) | func SetURLValuesSliceKeySuffix(s string) error {
method JSON (line 50) | func (m Map) JSON() (string, error) {
function cleanUpInterfaceArray (line 62) | func cleanUpInterfaceArray(in []interface{}) []interface{} {
function cleanUpInterfaceMap (line 70) | func cleanUpInterfaceMap(in map[interface{}]interface{}) Map {
function cleanUpStringMap (line 78) | func cleanUpStringMap(in map[string]interface{}) Map {
function cleanUpMSIArray (line 86) | func cleanUpMSIArray(in []map[string]interface{}) []Map {
function cleanUpMapArray (line 94) | func cleanUpMapArray(in []Map) []Map {
function cleanUp (line 102) | func cleanUp(v interface{}) interface{} {
method MustJSON (line 121) | func (m Map) MustJSON() string {
method Base64 (line 131) | func (m Map) Base64() (string, error) {
method MustBase64 (line 149) | func (m Map) MustBase64() string {
method SignedBase64 (line 160) | func (m Map) SignedBase64(key string) (string, error) {
method MustSignedBase64 (line 173) | func (m Map) MustSignedBase64(key string) string {
method URLValues (line 188) | func (m Map) URLValues() url.Values {
method parseURLValues (line 196) | func (m Map) parseURLValues(queryMap Map, vals url.Values, key string) {
method URLQuery (line 278) | func (m Map) URLQuery() (string, error) {
FILE: vendor/github.com/stretchr/objx/map.go
type MSIConvertable (line 14) | type MSIConvertable interface
type Map (line 22) | type Map
method Value (line 25) | func (m Map) Value() *Value {
function New (line 35) | func New(data interface{}) Map {
function MSI (line 61) | func MSI(keyAndValuePairs ...interface{}) Map {
function MustFromJSON (line 87) | func MustFromJSON(jsonString string) Map {
function MustFromJSONSlice (line 99) | func MustFromJSONSlice(jsonString string) []Map {
function FromJSON (line 111) | func FromJSON(jsonString string) (Map, error) {
function FromJSONSlice (line 124) | func FromJSONSlice(jsonString string) ([]Map, error) {
function FromBase64 (line 137) | func FromBase64(base64String string) (Map, error) {
function MustFromBase64 (line 150) | func MustFromBase64(base64String string) Map {
function FromSignedBase64 (line 162) | func FromSignedBase64(base64String, key string) (Map, error) {
function MustFromSignedBase64 (line 179) | func MustFromSignedBase64(base64String, key string) Map {
function FromURLQuery (line 191) | func FromURLQuery(query string) (Map, error) {
function MustFromURLQuery (line 209) | func MustFromURLQuery(query string) Map {
FILE: vendor/github.com/stretchr/objx/mutations.go
method Exclude (line 5) | func (m Map) Exclude(exclude []string) Map {
method Copy (line 16) | func (m Map) Copy() Map {
method Merge (line 28) | func (m Map) Merge(merge Map) Map {
method MergeHere (line 37) | func (m Map) MergeHere(merge Map) Map {
method Transform (line 47) | func (m Map) Transform(transformer func(key string, value interface{}) (...
method TransformKeys (line 60) | func (m Map) TransformKeys(mapping map[string]string) Map {
function contains (line 70) | func contains(s []string, e string) bool {
FILE: vendor/github.com/stretchr/objx/security.go
function HashWithKey (line 9) | func HashWithKey(data, key string) string {
FILE: vendor/github.com/stretchr/objx/tests.go
method Has (line 7) | func (m Map) Has(selector string) bool {
method IsNil (line 15) | func (v *Value) IsNil() bool {
FILE: vendor/github.com/stretchr/objx/type_specific.go
method MSI (line 9) | func (v *Value) MSI(optionalDefault ...map[string]interface{}) map[strin...
method MustMSI (line 25) | func (v *Value) MustMSI() map[string]interface{} {
method MSISlice (line 34) | func (v *Value) MSISlice(optionalDefault ...[]map[string]interface{}) []...
method MustMSISlice (line 57) | func (v *Value) MustMSISlice() []map[string]interface{} {
method IsMSI (line 66) | func (v *Value) IsMSI() bool {
method IsMSISlice (line 75) | func (v *Value) IsMSISlice() bool {
method EachMSI (line 101) | func (v *Value) EachMSI(callback func(int, map[string]interface{}) bool)...
method WhereMSI (line 114) | func (v *Value) WhereMSI(decider func(int, map[string]interface{}) bool)...
method GroupMSI (line 129) | func (v *Value) GroupMSI(grouper func(int, map[string]interface{}) strin...
method ReplaceMSI (line 145) | func (v *Value) ReplaceMSI(replacer func(int, map[string]interface{}) ma...
method CollectMSI (line 158) | func (v *Value) CollectMSI(collector func(int, map[string]interface{}) i...
method ObjxMap (line 174) | func (v *Value) ObjxMap(optionalDefault ...(Map)) Map {
method MustObjxMap (line 190) | func (v *Value) MustObjxMap() Map {
method ObjxMapSlice (line 199) | func (v *Value) ObjxMapSlice(optionalDefault ...[](Map)) [](Map) {
method MustObjxMapSlice (line 237) | func (v *Value) MustObjxMapSlice() [](Map) {
method IsObjxMap (line 245) | func (v *Value) IsObjxMap() bool {
method IsObjxMapSlice (line 254) | func (v *Value) IsObjxMapSlice() bool {
method EachObjxMap (line 281) | func (v *Value) EachObjxMap(callback func(int, Map) bool) *Value {
method WhereObjxMap (line 294) | func (v *Value) WhereObjxMap(decider func(int, Map) bool) *Value {
method GroupObjxMap (line 309) | func (v *Value) GroupObjxMap(grouper func(int, Map) string) *Value {
method ReplaceObjxMap (line 325) | func (v *Value) ReplaceObjxMap(replacer func(int, Map) Map) *Value {
method CollectObjxMap (line 338) | func (v *Value) CollectObjxMap(collector func(int, Map) interface{}) *Va...
FILE: vendor/github.com/stretchr/objx/type_specific_codegen.go
method Inter (line 9) | func (v *Value) Inter(optionalDefault ...interface{}) interface{} {
method MustInter (line 22) | func (v *Value) MustInter() interface{} {
method InterSlice (line 28) | func (v *Value) InterSlice(optionalDefault ...[]interface{}) []interface...
method MustInterSlice (line 41) | func (v *Value) MustInterSlice() []interface{} {
method IsInter (line 46) | func (v *Value) IsInter() bool {
method IsInterSlice (line 52) | func (v *Value) IsInterSlice() bool {
method EachInter (line 61) | func (v *Value) EachInter(callback func(int, interface{}) bool) *Value {
method WhereInter (line 74) | func (v *Value) WhereInter(decider func(int, interface{}) bool) *Value {
method GroupInter (line 89) | func (v *Value) GroupInter(grouper func(int, interface{}) string) *Value {
method ReplaceInter (line 105) | func (v *Value) ReplaceInter(replacer func(int, interface{}) interface{}...
method CollectInter (line 118) | func (v *Value) CollectInter(collector func(int, interface{}) interface{...
method Bool (line 134) | func (v *Value) Bool(optionalDefault ...bool) bool {
method MustBool (line 147) | func (v *Value) MustBool() bool {
method BoolSlice (line 153) | func (v *Value) BoolSlice(optionalDefault ...[]bool) []bool {
method MustBoolSlice (line 166) | func (v *Value) MustBoolSlice() []bool {
method IsBool (line 171) | func (v *Value) IsBool() bool {
method IsBoolSlice (line 177) | func (v *Value) IsBoolSlice() bool {
method EachBool (line 186) | func (v *Value) EachBool(callback func(int, bool) bool) *Value {
method WhereBool (line 199) | func (v *Value) WhereBool(decider func(int, bool) bool) *Value {
method GroupBool (line 214) | func (v *Value) GroupBool(grouper func(int, bool) string) *Value {
method ReplaceBool (line 230) | func (v *Value) ReplaceBool(replacer func(int, bool) bool) *Value {
method CollectBool (line 243) | func (v *Value) CollectBool(collector func(int, bool) interface{}) *Value {
method Str (line 259) | func (v *Value) Str(optionalDefault ...string) string {
method MustStr (line 272) | func (v *Value) MustStr() string {
method StrSlice (line 278) | func (v *Value) StrSlice(optionalDefault ...[]string) []string {
method MustStrSlice (line 291) | func (v *Value) MustStrSlice() []string {
method IsStr (line 296) | func (v *Value) IsStr() bool {
method IsStrSlice (line 302) | func (v *Value) IsStrSlice() bool {
method EachStr (line 311) | func (v *Value) EachStr(callback func(int, string) bool) *Value {
method WhereStr (line 324) | func (v *Value) WhereStr(decider func(int, string) bool) *Value {
method GroupStr (line 339) | func (v *Value) GroupStr(grouper func(int, string) string) *Value {
method ReplaceStr (line 355) | func (v *Value) ReplaceStr(replacer func(int, string) string) *Value {
method CollectStr (line 368) | func (v *Value) CollectStr(collector func(int, string) interface{}) *Val...
method Int (line 384) | func (v *Value) Int(optionalDefault ...int) int {
method MustInt (line 402) | func (v *Value) MustInt() int {
method IntSlice (line 413) | func (v *Value) IntSlice(optionalDefault ...[]int) []int {
method MustIntSlice (line 426) | func (v *Value) MustIntSlice() []int {
method IsInt (line 431) | func (v *Value) IsInt() bool {
method IsIntSlice (line 437) | func (v *Value) IsIntSlice() bool {
method EachInt (line 446) | func (v *Value) EachInt(callback func(int, int) bool) *Value {
method WhereInt (line 459) | func (v *Value) WhereInt(decider func(int, int) bool) *Value {
method GroupInt (line 474) | func (v *Value) GroupInt(grouper func(int, int) string) *Value {
method ReplaceInt (line 490) | func (v *Value) ReplaceInt(replacer func(int, int) int) *Value {
method CollectInt (line 503) | func (v *Value) CollectInt(collector func(int, int) interface{}) *Value {
method Int8 (line 519) | func (v *Value) Int8(optionalDefault ...int8) int8 {
method MustInt8 (line 532) | func (v *Value) MustInt8() int8 {
method Int8Slice (line 538) | func (v *Value) Int8Slice(optionalDefault ...[]int8) []int8 {
method MustInt8Slice (line 551) | func (v *Value) MustInt8Slice() []int8 {
method IsInt8 (line 556) | func (v *Value) IsInt8() bool {
method IsInt8Slice (line 562) | func (v *Value) IsInt8Slice() bool {
method EachInt8 (line 571) | func (v *Value) EachInt8(callback func(int, int8) bool) *Value {
method WhereInt8 (line 584) | func (v *Value) WhereInt8(decider func(int, int8) bool) *Value {
method GroupInt8 (line 599) | func (v *Value) GroupInt8(grouper func(int, int8) string) *Value {
method ReplaceInt8 (line 615) | func (v *Value) ReplaceInt8(replacer func(int, int8) int8) *Value {
method CollectInt8 (line 628) | func (v *Value) CollectInt8(collector func(int, int8) interface{}) *Value {
method Int16 (line 644) | func (v *Value) Int16(optionalDefault ...int16) int16 {
method MustInt16 (line 657) | func (v *Value) MustInt16() int16 {
method Int16Slice (line 663) | func (v *Value) Int16Slice(optionalDefault ...[]int16) []int16 {
method MustInt16Slice (line 676) | func (v *Value) MustInt16Slice() []int16 {
method IsInt16 (line 681) | func (v *Value) IsInt16() bool {
method IsInt16Slice (line 687) | func (v *Value) IsInt16Slice() bool {
method EachInt16 (line 696) | func (v *Value) EachInt16(callback func(int, int16) bool) *Value {
method WhereInt16 (line 709) | func (v *Value) WhereInt16(decider func(int, int16) bool) *Value {
method GroupInt16 (line 724) | func (v *Value) GroupInt16(grouper func(int, int16) string) *Value {
method ReplaceInt16 (line 740) | func (v *Value) ReplaceInt16(replacer func(int, int16) int16) *Value {
method CollectInt16 (line 753) | func (v *Value) CollectInt16(collector func(int, int16) interface{}) *Va...
method Int32 (line 769) | func (v *Value) Int32(optionalDefault ...int32) int32 {
method MustInt32 (line 782) | func (v *Value) MustInt32() int32 {
method Int32Slice (line 788) | func (v *Value) Int32Slice(optionalDefault ...[]int32) []int32 {
method MustInt32Slice (line 801) | func (v *Value) MustInt32Slice() []int32 {
method IsInt32 (line 806) | func (v *Value) IsInt32() bool {
method IsInt32Slice (line 812) | func (v *Value) IsInt32Slice() bool {
method EachInt32 (line 821) | func (v *Value) EachInt32(callback func(int, int32) bool) *Value {
method WhereInt32 (line 834) | func (v *Value) WhereInt32(decider func(int, int32) bool) *Value {
method GroupInt32 (line 849) | func (v *Value) GroupInt32(grouper func(int, int32) string) *Value {
method ReplaceInt32 (line 865) | func (v *Value) ReplaceInt32(replacer func(int, int32) int32) *Value {
method CollectInt32 (line 878) | func (v *Value) CollectInt32(collector func(int, int32) interface{}) *Va...
method Int64 (line 894) | func (v *Value) Int64(optionalDefault ...int64) int64 {
method MustInt64 (line 907) | func (v *Value) MustInt64() int64 {
method Int64Slice (line 913) | func (v *Value) Int64Slice(optionalDefault ...[]int64) []int64 {
method MustInt64Slice (line 926) | func (v *Value) MustInt64Slice() []int64 {
method IsInt64 (line 931) | func (v *Value) IsInt64() bool {
method IsInt64Slice (line 937) | func (v *Value) IsInt64Slice() bool {
method EachInt64 (line 946) | func (v *Value) EachInt64(callback func(int, int64) bool) *Value {
method WhereInt64 (line 959) | func (v *Value) WhereInt64(decider func(int, int64) bool) *Value {
method GroupInt64 (line 974) | func (v *Value) GroupInt64(grouper func(int, int64) string) *Value {
method ReplaceInt64 (line 990) | func (v *Value) ReplaceInt64(replacer func(int, int64) int64) *Value {
method CollectInt64 (line 1003) | func (v *Value) CollectInt64(collector func(int, int64) interface{}) *Va...
method Uint (line 1019) | func (v *Value) Uint(optionalDefault ...uint) uint {
method MustUint (line 1032) | func (v *Value) MustUint() uint {
method UintSlice (line 1038) | func (v *Value) UintSlice(optionalDefault ...[]uint) []uint {
method MustUintSlice (line 1051) | func (v *Value) MustUintSlice() []uint {
method IsUint (line 1056) | func (v *Value) IsUint() bool {
method IsUintSlice (line 1062) | func (v *Value) IsUintSlice() bool {
method EachUint (line 1071) | func (v *Value) EachUint(callback func(int, uint) bool) *Value {
method WhereUint (line 1084) | func (v *Value) WhereUint(decider func(int, uint) bool) *Value {
method GroupUint (line 1099) | func (v *Value) GroupUint(grouper func(int, uint) string) *Value {
method ReplaceUint (line 1115) | func (v *Value) ReplaceUint(replacer func(int, uint) uint) *Value {
method CollectUint (line 1128) | func (v *Value) CollectUint(collector func(int, uint) interface{}) *Value {
method Uint8 (line 1144) | func (v *Value) Uint8(optionalDefault ...uint8) uint8 {
method MustUint8 (line 1157) | func (v *Value) MustUint8() uint8 {
method Uint8Slice (line 1163) | func (v *Value) Uint8Slice(optionalDefault ...[]uint8) []uint8 {
method MustUint8Slice (line 1176) | func (v *Value) MustUint8Slice() []uint8 {
method IsUint8 (line 1181) | func (v *Value) IsUint8() bool {
method IsUint8Slice (line 1187) | func (v *Value) IsUint8Slice() bool {
method EachUint8 (line 1196) | func (v *Value) EachUint8(callback func(int, uint8) bool) *Value {
method WhereUint8 (line 1209) | func (v *Value) WhereUint8(decider func(int, uint8) bool) *Value {
method GroupUint8 (line 1224) | func (v *Value) GroupUint8(grouper func(int, uint8) string) *Value {
method ReplaceUint8 (line 1240) | func (v *Value) ReplaceUint8(replacer func(int, uint8) uint8) *Value {
method CollectUint8 (line 1253) | func (v *Value) CollectUint8(collector func(int, uint8) interface{}) *Va...
method Uint16 (line 1269) | func (v *Value) Uint16(optionalDefault ...uint16) uint16 {
method MustUint16 (line 1282) | func (v *Value) MustUint16() uint16 {
method Uint16Slice (line 1288) | func (v *Value) Uint16Slice(optionalDefault ...[]uint16) []uint16 {
method MustUint16Slice (line 1301) | func (v *Value) MustUint16Slice() []uint16 {
method IsUint16 (line 1306) | func (v *Value) IsUint16() bool {
method IsUint16Slice (line 1312) | func (v *Value) IsUint16Slice() bool {
method EachUint16 (line 1321) | func (v *Value) EachUint16(callback func(int, uint16) bool) *Value {
method WhereUint16 (line 1334) | func (v *Value) WhereUint16(decider func(int, uint16) bool) *Value {
method GroupUint16 (line 1349) | func (v *Value) GroupUint16(grouper func(int, uint16) string) *Value {
method ReplaceUint16 (line 1365) | func (v *Value) ReplaceUint16(replacer func(int, uint16) uint16) *Value {
method CollectUint16 (line 1378) | func (v *Value) CollectUint16(collector func(int, uint16) interface{}) *...
method Uint32 (line 1394) | func (v *Value) Uint32(optionalDefault ...uint32) uint32 {
method MustUint32 (line 1407) | func (v *Value) MustUint32() uint32 {
method Uint32Slice (line 1413) | func (v *Value) Uint32Slice(optionalDefault ...[]uint32) []uint32 {
method MustUint32Slice (line 1426) | func (v *Value) MustUint32Slice() []uint32 {
method IsUint32 (line 1431) | func (v *Value) IsUint32() bool {
method IsUint32Slice (line 1437) | func (v *Value) IsUint32Slice() bool {
method EachUint32 (line 1446) | func (v *Value) EachUint32(callback func(int, uint32) bool) *Value {
method WhereUint32 (line 1459) | func (v *Value) WhereUint32(decider func(int, uint32) bool) *Value {
method GroupUint32 (line 1474) | func (v *Value) GroupUint32(grouper func(int, uint32) string) *Value {
method ReplaceUint32 (line 1490) | func (v *Value) ReplaceUint32(replacer func(int, uint32) uint32) *Value {
method CollectUint32 (line 1503) | func (v *Value) CollectUint32(collector func(int, uint32) interface{}) *...
method Uint64 (line 1519) | func (v *Value) Uint64(optionalDefault ...uint64) uint64 {
method MustUint64 (line 1532) | func (v *Value) MustUint64() uint64 {
method Uint64Slice (line 1538) | func (v *Value) Uint64Slice(optionalDefault ...[]uint64) []uint64 {
method MustUint64Slice (line 1551) | func (v *Value) MustUint64Slice() []uint64 {
method IsUint64 (line 1556) | func (v *Value) IsUint64() bool {
method IsUint64Slice (line 1562) | func (v *Value) IsUint64Slice() bool {
method EachUint64 (line 1571) | func (v *Value) EachUint64(callback func(int, uint64) bool) *Value {
method WhereUint64 (line 1584) | func (v *Value) WhereUint64(decider func(int, uint64) bool) *Value {
method GroupUint64 (line 1599) | func (v *Value) GroupUint64(grouper func(int, uint64) string) *Value {
method ReplaceUint64 (line 1615) | func (v *Value) ReplaceUint64(replacer func(int, uint64) uint64) *Value {
method CollectUint64 (line 1628) | func (v *Value) CollectUint64(collector func(int, uint64) interface{}) *...
method Uintptr (line 1644) | func (v *Value) Uintptr(optionalDefault ...uintptr) uintptr {
method MustUintptr (line 1657) | func (v *Value) MustUintptr() uintptr {
method UintptrSlice (line 1663) | func (v *Value) UintptrSlice(optionalDefault ...[]uintptr) []uintptr {
method MustUintptrSlice (line 1676) | func (v *Value) MustUintptrSlice() []uintptr {
method IsUintptr (line 1681) | func (v *Value) IsUintptr() bool {
method IsUintptrSlice (line 1687) | func (v *Value) IsUintptrSlice() bool {
method EachUintptr (line 1696) | func (v *Value) EachUintptr(callback func(int, uintptr) bool) *Value {
method WhereUintptr (line 1709) | func (v *Value) WhereUintptr(decider func(int, uintptr) bool) *Value {
method GroupUintptr (line 1724) | func (v *Value) GroupUintptr(grouper func(int, uintptr) string) *Value {
method ReplaceUintptr (line 1740) | func (v *Value) ReplaceUintptr(replacer func(int, uintptr) uintptr) *Val...
method CollectUintptr (line 1753) | func (v *Value) CollectUintptr(collector func(int, uintptr) interface{})...
method Float32 (line 1769) | func (v *Value) Float32(optionalDefault ...float32) float32 {
method MustFloat32 (line 1782) | func (v *Value) MustFloat32() float32 {
method Float32Slice (line 1788) | func (v *Value) Float32Slice(optionalDefault ...[]float32) []float32 {
method MustFloat32Slice (line 1801) | func (v *Value) MustFloat32Slice() []float32 {
method IsFloat32 (line 1806) | func (v *Value) IsFloat32() bool {
method IsFloat32Slice (line 1812) | func (v *Value) IsFloat32Slice() bool {
method EachFloat32 (line 1821) | func (v *Value) EachFloat32(callback func(int, float32) bool) *Value {
method WhereFloat32 (line 1834) | func (v *Value) WhereFloat32(decider func(int, float32) bool) *Value {
method GroupFloat32 (line 1849) | func (v *Value) GroupFloat32(grouper func(int, float32) string) *Value {
method ReplaceFloat32 (line 1865) | func (v *Value) ReplaceFloat32(replacer func(int, float32) float32) *Val...
method CollectFloat32 (line 1878) | func (v *Value) CollectFloat32(collector func(int, float32) interface{})...
method Float64 (line 1894) | func (v *Value) Float64(optionalDefault ...float64) float64 {
method MustFloat64 (line 1907) | func (v *Value) MustFloat64() float64 {
method Float64Slice (line 1913) | func (v *Value) Float64Slice(optionalDefault ...[]float64) []float64 {
method MustFloat64Slice (line 1926) | func (v *Value) MustFloat64Slice() []float64 {
method IsFloat64 (line 1931) | func (v *Value) IsFloat64() bool {
method IsFloat64Slice (line 1937) | func (v *Value) IsFloat64Slice() bool {
method EachFloat64 (line 1946) | func (v *Value) EachFloat64(callback func(int, float64) bool) *Value {
method WhereFloat64 (line 1959) | func (v *Value) WhereFloat64(decider func(int, float64) bool) *Value {
method GroupFloat64 (line 1974) | func (v *Value) GroupFloat64(grouper func(int, float64) string) *Value {
method ReplaceFloat64 (line 1990) | func (v *Value) ReplaceFloat64(replacer func(int, float64) float64) *Val...
method CollectFloat64 (line 2003) | func (v *Value) CollectFloat64(collector func(int, float64) interface{})...
method Complex64 (line 2019) | func (v *Value) Complex64(optionalDefault ...complex64) complex64 {
method MustComplex64 (line 2032) | func (v *Value) MustComplex64() complex64 {
method Complex64Slice (line 2038) | func (v *Value) Complex64Slice(optionalDefault ...[]complex64) []complex...
method MustComplex64Slice (line 2051) | func (v *Value) MustComplex64Slice() []complex64 {
method IsComplex64 (line 2056) | func (v *Value) IsComplex64() bool {
method IsComplex64Slice (line 2062) | func (v *Value) IsComplex64Slice() bool {
method EachComplex64 (line 2071) | func (v *Value) EachComplex64(callback func(int, complex64) bool) *Value {
method WhereComplex64 (line 2084) | func (v *Value) WhereComplex64(decider func(int, complex64) bool) *Value {
method GroupComplex64 (line 2099) | func (v *Value) GroupComplex64(grouper func(int, complex64) string) *Val...
method ReplaceComplex64 (line 2115) | func (v *Value) ReplaceComplex64(replacer func(int, complex64) complex64...
method CollectComplex64 (line 2128) | func (v *Value) CollectComplex64(collector func(int, complex64) interfac...
method Complex128 (line 2144) | func (v *Value) Complex128(optionalDefault ...complex128) complex128 {
method MustComplex128 (line 2157) | func (v *Value) MustComplex128() complex128 {
method Complex128Slice (line 2163) | func (v *Value) Complex128Slice(optionalDefault ...[]complex128) []compl...
method MustComplex128Slice (line 2176) | func (v *Value) MustComplex128Slice() []complex128 {
method IsComplex128 (line 2181) | func (v *Value) IsComplex128() bool {
method IsComplex128Slice (line 2187) | func (v *Value) IsComplex128Slice() bool {
method EachComplex128 (line 2196) | func (v *Value) EachComplex128(callback func(int, complex128) bool) *Val...
method WhereComplex128 (line 2209) | func (v *Value) WhereComplex128(decider func(int, complex128) bool) *Val...
method GroupComplex128 (line 2224) | func (v *Value) GroupComplex128(grouper func(int, complex128) string) *V...
method ReplaceComplex128 (line 2240) | func (v *Value) ReplaceComplex128(replacer func(int, complex128) complex...
method CollectComplex128 (line 2253) | func (v *Value) CollectComplex128(collector func(int, complex128) interf...
FILE: vendor/github.com/stretchr/objx/value.go
type Value (line 10) | type Value struct
method Data (line 16) | func (v *Value) Data() interface{} {
method String (line 21) | func (v *Value) String() string {
method StringSlice (line 58) | func (v *Value) StringSlice(optionalDefault ...[]string) []string {
FILE: vendor/github.com/stretchr/testify/assert/assertion_compare.go
type CompareType (line 10) | type CompareType
constant compareLess (line 13) | compareLess CompareType = iota - 1
constant compareEqual (line 14) | compareEqual
constant compareGreater (line 15) | compareGreater
function compare (line 40) | func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bo...
function Greater (line 358) | func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...i...
function GreaterOrEqual (line 371) | func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndAr...
function Less (line 383) | func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...inte...
function LessOrEqual (line 396) | func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...
function Positive (line 407) | func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
function Negative (line 419) | func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
function compareTwoValues (line 427) | func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowe...
function containsValue (line 450) | func containsValue(values []CompareType, value CompareType) bool {
FILE: vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go
function canConvert (line 14) | func canConvert(value reflect.Value, to reflect.Type) bool {
FILE: vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go
function canConvert (line 14) | func canConvert(value reflect.Value, to reflect.Type) bool {
FILE: vendor/github.com/stretchr/testify/assert/assertion_format.go
function Conditionf (line 15) | func Conditionf(t TestingT, comp Comparison, msg string, args ...interfa...
function Containsf (line 28) | func Containsf(t TestingT, s interface{}, contains interface{}, msg stri...
function DirExistsf (line 37) | func DirExistsf(t TestingT, path string, msg string, args ...interface{}...
function ElementsMatchf (line 49) | func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, ms...
function Emptyf (line 60) | func Emptyf(t TestingT, object interface{}, msg string, args ...interfac...
function Equalf (line 74) | func Equalf(t TestingT, expected interface{}, actual interface{}, msg st...
function EqualErrorf (line 86) | func EqualErrorf(t TestingT, theError error, errString string, msg strin...
function EqualExportedValuesf (line 103) | func EqualExportedValuesf(t TestingT, expected interface{}, actual inter...
function EqualValuesf (line 114) | func EqualValuesf(t TestingT, expected interface{}, actual interface{}, ...
function Errorf (line 127) | func Errorf(t TestingT, err error, msg string, args ...interface{}) bool {
function ErrorAsf (line 136) | func ErrorAsf(t TestingT, err error, target interface{}, msg string, arg...
function ErrorContainsf (line 148) | func ErrorContainsf(t TestingT, theError error, contains string, msg str...
function ErrorIsf (line 157) | func ErrorIsf(t TestingT, err error, target error, msg string, args ...i...
function Eventuallyf (line 168) | func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duratio...
function EventuallyWithTf (line 193) | func EventuallyWithTf(t TestingT, condition func(collect *CollectT), wai...
function Exactlyf (line 203) | func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg ...
function Failf (line 211) | func Failf(t TestingT, failureMessage string, msg string, args ...interf...
function FailNowf (line 219) | func FailNowf(t TestingT, failureMessage string, msg string, args ...int...
function Falsef (line 229) | func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool {
function FileExistsf (line 238) | func FileExistsf(t TestingT, path string, msg string, args ...interface{...
function Greaterf (line 250) | func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, ar...
function GreaterOrEqualf (line 263) | func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg str...
function HTTPBodyContainsf (line 276) | func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method stri...
function HTTPBodyNotContainsf (line 289) | func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method s...
function HTTPErrorf (line 301) | func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url...
function HTTPRedirectf (line 313) | func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, ...
function HTTPStatusCodef (line 325) | func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string...
function HTTPSuccessf (line 337) | func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, u...
function Implementsf (line 347) | func Implementsf(t TestingT, interfaceObject interface{}, object interfa...
function InDeltaf (line 357) | func InDeltaf(t TestingT, expected interface{}, actual interface{}, delt...
function InDeltaMapValuesf (line 365) | func InDeltaMapValuesf(t TestingT, expected interface{}, actual interfac...
function InDeltaSlicef (line 373) | func InDeltaSlicef(t TestingT, expected interface{}, actual interface{},...
function InEpsilonf (line 381) | func InEpsilonf(t TestingT, expected interface{}, actual interface{}, ep...
function InEpsilonSlicef (line 389) | func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{...
function IsDecreasingf (line 401) | func IsDecreasingf(t TestingT, object interface{}, msg string, args ...i...
function IsIncreasingf (line 413) | func IsIncreasingf(t TestingT, object interface{}, msg string, args ...i...
function IsNonDecreasingf (line 425) | func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ....
function IsNonIncreasingf (line 437) | func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ....
function IsTypef (line 445) | func IsTypef(t TestingT, expectedType interface{}, object interface{}, m...
function JSONEqf (line 455) | func JSONEqf(t TestingT, expected string, actual string, msg string, arg...
function Lenf (line 466) | func Lenf(t TestingT, object interface{}, length int, msg string, args ....
function Lessf (line 478) | func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...
function LessOrEqualf (line 491) | func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string...
function Negativef (line 502) | func Negativef(t TestingT, e interface{}, msg string, args ...interface{...
function Neverf (line 513) | func Neverf(t TestingT, condition func() bool, waitFor time.Duration, ti...
function Nilf (line 523) | func Nilf(t TestingT, object interface{}, msg string, args ...interface{...
function NoDirExistsf (line 532) | func NoDirExistsf(t TestingT, path string, msg string, args ...interface...
function NoErrorf (line 545) | func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bo...
function NoFileExistsf (line 554) | func NoFileExistsf(t TestingT, path string, msg string, args ...interfac...
function NotContainsf (line 567) | func NotContainsf(t TestingT, s interface{}, contains interface{}, msg s...
function NotEmptyf (line 580) | func NotEmptyf(t TestingT, object interface{}, msg string, args ...inter...
function NotEqualf (line 593) | func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg...
function NotEqualValuesf (line 603) | func NotEqualValuesf(t TestingT, expected interface{}, actual interface{...
function NotErrorIsf (line 612) | func NotErrorIsf(t TestingT, err error, target error, msg string, args ....
function NotNilf (line 622) | func NotNilf(t TestingT, object interface{}, msg string, args ...interfa...
function NotPanicsf (line 632) | func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interfa...
function NotRegexpf (line 643) | func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string,...
function NotSamef (line 656) | func NotSamef(t TestingT, expected interface{}, actual interface{}, msg ...
function NotSubsetf (line 667) | func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg st...
function NotZerof (line 675) | func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}...
function Panicsf (line 685) | func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{...
function PanicsWithErrorf (line 697) | func PanicsWithErrorf(t TestingT, errString string, f PanicTestFunc, msg...
function PanicsWithValuef (line 708) | func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc,...
function Positivef (line 719) | func Positivef(t TestingT, e interface{}, msg string, args ...interface{...
function Regexpf (line 730) | func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, ar...
function Samef (line 743) | func Samef(t TestingT, expected interface{}, actual interface{}, msg str...
function Subsetf (line 754) | func Subsetf(t TestingT, list interface{}, subset interface{}, msg strin...
function Truef (line 764) | func Truef(t TestingT, value bool, msg string, args ...interface{}) bool {
function WithinDurationf (line 774) | func WithinDurationf(t TestingT, expected time.Time, actual time.Time, d...
function WithinRangef (line 784) | func WithinRangef(t TestingT, actual time.Time, start time.Time, end tim...
function YAMLEqf (line 792) | func YAMLEqf(t TestingT, expected string, actual string, msg string, arg...
function Zerof (line 800) | func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) b...
FILE: vendor/github.com/stretchr/testify/assert/assertion_forward.go
method Condition (line 15) | func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{...
method Conditionf (line 23) | func (a *Assertions) Conditionf(comp Comparison, msg string, args ...int...
method Contains (line 36) | func (a *Assertions) Contains(s interface{}, contains interface{}, msgAn...
method Containsf (line 49) | func (a *Assertions) Containsf(s interface{}, contains interface{}, msg ...
method DirExists (line 58) | func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) b...
method DirExistsf (line 67) | func (a *Assertions) DirExistsf(path string, msg string, args ...interfa...
method ElementsMatch (line 79) | func (a *Assertions) ElementsMatch(listA interface{}, listB interface{},...
method ElementsMatchf (line 91) | func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}...
method Empty (line 102) | func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}...
method Emptyf (line 113) | func (a *Assertions) Emptyf(object interface{}, msg string, args ...inte...
method Equal (line 127) | func (a *Assertions) Equal(expected interface{}, actual interface{}, msg...
method EqualError (line 139) | func (a *Assertions) EqualError(theError error, errString string, msgAnd...
method EqualErrorf (line 151) | func (a *Assertions) EqualErrorf(theError error, errString string, msg s...
method EqualExportedValues (line 168) | func (a *Assertions) EqualExportedValues(expected interface{}, actual in...
method EqualExportedValuesf (line 185) | func (a *Assertions) EqualExportedValuesf(expected interface{}, actual i...
method EqualValues (line 196) | func (a *Assertions) EqualValues(expected interface{}, actual interface{...
method EqualValuesf (line 207) | func (a *Assertions) EqualValuesf(expected interface{}, actual interface...
method Equalf (line 221) | func (a *Assertions) Equalf(expected interface{}, actual interface{}, ms...
method Error (line 234) | func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool {
method ErrorAs (line 243) | func (a *Assertions) ErrorAs(err error, target interface{}, msgAndArgs ....
method ErrorAsf (line 252) | func (a *Assertions) ErrorAsf(err error, target interface{}, msg string,...
method ErrorContains (line 264) | func (a *Assertions) ErrorContains(theError error, contains string, msgA...
method ErrorContainsf (line 276) | func (a *Assertions) ErrorContainsf(theError error, contains string, msg...
method ErrorIs (line 285) | func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...inte...
method ErrorIsf (line 294) | func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...
method Errorf (line 307) | func (a *Assertions) Errorf(err error, msg string, args ...interface{}) ...
method Eventually (line 318) | func (a *Assertions) Eventually(condition func() bool, waitFor time.Dura...
method EventuallyWithT (line 343) | func (a *Assertions) EventuallyWithT(condition func(collect *CollectT), ...
method EventuallyWithTf (line 368) | func (a *Assertions) EventuallyWithTf(condition func(collect *CollectT),...
method Eventuallyf (line 379) | func (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Dur...
method Exactly (line 389) | func (a *Assertions) Exactly(expected interface{}, actual interface{}, m...
method Exactlyf (line 399) | func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, ...
method Fail (line 407) | func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface...
method FailNow (line 415) | func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interf...
method FailNowf (line 423) | func (a *Assertions) FailNowf(failureMessage string, msg string, args .....
method Failf (line 431) | func (a *Assertions) Failf(failureMessage string, msg string, args ...in...
method False (line 441) | func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool {
method Falsef (line 451) | func (a *Assertions) Falsef(value bool, msg string, args ...interface{})...
method FileExists (line 460) | func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) ...
method FileExistsf (line 469) | func (a *Assertions) FileExistsf(path string, msg string, args ...interf...
method Greater (line 481) | func (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...
method GreaterOrEqual (line 494) | func (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgA...
method GreaterOrEqualf (line 507) | func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg...
method Greaterf (line 519) | func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string...
method HTTPBodyContains (line 532) | func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method s...
method HTTPBodyContainsf (line 545) | func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method ...
method HTTPBodyNotContains (line 558) | func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, metho...
method HTTPBodyNotContainsf (line 571) | func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, meth...
method HTTPError (line 583) | func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, ...
method HTTPErrorf (line 595) | func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string,...
method HTTPRedirect (line 607) | func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method strin...
method HTTPRedirectf (line 619) | func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method stri...
method HTTPStatusCode (line 631) | func (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method str...
method HTTPStatusCodef (line 643) | func (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method st...
method HTTPSuccess (line 655) | func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string...
method HTTPSuccessf (line 667) | func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method strin...
method Implements (line 677) | func (a *Assertions) Implements(interfaceObject interface{}, object inte...
method Implementsf (line 687) | func (a *Assertions) Implementsf(interfaceObject interface{}, object int...
method InDelta (line 697) | func (a *Assertions) InDelta(expected interface{}, actual interface{}, d...
method InDeltaMapValues (line 705) | func (a *Assertions) InDeltaMapValues(expected interface{}, actual inter...
method InDeltaMapValuesf (line 713) | func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual inte...
method InDeltaSlice (line 721) | func (a *Assertions) InDeltaSlice(expected interface{}, actual interface...
method InDeltaSlicef (line 729) | func (a *Assertions) InDeltaSlicef(expected interface{}, actual interfac...
method InDeltaf (line 739) | func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, ...
method InEpsilon (line 747) | func (a *Assertions) InEpsilon(expected interface{}, actual interface{},...
method InEpsilonSlice (line 755) | func (a *Assertions) InEpsilonSlice(expected interface{}, actual interfa...
method InEpsilonSlicef (line 763) | func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interf...
method InEpsilonf (line 771) | func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}...
method IsDecreasing (line 783) | func (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...inte...
method IsDecreasingf (line 795) | func (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...
method IsIncreasing (line 807) | func (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...inte...
method IsIncreasingf (line 819) | func (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...
method IsNonDecreasing (line 831) | func (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...i...
method IsNonDecreasingf (line 843) | func (a *Assertions) IsNonDecreasingf(object interface{}, msg string, ar...
method IsNonIncreasing (line 855) | func (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...i...
method IsNonIncreasingf (line 867) | func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, ar...
method IsType (line 875) | func (a *Assertions) IsType(expectedType interface{}, object interface{}...
method IsTypef (line 883) | func (a *Assertions) IsTypef(expectedType interface{}, object interface{...
method JSONEq (line 893) | func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ....
method JSONEqf (line 903) | func (a *Assertions) JSONEqf(expected string, actual string, msg string,...
method Len (line 914) | func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...i...
method Lenf (line 925) | func (a *Assertions) Lenf(object interface{}, length int, msg string, ar...
method Less (line 937) | func (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ......
method LessOrEqual (line 950) | func (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndA...
method LessOrEqualf (line 963) | func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg st...
method Lessf (line 975) | func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, a...
method Negative (line 986) | func (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) ...
method Negativef (line 997) | func (a *Assertions) Negativef(e interface{}, msg string, args ...interf...
method Never (line 1008) | func (a *Assertions) Never(condition func() bool, waitFor time.Duration,...
method Neverf (line 1019) | func (a *Assertions) Neverf(condition func() bool, waitFor time.Duration...
method Nil (line 1029) | func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) ...
method Nilf (line 1039) | func (a *Assertions) Nilf(object interface{}, msg string, args ...interf...
method NoDirExists (line 1048) | func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{})...
method NoDirExistsf (line 1057) | func (a *Assertions) NoDirExistsf(path string, msg string, args ...inter...
method NoError (line 1070) | func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool {
method NoErrorf (line 1083) | func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}...
method NoFileExists (line 1092) | func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}...
method NoFileExistsf (line 1101) | func (a *Assertions) NoFileExistsf(path string, msg string, args ...inte...
method NotContains (line 1114) | func (a *Assertions) NotContains(s interface{}, contains interface{}, ms...
method NotContainsf (line 1127) | func (a *Assertions) NotContainsf(s interface{}, contains interface{}, m...
method NotEmpty (line 1140) | func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interfac...
method NotEmptyf (line 1153) | func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...i...
method NotEqual (line 1166) | func (a *Assertions) NotEqual(expected interface{}, actual interface{}, ...
method NotEqualValues (line 1176) | func (a *Assertions) NotEqualValues(expected interface{}, actual interfa...
method NotEqualValuesf (line 1186) | func (a *Assertions) NotEqualValuesf(expected interface{}, actual interf...
method NotEqualf (line 1199) | func (a *Assertions) NotEqualf(expected interface{}, actual interface{},...
method NotErrorIs (line 1208) | func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...i...
method NotErrorIsf (line 1217) | func (a *Assertions) NotErrorIsf(err error, target error, msg string, ar...
method NotNil (line 1227) | func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{...
method NotNilf (line 1237) | func (a *Assertions) NotNilf(object interface{}, msg string, args ...int...
method NotPanics (line 1247) | func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{...
method NotPanicsf (line 1257) | func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...int...
method NotRegexp (line 1268) | func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndAr...
method NotRegexpf (line 1279) | func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg str...
method NotSame (line 1292) | func (a *Assertions) NotSame(expected interface{}, actual interface{}, m...
method NotSamef (line 1305) | func (a *Assertions) NotSamef(expected interface{}, actual interface{}, ...
method NotSubset (line 1316) | func (a *Assertions) NotSubset(list interface{}, subset interface{}, msg...
method NotSubsetf (line 1327) | func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, ms...
method NotZero (line 1335) | func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) b...
method NotZerof (line 1343) | func (a *Assertions) NotZerof(i interface{}, msg string, args ...interfa...
method Panics (line 1353) | func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) ...
method PanicsWithError (line 1365) | func (a *Assertions) PanicsWithError(errString string, f PanicTestFunc, ...
method PanicsWithErrorf (line 1377) | func (a *Assertions) PanicsWithErrorf(errString string, f PanicTestFunc,...
method PanicsWithValue (line 1388) | func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFu...
method PanicsWithValuef (line 1399) | func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestF...
method Panicsf (line 1409) | func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interf...
method Positive (line 1420) | func (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) ...
method Positivef (line 1431) | func (a *Assertions) Positivef(e interface{}, msg string, args ...interf...
method Regexp (line 1442) | func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...
method Regexpf (line 1453) | func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string...
method Same (line 1466) | func (a *Assertions) Same(expected interface{}, actual interface{}, msgA...
method Samef (line 1479) | func (a *Assertions) Samef(expected interface{}, actual interface{}, msg...
method Subset (line 1490) | func (a *Assertions) Subset(list interface{}, subset interface{}, msgAnd...
method Subsetf (line 1501) | func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg s...
method True (line 1511) | func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool {
method Truef (line 1521) | func (a *Assertions) Truef(value bool, msg string, args ...interface{}) ...
method WithinDuration (line 1531) | func (a *Assertions) WithinDuration(expected time.Time, actual time.Time...
method WithinDurationf (line 1541) | func (a *Assertions) WithinDurationf(expected time.Time, actual time.Tim...
method WithinRange (line 1551) | func (a *Assertions) WithinRange(actual time.Time, start time.Time, end ...
method WithinRangef (line 1561) | func (a *Assertions) WithinRangef(actual time.Time, start time.Time, end...
method YAMLEq (line 1569) | func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ....
method YAMLEqf (line 1577) | func (a *Assertions) YAMLEqf(expected string, actual string, msg string,...
method Zero (line 1585) | func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool {
method Zerof (line 1593) | func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{...
FILE: vendor/github.com/stretchr/testify/assert/assertion_order.go
function isOrdered (line 9) | func isOrdered(t TestingT, object interface{}, allowedComparesResults []...
function IsIncreasing (line 52) | func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interfac...
function IsNonIncreasing (line 61) | func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...inter...
function IsDecreasing (line 70) | func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interfac...
function IsNonDecreasing (line 79) | func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...inter...
FILE: vendor/github.com/stretchr/testify/assert/assertions.go
type TestingT (line 28) | type TestingT interface
type ComparisonAssertionFunc (line 34) | type ComparisonAssertionFunc
type ValueAssertionFunc (line 38) | type ValueAssertionFunc
type BoolAssertionFunc (line 42) | type BoolAssertionFunc
type ErrorAssertionFunc (line 46) | type ErrorAssertionFunc
type Comparison (line 49) | type Comparison
function ObjectsAreEqual (line 58) | func ObjectsAreEqual(expected, actual interface{}) bool {
function copyExportedFields (line 80) | func copyExportedFields(expected interface{}) interface{} {
function ObjectsExportedFieldsAreEqual (line 143) | func ObjectsExportedFieldsAreEqual(expected, actual interface{}) bool {
function ObjectsAreEqualValues (line 151) | func ObjectsAreEqualValues(expected, actual interface{}) bool {
function CallerInfo (line 176) | func CallerInfo() []string {
function isTest (line 239) | func isTest(name, prefix string) bool {
function messageFromMsgAndArgs (line 250) | func messageFromMsgAndArgs(msgAndArgs ...interface{}) string {
function indentMessageLines (line 271) | func indentMessageLines(message string, longestLabelLen int) string {
type failNower (line 286) | type failNower interface
function FailNow (line 291) | func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{...
function Fail (line 312) | func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) ...
type labeledContent (line 338) | type labeledContent struct
function labeledOutput (line 352) | func labeledOutput(content ...labeledContent) string {
function Implements (line 369) | func Implements(t TestingT, interfaceObject interface{}, object interfac...
function IsType (line 386) | func IsType(t TestingT, expectedType interface{}, object interface{}, ms...
function Equal (line 405) | func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...inter...
function validateEqualArgs (line 428) | func validateEqualArgs(expected, actual interface{}) error {
function Same (line 445) | func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interf...
function NotSame (line 465) | func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...int...
function samePointers (line 480) | func samePointers(first, second interface{}) bool {
function formatUnequalValues (line 501) | func formatUnequalValues(expected, actual interface{}) (e string, a stri...
function truncatingFormat (line 517) | func truncatingFormat(data interface{}) string {
function EqualValues (line 530) | func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs .....
function EqualExportedValues (line 557) | func EqualExportedValues(t TestingT, expected, actual interface{}, msgAn...
function Exactly (line 594) | func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...int...
function NotNil (line 613) | func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) b...
function containsKind (line 624) | func containsKind(kinds []reflect.Kind, kind reflect.Kind) bool {
function isNil (line 635) | func isNil(object interface{}) bool {
function Nil (line 659) | func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
function isEmpty (line 670) | func isEmpty(object interface{}) bool {
function Empty (line 702) | func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bo...
function NotEmpty (line 721) | func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{})...
function getLen (line 736) | func getLen(x interface{}) (ok bool, length int) {
function Len (line 750) | func Len(t TestingT, object interface{}, length int, msgAndArgs ...inter...
function True (line 768) | func True(t TestingT, value bool, msgAndArgs ...interface{}) bool {
function False (line 783) | func False(t TestingT, value bool, msgAndArgs ...interface{}) bool {
function NotEqual (line 801) | func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...in...
function NotEqualValues (line 821) | func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs...
function containsElement (line 837) | func containsElement(list interface{}, element interface{}) (ok, found b...
function Contains (line 882) | func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interfa...
function NotContains (line 905) | func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...inte...
function Subset (line 926) | func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interfac...
function NotSubset (line 982) | func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...inter...
function ElementsMatch (line 1039) | func ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...i...
function isList (line 1061) | func isList(t TestingT, list interface{}, msgAndArgs ...interface{}) (ok...
function diffLists (line 1073) | func diffLists(listA, listB interface{}) (extraA, extraB []interface{}) {
function formatListDiff (line 1110) | func formatListDiff(listA, listB interface{}, extraA, extraB []interface...
function Condition (line 1131) | func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) b...
type PanicTestFunc (line 1144) | type PanicTestFunc
function didPanic (line 1147) | func didPanic(f PanicTestFunc) (didPanic bool, message interface{}, stac...
function Panics (line 1167) | func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
function PanicsWithValue (line 1183) | func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, ...
function PanicsWithError (line 1204) | func PanicsWithError(t TestingT, errString string, f PanicTestFunc, msgA...
function NotPanics (line 1224) | func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) b...
function WithinDuration (line 1239) | func WithinDuration(t TestingT, expected, actual time.Time, delta time.D...
function WithinRange (line 1255) | func WithinRange(t TestingT, actual, start, end time.Time, msgAndArgs .....
function toFloat (line 1273) | func toFloat(x interface{}) (float64, bool) {
function InDelta (line 1314) | func InDelta(t TestingT, expected, actual interface{}, delta float64, ms...
function InDeltaSlice (line 1347) | func InDeltaSlice(t TestingT, expected, actual interface{}, delta float6...
function InDeltaMapValues (line 1371) | func InDeltaMapValues(t TestingT, expected, actual interface{}, delta fl...
function calcRelativeError (line 1414) | func calcRelativeError(expected, actual interface{}) (float64, error) {
function InEpsilon (line 1437) | func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64...
function InEpsilonSlice (line 1457) | func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon fl...
function NoError (line 1490) | func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {
function Error (line 1507) | func Error(t TestingT, err error, msgAndArgs ...interface{}) bool {
function EqualError (line 1523) | func EqualError(t TestingT, theError error, errString string, msgAndArgs...
function ErrorContains (line 1546) | func ErrorContains(t TestingT, theError error, contains string, msgAndAr...
function matchRegexp (line 1563) | func matchRegexp(rx interface{}, str interface{}) bool {
function Regexp (line 1580) | func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...i...
function NotRegexp (line 1598) | func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ....
function Zero (line 1613) | func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {
function NotZero (line 1624) | func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {
function FileExists (line 1636) | func FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
function NoFileExists (line 1655) | func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) bo...
function DirExists (line 1671) | func DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
function NoDirExists (line 1690) | func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
function JSONEq (line 1710) | func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...in...
function YAMLEq (line 1728) | func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...in...
function typeAndKind (line 1745) | func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) {
function diff (line 1758) | func diff(expected interface{}, actual interface{}) string {
function isFunction (line 1801) | func isFunction(arg interface{}) bool {
type tHelper (line 1825) | type tHelper interface
function Eventually (line 1833) | func Eventually(t TestingT, condition func() bool, waitFor time.Duration...
type CollectT (line 1863) | type CollectT struct
method Errorf (line 1868) | func (c *CollectT) Errorf(format string, args ...interface{}) {
method FailNow (line 1873) | func (c *CollectT) FailNow() {
method Reset (line 1878) | func (c *CollectT) Reset() {
method Copy (line 1883) | func (c *CollectT) Copy(t TestingT) {
function EventuallyWithT (line 1910) | func EventuallyWithT(t TestingT, condition func(collect *CollectT), wait...
function Never (line 1949) | func Never(t TestingT, condition func() bool, waitFor time.Duration, tic...
function ErrorIs (line 1980) | func ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) b...
function NotErrorIs (line 2003) | func NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}...
function ErrorAs (line 2026) | func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...in...
function buildErrorChainString (line 2042) | func buildErrorChainString(err error) string {
FILE: vendor/github.com/stretchr/testify/assert/forward_assertions.go
type Assertions (line 5) | type Assertions struct
function New (line 10) | func New(t TestingT) *Assertions {
FILE: vendor/github.com/stretchr/testify/assert/http_assertions.go
function httpCode (line 13) | func httpCode(handler http.HandlerFunc, method, url string, values url.V...
function HTTPSuccess (line 29) | func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url strin...
function HTTPRedirect (line 51) | func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url stri...
function HTTPError (line 73) | func HTTPError(t TestingT, handler http.HandlerFunc, method, url string,...
function HTTPStatusCode (line 95) | func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url st...
function HTTPBody (line 114) | func HTTPBody(handler http.HandlerFunc, method, url string, values url.V...
function HTTPBodyContains (line 130) | func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url ...
function HTTPBodyNotContains (line 150) | func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, u...
FILE: vendor/github.com/stretchr/testify/mock/mock.go
type TestingT (line 22) | type TestingT interface
type Call (line 34) | type Call struct
method lock (line 94) | func (c *Call) lock() {
method unlock (line 98) | func (c *Call) unlock() {
method Return (line 105) | func (c *Call) Return(returnArguments ...interface{}) *Call {
method Panic (line 117) | func (c *Call) Panic(msg string) *Call {
method Once (line 129) | func (c *Call) Once() *Call {
method Twice (line 136) | func (c *Call) Twice() *Call {
method Times (line 144) | func (c *Call) Times(i int) *Call {
method WaitUntil (line 155) | func (c *Call) WaitUntil(w <-chan time.Time) *Call {
method After (line 165) | func (c *Call) After(d time.Duration) *Call {
method Run (line 180) | func (c *Call) Run(fn func(args Arguments)) *Call {
method Maybe (line 189) | func (c *Call) Maybe() *Call {
method On (line 204) | func (c *Call) On(methodName string, arguments ...interface{}) *Call {
method Unset (line 211) | func (c *Call) Unset() *Call {
method NotBefore (line 259) | func (c *Call) NotBefore(calls ...*Call) *Call {
function newCall (line 80) | func newCall(parent *Mock, methodName string, callerInfo []string, metho...
type Mock (line 276) | type Mock struct
method String (line 299) | func (m *Mock) String() string {
method TestData (line 305) | func (m *Mock) TestData() objx.Map {
method Test (line 318) | func (m *Mock) Test(t TestingT) {
method fail (line 327) | func (m *Mock) fail(format string, args ...interface{}) {
method On (line 342) | func (m *Mock) On(methodName string, arguments ...interface{}) *Call {
method findExpectedCall (line 360) | func (m *Mock) findExpectedCall(method string, arguments ...interface{...
method findClosestCall (line 405) | func (m *Mock) findClosestCall(method string, arguments ...interface{}...
method Called (line 447) | func (m *Mock) Called(arguments ...interface{}) Arguments {
method MethodCalled (line 471) | func (m *Mock) MethodCalled(methodName string, arguments ...interface{...
method AssertExpectations (line 594) | func (m *Mock) AssertExpectations(t TestingT) bool {
method checkExpectation (line 620) | func (m *Mock) checkExpectation(call *Call) (bool, string) {
method AssertNumberOfCalls (line 631) | func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expe...
method AssertCalled (line 648) | func (m *Mock) AssertCalled(t TestingT, methodName string, arguments ....
method AssertNotCalled (line 671) | func (m *Mock) AssertNotCalled(t TestingT, methodName string, argument...
method IsMethodCallable (line 686) | func (m *Mock) IsMethodCallable(t TestingT, methodName string, argumen...
method methodWasCalled (line 723) | func (m *Mock) methodWasCalled(methodName string, expected []interface...
method expectedCalls (line 740) | func (m *Mock) expectedCalls() []*Call {
method calls (line 744) | func (m *Mock) calls() []Call {
type matchCandidate (line 378) | type matchCandidate struct
method isBetterMatchThan (line 384) | func (c matchCandidate) isBetterMatchThan(other matchCandidate) bool {
function callString (line 426) | func callString(method string, arguments Arguments, includeArgumentValue...
type assertExpectationser (line 566) | type assertExpectationser interface
function AssertExpectationsForObjects (line 574) | func AssertExpectationsForObjects(t TestingT, testObjects ...interface{}...
function isArgsEqual (line 711) | func isArgsEqual(expected Arguments, args []interface{}) bool {
type Arguments (line 753) | type Arguments
method Get (line 885) | func (args Arguments) Get(index int) interface{} {
method Is (line 893) | func (args Arguments) Is(objects ...interface{}) bool {
method Diff (line 906) | func (args Arguments) Diff(objects []interface{}) (string, int) {
method Assert (line 1013) | func (args Arguments) Assert(t TestingT, objects ...interface{}) bool {
method String (line 1037) | func (args Arguments) String(indexOrNil ...int) string {
method Int (line 1061) | func (args Arguments) Int(index int) int {
method Error (line 1072) | func (args Arguments) Error(index int) error {
method Bool (line 1087) | func (args Arguments) Bool(index int) bool {
constant Anything (line 758) | Anything = "mock.Anything"
type AnythingOfTypeArgument (line 763) | type AnythingOfTypeArgument
function AnythingOfType (line 771) | func AnythingOfType(t string) AnythingOfTypeArgument {
type IsTypeArgument (line 778) | type IsTypeArgument struct
function IsType (line 788) | func IsType(t interface{}) *IsTypeArgument {
type FunctionalOptionsArgument (line 794) | type FunctionalOptionsArgument struct
method String (line 799) | func (f *FunctionalOptionsArgument) String() string {
function FunctionalOptions (line 814) | func FunctionalOptions(value ...interface{}) *FunctionalOptionsArgument {
type argumentMatcher (line 822) | type argumentMatcher struct
method Matches (line 827) | func (f argumentMatcher) Matches(argument interface{}) bool {
method String (line 853) | func (f argumentMatcher) String() string {
function MatchedBy (line 868) | func MatchedBy(fn interface{}) argumentMatcher {
function typeAndKind (line 1096) | func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) {
function diffArguments (line 1107) | func diffArguments(expected Arguments, actual Arguments) string {
function diff (line 1123) | func diff(expected interface{}, actual interface{}) string {
type tHelper (line 1162) | type tHelper interface
function assertOpts (line 1166) | func assertOpts(expected, actual interface{}) (expectedFmt, actualFmt st...
function funcName (line 1223) | func funcName(opt interface{}) string {
FILE: vendor/gopkg.in/yaml.v3/apic.go
function yaml_insert_token (line 29) | func yaml_insert_token(parser *yaml_parser_t, pos int, token *yaml_token...
function yaml_parser_initialize (line 49) | func yaml_parser_initialize(parser *yaml_parser_t) bool {
function yaml_parser_delete (line 58) | func yaml_parser_delete(parser *yaml_parser_t) {
function yaml_string_read_handler (line 63) | func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (n i...
function yaml_reader_read_handler (line 73) | func yaml_reader_read_handler(parser *yaml_parser_t, buffer []byte) (n i...
function yaml_parser_set_input_string (line 78) | func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) {
function yaml_parser_set_input_reader (line 88) | func yaml_parser_set_input_reader(parser *yaml_parser_t, r io.Reader) {
function yaml_parser_set_encoding (line 97) | func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encod...
function yaml_emitter_initialize (line 105) | func yaml_emitter_initialize(emitter *yaml_emitter_t) {
function yaml_emitter_delete (line 116) | func yaml_emitter_delete(emitter *yaml_emitter_t) {
function yaml_string_write_handler (line 121) | func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) e...
function yaml_writer_write_handler (line 128) | func yaml_writer_write_handler(emitter *yaml_emitter_t, buffer []byte) e...
function yaml_emitter_set_output_string (line 134) | func yaml_emitter_set_output_string(emitter *yaml_emitter_t, output_buff...
function yaml_emitter_set_output_writer (line 143) | func yaml_emitter_set_output_writer(emitter *yaml_emitter_t, w io.Writer) {
function yaml_emitter_set_encoding (line 152) | func yaml_emitter_set_encoding(emitter *yaml_emitter_t, encoding yaml_en...
function yaml_emitter_set_canonical (line 160) | func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) {
function yaml_emitter_set_indent (line 165) | func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) {
function yaml_emitter_set_width (line 173) | func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) {
function yaml_emitter_set_unicode (line 181) | func yaml_emitter_set_unicode(emitter *yaml_emitter_t, unicode bool) {
function yaml_emitter_set_break (line 186) | func yaml_emitter_set_break(emitter *yaml_emitter_t, line_break yaml_bre...
function yaml_stream_start_event_initialize (line 277) | func yaml_stream_start_event_initialize(event *yaml_event_t, encoding ya...
function yaml_stream_end_event_initialize (line 285) | func yaml_stream_end_event_initialize(event *yaml_event_t) {
function yaml_document_start_event_initialize (line 292) | func yaml_document_start_event_initialize(
function yaml_document_end_event_initialize (line 307) | func yaml_document_end_event_initialize(event *yaml_event_t, implicit bo...
function yaml_alias_event_initialize (line 315) | func yaml_alias_event_initialize(event *yaml_event_t, anchor []byte) bool {
function yaml_scalar_event_initialize (line 324) | func yaml_scalar_event_initialize(event *yaml_event_t, anchor, tag, valu...
function yaml_sequence_start_event_initialize (line 338) | func yaml_sequence_start_event_initialize(event *yaml_event_t, anchor, t...
function yaml_sequence_end_event_initialize (line 350) | func yaml_sequence_end_event_initialize(event *yaml_event_t) bool {
function yaml_mapping_start_event_initialize (line 358) | func yaml_mapping_start_event_initialize(event *yaml_event_t, anchor, ta...
function yaml_mapping_end_event_initialize (line 369) | func yaml_mapping_end_event_initialize(event *yaml_event_t) {
function yaml_event_delete (line 376) | func yaml_event_delete(event *yaml_event_t) {
FILE: vendor/gopkg.in/yaml.v3/decode.go
type parser (line 32) | type parser struct
method init (line 62) | func (p *parser) init() {
method destroy (line 71) | func (p *parser) destroy() {
method expect (line 80) | func (p *parser) expect(e yaml_event_type_t) {
method peek (line 99) | func (p *parser) peek() yaml_event_type_t {
method fail (line 112) | func (p *parser) fail() {
method anchor (line 140) | func (p *parser) anchor(n *Node, anchor []byte) {
method parse (line 147) | func (p *parser) parse() *Node {
method node (line 170) | func (p *parser) node(kind Kind, defaultTag, tag, value string) *Node {
method parseChild (line 196) | func (p *parser) parseChild(parent *Node) *Node {
method document (line 202) | func (p *parser) document() *Node {
method alias (line 214) | func (p *parser) alias() *Node {
method scalar (line 224) | func (p *parser) scalar() *Node {
method sequence (line 254) | func (p *parser) sequence() *Node {
method mapping (line 270) | func (p *parser) mapping() *Node {
function newParser (line 41) | func newParser(b []byte) *parser {
function newParserFromReader (line 53) | func newParserFromReader(r io.Reader) *parser {
type decoder (line 313) | type decoder struct
method terror (line 350) | func (d *decoder) terror(n *Node, tag string, out reflect.Value) {
method callUnmarshaler (line 365) | func (d *decoder) callUnmarshaler(n *Node, u Unmarshaler) (good bool) {
method callObsoleteUnmarshaler (line 377) | func (d *decoder) callObsoleteUnmarshaler(n *Node, u obsoleteUnmarshal...
method prepare (line 406) | func (d *decoder) prepare(n *Node, out reflect.Value) (newout reflect....
method fieldByIndex (line 435) | func (d *decoder) fieldByIndex(n *Node, v reflect.Value, index []int) ...
method unmarshal (line 484) | func (d *decoder) unmarshal(n *Node, out reflect.Value) (good bool) {
method document (line 524) | func (d *decoder) document(n *Node, out reflect.Value) (good bool) {
method alias (line 533) | func (d *decoder) alias(n *Node, out reflect.Value) (good bool) {
method null (line 554) | func (d *decoder) null(out reflect.Value) bool {
method scalar (line 565) | func (d *decoder) scalar(n *Node, out reflect.Value) bool {
method sequence (line 729) | func (d *decoder) sequence(n *Node, out reflect.Value) (good bool) {
method mapping (line 767) | func (d *decoder) mapping(n *Node, out reflect.Value) (good bool) {
method mappingStruct (line 878) | func (d *decoder) mappingStruct(n *Node, out reflect.Value) (good bool) {
method merge (line 959) | func (d *decoder) merge(parent *Node, merge *Node, out reflect.Value) {
function newDecoder (line 340) | func newDecoder() *decoder {
constant alias_ratio_range_low (line 458) | alias_ratio_range_low = 400000
constant alias_ratio_range_high (line 462) | alias_ratio_range_high = 4000000
constant alias_ratio_range (line 465) | alias_ratio_range = float64(alias_ratio_range_high - alias_ratio_range_low)
function allowedAliasRatio (line 468) | func allowedAliasRatio(decodeCount int) float64 {
function resetMap (line 548) | func resetMap(out reflect.Value) {
function settableValueOf (line 722) | func settableValueOf(i interface{}) reflect.Value {
function isStringMap (line 864) | func isStringMap(n *Node) bool {
function failWantMap (line 955) | func failWantMap() {
function isMerge (line 998) | func isMerge(n *Node) bool {
FILE: vendor/gopkg.in/yaml.v3/emitterc.go
function flush (line 31) | func flush(emitter *yaml_emitter_t) bool {
function put (line 39) | func put(emitter *yaml_emitter_t, value byte) bool {
function put_break (line 50) | func put_break(emitter *yaml_emitter_t) bool {
function write (line 79) | func write(emitter *yaml_emitter_t, s []byte, i *int) bool {
function write_all (line 107) | func write_all(emitter *yaml_emitter_t, s []byte) bool {
function write_break (line 117) | func write_break(emitter *yaml_emitter_t, s []byte, i *int) bool {
function yaml_emitter_set_emitter_error (line 139) | func yaml_emitter_set_emitter_error(emitter *yaml_emitter_t, problem str...
function yaml_emitter_emit (line 146) | func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool {
function yaml_emitter_need_more_events (line 169) | func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool {
function yaml_emitter_append_tag_directive (line 206) | func yaml_emitter_append_tag_directive(emitter *yaml_emitter_t, value *y...
function yaml_emitter_increase_indent (line 229) | func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentl...
function yaml_emitter_state_machine (line 251) | func yaml_emitter_state_machine(emitter *yaml_emitter_t, event *yaml_eve...
function yaml_emitter_emit_stream_start (line 318) | func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml...
function yaml_emitter_emit_document_start (line 359) | func yaml_emitter_emit_document_start(emitter *yaml_emitter_t, event *ya...
function yaml_emitter_emit_document_content (line 482) | func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *...
function yaml_emitter_emit_document_end (line 501) | func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml...
function yaml_emitter_emit_flow_sequence_item (line 532) | func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event...
function yaml_emitter_emit_flow_mapping_key (line 615) | func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *...
function yaml_emitter_emit_flow_mapping_value (line 691) | func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event...
function yaml_emitter_emit_block_sequence_item (line 729) | func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, even...
function yaml_emitter_emit_block_mapping_key (line 765) | func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event ...
function yaml_emitter_emit_block_mapping_value (line 803) | func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, even...
function yaml_emitter_silent_nil_event (line 850) | func yaml_emitter_silent_nil_event(emitter *yaml_emitter_t, event *yaml_...
function yaml_emitter_emit_node (line 855) | func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t,
function yaml_emitter_emit_alias (line 879) | func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_...
function yaml_emitter_emit_scalar (line 889) | func yaml_emitter_emit_scalar(emitter *yaml_emitter_t, event *yaml_event...
function yaml_emitter_emit_sequence_start (line 913) | func yaml_emitter_emit_sequence_start(emitter *yaml_emitter_t, event *ya...
function yaml_emitter_emit_mapping_start (line 930) | func yaml_emitter_emit_mapping_start(emitter *yaml_emitter_t, event *yam...
function yaml_emitter_check_empty_document (line 947) | func yaml_emitter_check_empty_document(emitter *yaml_emitter_t) bool {
function yaml_emitter_check_empty_sequence (line 952) | func yaml_emitter_check_empty_sequence(emitter *yaml_emitter_t) bool {
function yaml_emitter_check_empty_mapping (line 961) | func yaml_emitter_check_empty_mapping(emitter *yaml_emitter_t) bool {
function yaml_emitter_check_simple_key (line 970) | func yaml_emitter_check_simple_key(emitter *yaml_emitter_t) bool {
function yaml_emitter_select_scalar_style (line 1004) | func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *ya...
function yaml_emitter_process_anchor (line 1053) | func yaml_emitter_process_anchor(emitter *yaml_emitter_t) bool {
function yaml_emitter_process_tag (line 1068) | func yaml_emitter_process_tag(emitter *yaml_emitter_t) bool {
function yaml_emitter_process_scalar (line 1097) | func yaml_emitter_process_scalar(emitter *yaml_emitter_t) bool {
function yaml_emitter_process_head_comment (line 1118) | func yaml_emitter_process_head_comment(emitter *yaml_emitter_t) bool {
function yaml_emitter_process_line_comment (line 1147) | func yaml_emitter_process_line_comment(emitter *yaml_emitter_t) bool {
function yaml_emitter_process_foot_comment (line 1164) | func yaml_emitter_process_foot_comment(emitter *yaml_emitter_t) bool {
function yaml_emitter_analyze_version_directive (line 1183) | func yaml_emitter_analyze_version_directive(emitter *yaml_emitter_t, ver...
function yaml_emitter_analyze_tag_directive (line 1191) | func yaml_emitter_analyze_tag_directive(emitter *yaml_emitter_t, tag_dir...
function yaml_emitter_analyze_anchor (line 1215) | func yaml_emitter_analyze_anchor(emitter *yaml_emitter_t, anchor []byte,...
function yaml_emitter_analyze_tag (line 1238) | func yaml_emitter_analyze_tag(emitter *yaml_emitter_t, tag []byte) bool {
function yaml_emitter_analyze_scalar (line 1255) | func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) ...
function yaml_emitter_analyze_event (line 1409) | func yaml_emitter_analyze_event(emitter *yaml_emitter_t, event *yaml_eve...
function yaml_emitter_write_bom (line 1478) | func yaml_emitter_write_bom(emitter *yaml_emitter_t) bool {
function yaml_emitter_write_indent (line 1490) | func yaml_emitter_write_indent(emitter *yaml_emitter_t) bool {
function yaml_emitter_write_indicator (line 1517) | func yaml_emitter_write_indicator(emitter *yaml_emitter_t, indicator []b...
function yaml_emitter_write_anchor (line 1532) | func yaml_emitter_write_anchor(emitter *yaml_emitter_t, value []byte) bo...
function yaml_emitter_write_tag_handle (line 1541) | func yaml_emitter_write_tag_handle(emitter *yaml_emitter_t, value []byte...
function yaml_emitter_write_tag_content (line 1555) | func yaml_emitter_write_tag_content(emitter *yaml_emitter_t, value []byt...
function yaml_emitter_write_plain_scalar (line 1609) | func yaml_emitter_write_plain_scalar(emitter *yaml_emitter_t, value []by...
function yaml_emitter_write_single_quoted_scalar (line 1668) | func yaml_emitter_write_single_quoted_scalar(emitter *yaml_emitter_t, va...
function yaml_emitter_write_double_quoted_scalar (line 1727) | func yaml_emitter_write_double_quoted_scalar(emitter *yaml_emitter_t, va...
function yaml_emitter_write_block_scalar_hints (line 1848) | func yaml_emitter_write_block_scalar_hints(emitter *yaml_emitter_t, valu...
function yaml_emitter_write_literal_scalar (line 1890) | func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []...
function yaml_emitter_write_folded_scalar (line 1927) | func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []b...
function yaml_emitter_write_comment (line 1985) | func yaml_emitter_write_comment(emitter *yaml_emitter_t, comment []byte)...
FILE: vendor/gopkg.in/yaml.v3/encode.go
type encoder (line 31) | type encoder struct
method init (line 56) | func (e *encoder) init() {
method finish (line 69) | func (e *encoder) finish() {
method destroy (line 75) | func (e *encoder) destroy() {
method emit (line 79) | func (e *encoder) emit() {
method must (line 84) | func (e *encoder) must(ok bool) {
method marshalDoc (line 94) | func (e *encoder) marshalDoc(tag string, in reflect.Value) {
method marshal (line 111) | func (e *encoder) marshal(tag string, in reflect.Value) {
method mapv (line 186) | func (e *encoder) mapv(tag string, in reflect.Value) {
method fieldByIndex (line 197) | func (e *encoder) fieldByIndex(v reflect.Value, index []int) (field re...
method structv (line 214) | func (e *encoder) structv(tag string, in reflect.Value) {
method mappingv (line 256) | func (e *encoder) mappingv(tag string, f func()) {
method slicev (line 270) | func (e *encoder) slicev(tag string, in reflect.Value) {
method stringv (line 324) | func (e *encoder) stringv(tag string, in reflect.Value) {
method boolv (line 365) | func (e *encoder) boolv(tag string, in reflect.Value) {
method intv (line 375) | func (e *encoder) intv(tag string, in reflect.Value) {
method uintv (line 380) | func (e *encoder) uintv(tag string, in reflect.Value) {
method timev (line 385) | func (e *encoder) timev(tag string, in reflect.Value) {
method floatv (line 391) | func (e *encoder) floatv(tag string, in reflect.Value) {
method nilv (line 410) | func (e *encoder) nilv() {
method emitScalar (line 414) | func (e *encoder) emitScalar(value, anchor, tag string, style yaml_sca...
method nodev (line 428) | func (e *encoder) nodev(in reflect.Value) {
method node (line 432) | func (e *encoder) node(node *Node, tail string) {
function newEncoder (line 40) | func newEncoder() *encoder {
function newEncoderWithWriter (line 48) | func newEncoderWithWriter(w io.Writer) *encoder {
function isBase60Float (line 292) | func isBase60Float(s string) (result bool) {
function isOldBool (line 314) | func isOldBool(s string) (result bool) {
FILE: vendor/gopkg.in/yaml.v3/parserc.go
function peek_token (line 68) | func peek_token(parser *yaml_parser_t) *yaml_token_t {
function yaml_parser_unfold_comments (line 80) | func yaml_parser_unfold_comments(parser *yaml_parser_t, token *yaml_toke...
function skip_token (line 111) | func skip_token(parser *yaml_parser_t) {
function yaml_parser_parse (line 119) | func yaml_parser_parse(parser *yaml_parser_t, event *yaml_event_t) bool {
function yaml_parser_set_parser_error (line 133) | func yaml_parser_set_parser_error(parser *yaml_parser_t, problem string,...
function yaml_parser_set_parser_error_context (line 140) | func yaml_parser_set_parser_error_context(parser *yaml_parser_t, context...
function yaml_parser_state_machine (line 150) | func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_...
function yaml_parser_parse_stream_start (line 231) | func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_e...
function yaml_parser_parse_document_start (line 255) | func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml...
function yaml_parser_parse_document_content (line 361) | func yaml_parser_parse_document_content(parser *yaml_parser_t, event *ya...
function yaml_parser_parse_document_end (line 385) | func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_e...
function yaml_parser_set_event_comments (line 418) | func yaml_parser_set_event_comments(parser *yaml_parser_t, event *yaml_e...
function yaml_parser_parse_node (line 455) | func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, ...
function yaml_parser_parse_block_sequence_entry (line 687) | func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event...
function yaml_parser_parse_indentless_sequence_entry (line 744) | func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, ...
function yaml_parser_split_stem_comment (line 786) | func yaml_parser_split_stem_comment(parser *yaml_parser_t, stem_len int) {
function yaml_parser_parse_block_mapping_key (line 816) | func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *y...
function yaml_parser_parse_block_mapping_value (line 891) | func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event ...
function yaml_parser_parse_flow_sequence_entry (line 928) | func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event ...
function yaml_parser_parse_flow_sequence_entry_mapping_key (line 995) | func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_pars...
function yaml_parser_parse_flow_sequence_entry_mapping_value (line 1016) | func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_pa...
function yaml_parser_parse_flow_sequence_entry_mapping_end (line 1040) | func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_pars...
function yaml_parser_parse_flow_mapping_key (line 1066) | func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *ya...
function yaml_parser_parse_flow_mapping_value (line 1133) | func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *...
function yaml_parser_process_empty_scalar (line 1158) | func yaml_parser_process_empty_scalar(parser *yaml_parser_t, event *yaml...
function yaml_parser_process_directives (line 1176) | func yaml_parser_process_directives(parser *yaml_parser_t,
function yaml_parser_append_tag_directive (line 1238) | func yaml_parser_append_tag_directive(parser *yaml_parser_t, value yaml_...
FILE: vendor/gopkg.in/yaml.v3/readerc.go
function yaml_parser_set_reader_error (line 30) | func yaml_parser_set_reader_error(parser *yaml_parser_t, problem string,...
constant bom_UTF8 (line 40) | bom_UTF8 = "\xef\xbb\xbf"
constant bom_UTF16LE (line 41) | bom_UTF16LE = "\xff\xfe"
constant bom_UTF16BE (line 42) | bom_UTF16BE = "\xfe\xff"
function yaml_parser_determine_encoding (line 47) | func yaml_parser_determine_encoding(parser *yaml_parser_t) bool {
function yaml_parser_update_raw_buffer (line 78) | func yaml_parser_update_raw_buffer(parser *yaml_parser_t) bool {
function yaml_parser_update_buffer (line 113) | func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool {
FILE: vendor/gopkg.in/yaml.v3/resolve.go
type resolveMapItem (line 27) | type resolveMapItem struct
function init (line 35) | func init() {
constant nullTag (line 71) | nullTag = "!!null"
constant boolTag (line 72) | boolTag = "!!bool"
constant strTag (line 73) | strTag = "!!str"
constant intTag (line 74) | intTag = "!!int"
constant floatTag (line 75) | floatTag = "!!float"
constant timestampTag (line 76) | timestampTag = "!!timestamp"
constant seqTag (line 77) | seqTag = "!!seq"
constant mapTag (line 78) | mapTag = "!!map"
constant binaryTag (line 79) | binaryTag = "!!binary"
constant mergeTag (line 80) | mergeTag = "!!merge"
function init (line 86) | func init() {
constant longTagPrefix (line 94) | longTagPrefix = "tag:yaml.org,2002:"
function shortTag (line 96) | func shortTag(tag string) string {
function longTag (line 106) | func longTag(tag string) string {
function resolvableTag (line 116) | func resolvableTag(tag string) bool {
function resolve (line 126) | func resolve(tag string, in string) (rtag string, out interface{}) {
function encodeBase64 (line 269) | func encodeBase64(s string) string {
function parseTimestamp (line 306) | func parseTimestamp(s string) (time.Time, bool) {
FILE: vendor/gopkg.in/yaml.v3/scannerc.go
function cache (line 507) | func cache(parser *yaml_parser_t, length int) bool {
function skip (line 513) | func skip(parser *yaml_parser_t) {
function skip_line (line 523) | func skip_line(parser *yaml_parser_t) {
function read (line 542) | func read(parser *yaml_parser_t, s []byte) []byte {
function read_line (line 568) | func read_line(parser *yaml_parser_t, s []byte) []byte {
function yaml_parser_scan (line 602) | func yaml_parser_scan(parser *yaml_parser_t, token *yaml_token_t) bool {
function yaml_parser_set_scanner_error (line 631) | func yaml_parser_set_scanner_error(parser *yaml_parser_t, context string...
function yaml_parser_set_scanner_tag_error (line 640) | func yaml_parser_set_scanner_tag_error(parser *yaml_parser_t, directive ...
function trace (line 648) | func trace(args ...interface{}) func() {
function yaml_parser_fetch_more_tokens (line 657) | func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool {
function yaml_parser_fetch_next_token (line 687) | func yaml_parser_fetch_next_token(parser *yaml_parser_t) (ok bool) {
function yaml_simple_key_is_valid (line 883) | func yaml_simple_key_is_valid(parser *yaml_parser_t, simple_key *yaml_si...
function yaml_parser_save_simple_key (line 911) | func yaml_parser_save_simple_key(parser *yaml_parser_t) bool {
function yaml_parser_remove_simple_key (line 939) | func yaml_parser_remove_simple_key(parser *yaml_parser_t) bool {
constant max_flow_level (line 956) | max_flow_level = 10000
function yaml_parser_increase_flow_level (line 959) | func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool {
function yaml_parser_decrease_flow_level (line 979) | func yaml_parser_decrease_flow_level(parser *yaml_parser_t) bool {
constant max_indents (line 990) | max_indents = 10000
function yaml_parser_roll_indent (line 995) | func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, ...
function yaml_parser_unroll_indent (line 1029) | func yaml_parser_unroll_indent(parser *yaml_parser_t, column int, scan_m...
function yaml_parser_fetch_stream_start (line 1083) | func yaml_parser_fetch_stream_start(parser *yaml_parser_t) bool {
function yaml_parser_fetch_stream_end (line 1111) | func yaml_parser_fetch_stream_end(parser *yaml_parser_t) bool {
function yaml_parser_fetch_directive (line 1142) | func yaml_parser_fetch_directive(parser *yaml_parser_t) bool {
function yaml_parser_fetch_document_indicator (line 1166) | func yaml_parser_fetch_document_indicator(parser *yaml_parser_t, typ yam...
function yaml_parser_fetch_flow_collection_start (line 1200) | func yaml_parser_fetch_flow_collection_start(parser *yaml_parser_t, typ ...
function yaml_parser_fetch_flow_collection_end (line 1232) | func yaml_parser_fetch_flow_collection_end(parser *yaml_parser_t, typ ya...
function yaml_parser_fetch_flow_entry (line 1264) | func yaml_parser_fetch_flow_entry(parser *yaml_parser_t) bool {
function yaml_parser_fetch_block_entry (line 1289) | func yaml_parser_fetch_block_entry(parser *yaml_parser_t) bool {
function yaml_parser_fetch_key (line 1331) | func yaml_parser_fetch_key(parser *yaml_parser_t) bool {
function yaml_parser_fetch_value (line 1370) | func yaml_parser_fetch_value(parser *yaml_parser_t) bool {
function yaml_parser_fetch_anchor (line 1440) | func yaml_parser_fetch_anchor(parser *yaml_parser_t, typ yaml_token_type...
function yaml_parser_fetch_tag (line 1459) | func yaml_parser_fetch_tag(parser *yaml_parser_t) bool {
function yaml_parser_fetch_block_scalar (line 1478) | func yaml_parser_fetch_block_scalar(parser *yaml_parser_t, literal bool)...
function yaml_parser_fetch_flow_scalar (line 1497) | func yaml_parser_fetch_flow_scalar(parser *yaml_parser_t, single bool) b...
function yaml_parser_fetch_plain_scalar (line 1516) | func yaml_parser_fetch_plain_scalar(parser *yaml_parser_t) bool {
function yaml_parser_scan_to_next_token (line 1535) | func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool {
function yaml_parser_scan_directive (line 1622) | func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token...
function yaml_parser_scan_directive_name (line 1727) | func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark y...
function yaml_parser_scan_version_directive_value (line 1763) | func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, sta...
constant max_number_length (line 1795) | max_number_length = 2
function yaml_parser_scan_version_directive_number (line 1804) | func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, st...
function yaml_parser_scan_tag_directive_value (line 1840) | func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_m...
function yaml_parser_scan_anchor (line 1898) | func yaml_parser_scan_anchor(parser *yaml_parser_t, token *yaml_token_t,...
function yaml_parser_scan_tag (line 1956) | func yaml_parser_scan_tag(parser *yaml_parser_t, token *yaml_token_t) bo...
function yaml_parser_scan_tag_handle (line 2041) | func yaml_parser_scan_tag_handle(parser *yaml_parser_t, directive bool, ...
function yaml_parser_scan_tag_uri (line 2086) | func yaml_parser_scan_tag_uri(parser *yaml_parser_t, directive bool, hea...
function yaml_parser_scan_uri_escapes (line 2144) | func yaml_parser_scan_uri_escapes(parser *yaml_parser_t, directive bool,...
function yaml_parser_scan_block_scalar (line 2190) | func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_to...
function yaml_parser_scan_block_scalar_breaks (line 2381) | func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, indent ...
function yaml_parser_scan_flow_scalar (line 2435) | func yaml_parser_scan_flow_scalar(parser *yaml_parser_t, token *yaml_tok...
function yaml_parser_scan_plain_scalar (line 2691) | func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_to...
function yaml_parser_scan_line_comment (line 2834) | func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yam...
function yaml_parser_scan_comments (line 2885) | func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mar...
FILE: vendor/gopkg.in/yaml.v3/sorter.go
type keyList (line 23) | type keyList
method Len (line 25) | func (l keyList) Len() int { return len(l) }
method Swap (line 26) | func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
method Less (line 27) | func (l keyList) Less(i, j int) bool {
function keyFloat (line 103) | func keyFloat(v reflect.Value) (f float64, ok bool) {
function numLess (line 122) | func numLess(a, b reflect.Value) bool {
FILE: vendor/gopkg.in/yaml.v3/writerc.go
function yaml_emitter_set_writer_error (line 26) | func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem stri...
function yaml_emitter_flush (line 33) | func yaml_emitter_flush(emitter *yaml_emitter_t) bool {
FILE: vendor/gopkg.in/yaml.v3/yaml.go
type Unmarshaler (line 36) | type Unmarshaler interface
type obsoleteUnmarshaler (line 40) | type obsoleteUnmarshaler interface
type Marshaler (line 50) | type Marshaler interface
function Unmarshal (line 88) | func Unmarshal(in []byte, out interface{}) (err error) {
type Decoder (line 93) | type Decoder struct
method KnownFields (line 110) | func (dec *Decoder) KnownFields(enable bool) {
method Decode (line 119) | func (dec *Decoder) Decode(v interface{}) (err error) {
function NewDecoder (line 102) | func NewDecoder(r io.Reader) *Decoder {
function unmarshal (line 156) | func unmarshal(in []byte, out interface{}, strict bool) (err error) {
function Marshal (line 218) | func Marshal(in interface{}) (out []byte, err error) {
type Encoder (line 229) | type Encoder struct
method Encode (line 249) | func (e *Encoder) Encode(v interface{}) (err error) {
method SetIndent (line 274) | func (e *Encoder) SetIndent(spaces int) {
method Close (line 283) | func (e *Encoder) Close() (err error) {
function NewEncoder (line 236) | func NewEncoder(w io.Writer) *Encoder {
function handleErr (line 289) | func handleErr(err *error) {
type yamlError (line 299) | type yamlError struct
function fail (line 303) | func fail(err error) {
function failf (line 307) | func failf(format string, args ...interface{}) {
type TypeError (line 315) | type TypeError struct
method Error (line 319) | func (e *TypeError) Error() string {
type Kind (line 323) | type Kind
constant DocumentNode (line 326) | DocumentNode Kind = 1 << iota
constant SequenceNode (line 327) | SequenceNode
constant MappingNode (line 328) | MappingNode
constant ScalarNode (line 329) | ScalarNode
constant AliasNode (line 330) | AliasNode
type Style (line 333) | type Style
constant TaggedStyle (line 336) | TaggedStyle Style = 1 << iota
constant DoubleQuotedStyle (line 337) | DoubleQuotedStyle
constant SingleQuotedStyle (line 338) | SingleQuotedStyle
constant LiteralStyle (line 339) | LiteralStyle
constant FoldedStyle (line 340) | FoldedStyle
constant FlowStyle (line 341) | FlowStyle
type Node (line 372) | type Node struct
method Decode (line 142) | func (n *Node) Decode(v interface{}) (err error) {
method Encode (line 259) | func (n *Node) Encode(v interface{}) (err error) {
method IsZero (line 419) | func (n *Node) IsZero() bool {
method LongTag (line 428) | func (n *Node) LongTag() string {
method ShortTag (line 435) | func (n *Node) ShortTag() string {
method indicatedString (line 463) | func (n *Node) indicatedString() bool {
method SetString (line 471) | func (n *Node) SetString(s string) {
type structInfo (line 492) | type structInfo struct
type fieldInfo (line 505) | type fieldInfo struct
function init (line 522) | func init() {
function getStructInfo (line 527) | func getStructInfo(st reflect.Type) (*structInfo, error) {
type IsZeroer (line 656) | type IsZeroer interface
function isZero (line 660) | func isZero(v reflect.Value) bool {
FILE: vendor/gopkg.in/yaml.v3/yamlh.go
type yaml_version_directive_t (line 31) | type yaml_version_directive_t struct
type yaml_tag_directive_t (line 37) | type yaml_tag_directive_t struct
type yaml_encoding_t (line 42) | type yaml_encoding_t
constant yaml_ANY_ENCODING (line 47) | yaml_ANY_ENCODING yaml_encoding_t = iota
constant yaml_UTF8_ENCODING (line 49) | yaml_UTF8_ENCODING
constant yaml_UTF16LE_ENCODING (line 50) | yaml_UTF16LE_ENCODING
constant yaml_UTF16BE_ENCODING (line 51) | yaml_UTF16BE_ENCODING
type yaml_break_t (line 54) | type yaml_break_t
constant yaml_ANY_BREAK (line 59) | yaml_ANY_BREAK yaml_break_t = iota
constant yaml_CR_BREAK (line 61) | yaml_CR_BREAK
constant yaml_LN_BREAK (line 62) | yaml_LN_BREAK
constant yaml_CRLN_BREAK (line 63) | yaml_CRLN_BREAK
type yaml_error_type_t (line 66) | type yaml_error_type_t
constant yaml_NO_ERROR (line 71) | yaml_NO_ERROR yaml_error_type_t = iota
constant yaml_MEMORY_ERROR (line 73) | yaml_MEMORY_ERROR
constant yaml_READER_ERROR (line 74) | yaml_READER_ERROR
constant yaml_SCANNER_ERROR (line 75) | yaml_SCANNER_ERROR
constant yaml_PARSER_ERROR (line 76) | yaml_PARSER_ERROR
constant yaml_COMPOSER_ERROR (line 77) | yaml_COMPOSER_ERROR
constant yaml_WRITER_ERROR (line 78) | yaml_WRITER_ERROR
constant yaml_EMITTER_ERROR (line 79) | yaml_EMITTER_ERROR
type yaml_mark_t (line 83) | type yaml_mark_t struct
type yaml_style_t (line 91) | type yaml_style_t
type yaml_scalar_style_t (line 93) | type yaml_scalar_style_t
constant yaml_ANY_SCALAR_STYLE (line 98) | yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = 0
constant yaml_PLAIN_SCALAR_STYLE (line 100) | yaml_PLAIN_SCALAR_STYLE yaml_scalar_style_t = 1 << iota
constant yaml_SINGLE_QUOTED_SCALAR_STYLE (line 101) | yaml_SINGLE_QUOTED_SCALAR_STYLE
constant yaml_DOUBLE_QUOTED_SCALAR_STYLE (line 102) | yaml_DOUBLE_QUOTED_SCALAR_STYLE
constant yaml_LITERAL_SCALAR_STYLE (line 103) | yaml_LITERAL_SCALAR_STYLE
constant yaml_FOLDED_SCALAR_STYLE (line 104) | yaml_FOLDED_SCALAR_STYLE
type yaml_sequence_style_t (line 107) | type yaml_sequence_style_t
constant yaml_ANY_SEQUENCE_STYLE (line 112) | yaml_ANY_SEQUENCE_STYLE yaml_sequence_style_t = iota
constant yaml_BLOCK_SEQUENCE_STYLE (line 114) | yaml_BLOCK_SEQUENCE_STYLE
constant yaml_FLOW_SEQUENCE_STYLE (line 115) | yaml_FLOW_SEQUENCE_STYLE
type yaml_mapping_style_t (line 118) | type yaml_mapping_style_t
constant yaml_ANY_MAPPING_STYLE (line 123) | yaml_ANY_MAPPING_STYLE yaml_mapping_style_t = iota
constant yaml_BLOCK_MAPPING_STYLE (line 125) | yaml_BLOCK_MAPPING_STYLE
constant yaml_FLOW_MAPPING_STYLE (line 126) | yaml_FLOW_MAPPING_STYLE
type yaml_token_type_t (line 131) | type yaml_token_type_t
method String (line 166) | func (tt yaml_token_type_t) String() string {
constant yaml_NO_TOKEN (line 136) | yaml_NO_TOKEN yaml_token_type_t = iota
constant yaml_STREAM_START_TOKEN (line 138) | yaml_STREAM_START_TOKEN
constant yaml_STREAM_END_TOKEN (line 139) | yaml_STREAM_END_TOKEN
constant yaml_VERSION_DIRECTIVE_TOKEN (line 141) | yaml_VERSION_DIRECTIVE_TOKEN
constant yaml_TAG_DIRECTIVE_TOKEN (line 142) | yaml_TAG_DIRECTIVE_TOKEN
constant yaml_DOCUMENT_START_TOKEN (line 143) | yaml_DOCUMENT_START_TOKEN
constant yaml_DOCUMENT_END_TOKEN (line 144) | yaml_DOCUMENT_END_TOKEN
constant yaml_BLOCK_SEQUENCE_START_TOKEN (line 146) | yaml_BLOCK_SEQUENCE_START_TOKEN
constant yaml_BLOCK_MAPPING_START_TOKEN (line 147) | yaml_BLOCK_MAPPING_START_TOKEN
constant yaml_BLOCK_END_TOKEN (line 148) | yaml_BLOCK_END_TOKEN
constant yaml_FLOW_SEQUENCE_START_TOKEN (line 150) | yaml_FLOW_SEQUENCE_START_TOKEN
constant yaml_FLOW_SEQUENCE_END_TOKEN (line 151) | yaml_FLOW_SEQUENCE_END_TOKEN
constant yaml_FLOW_MAPPING_START_TOKEN (line 152) | yaml_FLOW_MAPPING_START_TOKEN
constant yaml_FLOW_MAPPING_END_TOKEN (line 153) | yaml_FLOW_MAPPING_END_TOKEN
constant yaml_BLOCK_ENTRY_TOKEN (line 155) | yaml_BLOCK_ENTRY_TOKEN
constant yaml_FLOW_ENTRY_TOKEN (line 156) | yaml_FLOW_ENTRY_TOKEN
constant yaml_KEY_TOKEN (line 157) | yaml_KEY_TOKEN
constant yaml_VALUE_TOKEN (line 158) | yaml_VALUE_TOKEN
constant yaml_ALIAS_TOKEN (line 160) | yaml_ALIAS_TOKEN
constant yaml_ANCHOR_TOKEN (line 161) | yaml_ANCHOR_TOKEN
constant yaml_TAG_TOKEN (line 162) | yaml_TAG_TOKEN
constant yaml_SCALAR_TOKEN (line 163) | yaml_SCALAR_TOKEN
type yaml_token_t (line 217) | type yaml_token_t struct
type yaml_event_type_t (line 246) | type yaml_event_type_t
method String (line 281) | func (e yaml_event_type_t) String() string {
constant yaml_NO_EVENT (line 251) | yaml_NO_EVENT yaml_event_type_t = iota
constant yaml_STREAM_START_EVENT (line 253) | yaml_STREAM_START_EVENT
constant yaml_STREAM_END_EVENT (line 254) | yaml_STREAM_END_EVENT
constant yaml_DOCUMENT_START_EVENT (line 255) | yaml_DOCUMENT_START_EVENT
constant yaml_DOCUMENT_END_EVENT (line 256) | yaml_DOCUMENT_END_EVENT
constant yaml_ALIAS_EVENT (line 257) | yaml_ALIAS_EVENT
constant yaml_SCALAR_EVENT (line 258) | yaml_SCALAR_EVENT
constant yaml_SEQUENCE_START_EVENT (line 259) | yaml_SEQUENCE_START_EVENT
constant yaml_SEQUENCE_END_EVENT (line 260) | yaml_SEQUENCE_END_EVENT
constant yaml_MAPPING_START_EVENT (line 261) | yaml_MAPPING_START_EVENT
constant yaml_MAPPING_END_EVENT (line 262) | yaml_MAPPING_END_EVENT
constant yaml_TAIL_COMMENT_EVENT (line 263) | yaml_TAIL_COMMENT_EVENT
type yaml_event_t (line 289) | type yaml_event_t struct
method scalar_style (line 332) | func (e *yaml_event_t) scalar_style() yaml_scalar_style_t { return...
method sequence_style (line 333) | func (e *yaml_event_t) sequence_style() yaml_sequence_style_t { return...
method mapping_style (line 334) | func (e *yaml_event_t) mapping_style() yaml_mapping_style_t { return...
constant yaml_NULL_TAG (line 339) | yaml_NULL_TAG = "tag:yaml.org,2002:null"
constant yaml_BOOL_TAG (line 340) | yaml_BOOL_TAG = "tag:yaml.org,2002:bool"
constant yaml_STR_TAG (line 341) | yaml_STR_TAG = "tag:yaml.org,2002:str"
constant yaml_INT_TAG (line 342) | yaml_INT_TAG = "tag:yaml.org,2002:int"
constant yaml_FLOAT_TAG (line 343) | yaml_FLOAT_TAG = "tag:yaml.org,2002:float"
constant yaml_TIMESTAMP_TAG (line 344) | yaml_TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp"
constant yaml_SEQ_TAG (line 346) | yaml_SEQ_TAG = "tag:yaml.org,2002:seq"
constant yaml_MAP_TAG (line 347) | yaml_MAP_TAG = "tag:yaml.org,2002:map"
constant yaml_BINARY_TAG (line 350) | yaml_BINARY_TAG = "tag:yaml.org,2002:binary"
constant yaml_MERGE_TAG (line 351) | yaml_MERGE_TAG = "tag:yaml.org,2002:merge"
constant yaml_DEFAULT_SCALAR_TAG (line 353) | yaml_DEFAULT_SCALAR_TAG = yaml_STR_TAG
constant yaml_DEFAULT_SEQUENCE_TAG (line 354) | yaml_DEFAULT_SEQUENCE_TAG = yaml_SEQ_TAG
constant yaml_DEFAULT_MAPPING_TAG (line 355) | yaml_DEFAULT_MAPPING_TAG = yaml_MAP_TAG
type yaml_node_type_t (line 358) | type yaml_node_type_t
constant yaml_NO_NODE (line 363) | yaml_NO_NODE yaml_node_type_t = iota
constant yaml_SCALAR_NODE (line 365) | yaml_SCALAR_NODE
constant yaml_SEQUENCE_NODE (line 366) | yaml_SEQUENCE_NODE
constant yaml_MAPPING_NODE (line 367) | yaml_MAPPING_NODE
type yaml_node_item_t (line 371) | type yaml_node_item_t
type yaml_node_pair_t (line 374) | type yaml_node_pair_t struct
type yaml_node_t (line 380) | type yaml_node_t struct
type yaml_document_t (line 414) | type yaml_document_t struct
type yaml_read_handler_t (line 449) | type yaml_read_handler_t
type yaml_simple_key_t (line 452) | type yaml_simple_key_t struct
type yaml_parser_state_t (line 460) | type yaml_parser_state_t
method String (line 490) | func (ps yaml_parser_state_t) String() string {
constant yaml_PARSE_STREAM_START_STATE (line 463) | yaml_PARSE_STREAM_START_STATE yaml_parser_state_t = iota
constant yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE (line 465) | yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE
constant yaml_PARSE_DOCUMENT_START_STATE (line 466) | yaml_PARSE_DOCUMENT_START_STATE
constant yaml_PARSE_DOCUMENT_CONTENT_STATE (line 467) | yaml_PARSE_DOCUMENT_CONTENT_STATE
constant yaml_PARSE_DOCUMENT_END_STATE (line 468) | yaml_PARSE_DOCUMENT_END_STATE
constant yaml_PARSE_BLOCK_NODE_STATE (line 469) | yaml_PARSE_BLOCK_NODE_STATE
constant yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE (line 470) | yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE
constant yaml_PARSE_FLOW_NODE_STATE (line 471) | yaml_PARSE_FLOW_NODE_STATE
constant yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE (line 472) | yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE
constant yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE (line 473) | yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE
constant yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE (line 474) | yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE
constant yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE (line 475) | yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE
constant yaml_PARSE_BLOCK_MAPPING_KEY_STATE (line 476) | yaml_PARSE_BLOCK_MAPPING_KEY_STATE
constant yaml_PARSE_BLOCK_MAPPING_VALUE_STATE (line 477) | yaml_PARSE_BLOCK_MAPPING_VALUE_STATE
constant yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE (line 478) | yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE
constant yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE (line 479) | yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE
constant yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE (line 480) | yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE
constant yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE (line 481) | yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE
constant yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE (line 482) | yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE
constant yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE (line 483) | yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE
constant yaml_PARSE_FLOW_MAPPING_KEY_STATE (line 484) | yaml_PARSE_FLOW_MAPPING_KEY_STATE
constant yaml_PARSE_FLOW_MAPPING_VALUE_STATE (line 485) | yaml_PARSE_FLOW_MAPPING_VALUE_STATE
constant yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE (line 486) | yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE
constant yaml_PARSE_END_STATE (line 487) | yaml_PARSE_END_STATE
type yaml_alias_data_t (line 545) | type yaml_alias_data_t struct
type yaml_parser_t (line 555) | type yaml_parser_t struct
type yaml_comment_t (line 641) | type yaml_comment_t struct
type yaml_write_handler_t (line 669) | type yaml_write_handler_t
type yaml_emitter_state_t (line 671) | type yaml_emitter_state_t
constant yaml_EMIT_STREAM_START_STATE (line 676) | yaml_EMIT_STREAM_START_STATE yaml_emitter_state_t = iota
constant yaml_EMIT_FIRST_DOCUMENT_START_STATE (line 678) | yaml_EMIT_FIRST_DOCUMENT_START_STATE
constant yaml_EMIT_DOCUMENT_START_STATE (line 679) | yaml_EMIT_DOCUMENT_START_STATE
constant yaml_EMIT_DOCUMENT_CONTENT_STATE (line 680) | yaml_EMIT_DOCUMENT_CONTENT_STATE
constant yaml_EMIT_DOCUMENT_END_STATE (line 681) | yaml_EMIT_DOCUMENT_END_STATE
constant yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE (line 682) | yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE
constant yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE (line 683) | yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE
constant yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE (line 684) | yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE
constant yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE (line 685) | yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE
constant yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE (line 686) | yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE
constant yaml_EMIT_FLOW_MAPPING_KEY_STATE (line 687) | yaml_EMIT_FLOW_MAPPING_KEY_STATE
constant yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE (line 688) | yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE
constant yaml_EMIT_FLOW_MAPPING_VALUE_STATE (line 689) | yaml_EMIT_FLOW_MAPPING_VALUE_STATE
constant yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE (line 690) | yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE
constant yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE (line 691) | yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE
constant yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE (line 692) | yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE
constant yaml_EMIT_BLOCK_MAPPING_KEY_STATE (line 693) | yaml_EMIT_BLOCK_MAPPING_KEY_STATE
constant yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE (line 694) | yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE
constant yaml_EMIT_BLOCK_MAPPING_VALUE_STATE (line 695) | yaml_EMIT_BLOCK_MAPPING_VALUE_STATE
constant yaml_EMIT_END_STATE (line 696) | yaml_EMIT_END_STATE
type yaml_emitter_t (line 703) | type yaml_emitter_t struct
FILE: vendor/gopkg.in/yaml.v3/yamlprivateh.go
constant input_raw_buffer_size (line 27) | input_raw_buffer_size = 512
constant input_buffer_size (line 31) | input_buffer_size = input_raw_buffer_size * 3
constant output_buffer_size (line 34) | output_buffer_size = 128
constant output_raw_buffer_size (line 38) | output_raw_buffer_size = (output_buffer_size*2 + 2)
constant initial_stack_size (line 41) | initial_stack_size = 16
constant initial_queue_size (line 42) | initial_queue_size = 16
constant initial_string_size (line 43) | initial_string_size = 16
function is_alpha (line 48) | func is_alpha(b []byte, i int) bool {
function is_digit (line 53) | func is_digit(b []byte, i int) bool {
function as_digit (line 58) | func as_digit(b []byte, i int) int {
function is_hex (line 63) | func is_hex(b []byte, i int) bool {
function as_hex (line 68) | func as_hex(b []byte, i int) int {
function is_ascii (line 80) | func is_ascii(b []byte, i int) bool {
function is_printable (line 85) | func is_printable(b []byte, i int) bool {
function is_z (line 98) | func is_z(b []byte, i int) bool {
function is_bom (line 103) | func is_bom(b []byte, i int) bool {
function is_space (line 108) | func is_space(b []byte, i int) bool {
function is_tab (line 113) | func is_tab(b []byte, i int) bool {
function is_blank (line 118) | func is_blank(b []byte, i int) bool {
function is_break (line 124) | func is_break(b []byte, i int) bool {
function is_crlf (line 132) | func is_crlf(b []byte, i int) bool {
function is_breakz (line 137) | func is_breakz(b []byte, i int) bool {
function is_spacez (line 151) | func is_spacez(b []byte, i int) bool {
function is_blankz (line 166) | func is_blankz(b []byte, i int) bool {
function width (line 181) | func width(b byte) int {
Condensed preview — 188 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,282K chars).
[
{
"path": ".github/FUNDING.yml",
"chars": 13,
"preview": "github: Fs02\n"
},
{
"path": ".github/dependabot.yml",
"chars": 108,
"preview": "version: 2\nupdates:\n - package-ecosystem: \"gomod\"\n directory: \"/\"\n schedule:\n interval: \"daily\"\n"
},
{
"path": ".gitignore",
"chars": 30,
"preview": ".env\nbin\n!bin/README.md\ndata/\n"
},
{
"path": ".tool-versions",
"chars": 12,
"preview": "golang 1.19\n"
},
{
"path": ".travis.yml",
"chars": 357,
"preview": "language: go\ngo:\n - \"1.17.x\"\n - \"1.18.x\"\n - \"1.19.x\"\nenv:\n - COVER=-coverprofile=c.out\nscript:\n - go test -race $CO"
},
{
"path": "LICENSE",
"chars": 1071,
"preview": "MIT License\n\nCopyright (c) 2020 Muhammad Surya\n\nPermission is hereby granted, free of charge, to any person obtaining a "
},
{
"path": "Makefile",
"chars": 580,
"preview": "export RELEASE_VERSION\t?= $(shell git show -q --format=%h)\nexport DOCKER_REGISTRY\t?= docker.pkg.github.com/fs02/go-todo-"
},
{
"path": "Procfile",
"chars": 13,
"preview": "web: bin/api\n"
},
{
"path": "README.md",
"chars": 3890,
"preview": "# go-todo-backend\n\n[](https://godoc.org/github.com"
},
{
"path": "api/README.md",
"chars": 146,
"preview": "# api\n\nThis package contains the root router for the handler. The root router should be `mountable` as sub router in oth"
},
{
"path": "api/api.go",
"chars": 898,
"preview": "package api\n\nimport (\n\t\"github.com/Fs02/go-todo-backend/api/handler\"\n\t\"github.com/Fs02/go-todo-backend/scores\"\n\t\"github."
},
{
"path": "api/handler/README.md",
"chars": 610,
"preview": "# handler\n\nThis package contains handler that handle http request for each endpoints.\nEvery handler should be simple and"
},
{
"path": "api/handler/handler.go",
"chars": 708,
"preview": "package handler\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"net/http\"\n\n\t\"go.uber.org/zap\"\n)\n\nvar (\n\tlogger, _ = zap.NewProduc"
},
{
"path": "api/handler/handler_test.go",
"chars": 914,
"preview": "package handler\n\nimport (\n\t\"errors\"\n\t\"net/http/httptest\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc TestR"
},
{
"path": "api/handler/healthz.go",
"chars": 1232,
"preview": "package handler\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"sync\"\n\n\t\"github.com/go-chi/chi\"\n\t\"go.uber.org/zap\"\n)\n\n// Pinger inter"
},
{
"path": "api/handler/healthz_test.go",
"chars": 1246,
"preview": "package handler_test\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"testing\"\n\n\t\"github.com/Fs02/go-to"
},
{
"path": "api/handler/score.go",
"chars": 842,
"preview": "package handler\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/Fs02/go-todo-backend/scores\"\n\t\"github.com/go-chi/chi\"\n\t\"github.com/g"
},
{
"path": "api/handler/score_test.go",
"chars": 2264,
"preview": "package handler_test\n\nimport (\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"testing\"\n\n\t\"github.com/Fs02/go-todo-backend/api/handle"
},
{
"path": "api/handler/todos.go",
"chars": 3278,
"preview": "package handler\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\n\t\"github.com/Fs02/go-todo"
},
{
"path": "api/handler/todos_test.go",
"chars": 9720,
"preview": "package handler_test\n\nimport (\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"strings\"\n\t\"testing\"\n\n\t\"github.com/Fs02/go-todo-backend"
},
{
"path": "api/middleware/README.md",
"chars": 177,
"preview": "# middleware\n\nThis package contains shared middleware that can be used accross handler. An example middleware that can b"
},
{
"path": "cmd/README.md",
"chars": 157,
"preview": "# cmd\n\nContains folders for main function for each application, the directory name for each server should match the name"
},
{
"path": "cmd/api/main.go",
"chars": 2484,
"preview": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"os/signal\"\n\t\"strings\"\n\t\"syscall\"\n\t\"time\"\n\n\t\"github.com/Fs02"
},
{
"path": "db/README.md",
"chars": 101,
"preview": "# db\n\nContains file required for building [database migration](https://go-rel.github.io/migration/).\n"
},
{
"path": "db/migrations/20202806225100_create_todos.go",
"chars": 487,
"preview": "package migrations\n\nimport (\n\t\"github.com/go-rel/rel\"\n)\n\n// MigrateCreateTodos definition\nfunc MigrateCreateTodos(schema"
},
{
"path": "db/migrations/20203006230600_create_scores.go",
"chars": 399,
"preview": "package migrations\n\nimport (\n\t\"github.com/go-rel/rel\"\n)\n\n// MigrateCreateScores definition\nfunc MigrateCreateScores(sche"
},
{
"path": "db/migrations/20203006230700_create_points.go",
"chars": 496,
"preview": "package migrations\n\nimport (\n\t\"github.com/go-rel/rel\"\n)\n\n// MigrateCreatePoints definition\nfunc MigrateCreatePoints(sche"
},
{
"path": "deploy/README.md",
"chars": 85,
"preview": "# deploy\n\nThis folder is where you store any deployable artifacts like `Dockerfile`.\n"
},
{
"path": "deploy/api/Dockerfile",
"chars": 630,
"preview": "# Step 1:\nFROM golang:1.13.5-alpine3.11 AS builder\n\nRUN apk update && apk add --no-cache git make\n\nWORKDIR $GOPATH/src/g"
},
{
"path": "docker-compose.yml",
"chars": 318,
"preview": "version: '3'\n\nservices:\n postgres:\n image: postgres:alpine\n environment:\n POSTGRES_USER: ${POSTGRESQL_USERNA"
},
{
"path": "go.mod",
"chars": 764,
"preview": "module github.com/Fs02/go-todo-backend\n\ngo 1.19\n\nrequire (\n\tgithub.com/go-chi/chi v4.1.2+incompatible\n\tgithub.com/go-rel"
},
{
"path": "go.sum",
"chars": 12187,
"preview": "github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=\ngithub.com/davecgh/go-spew v1.1.0/go"
},
{
"path": "scores/earn.go",
"chars": 969,
"preview": "package scores\n\nimport (\n\t\"context\"\n\t\"errors\"\n\n\t\"github.com/go-rel/rel\"\n)\n\ntype earn struct {\n\trepository rel.Repository"
},
{
"path": "scores/earn_test.go",
"chars": 1674,
"preview": "package scores\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/go-rel/rel\"\n\t\"github.com/go-rel/reltest\"\n\t\"github.com/stret"
},
{
"path": "scores/point.go",
"chars": 313,
"preview": "package scores\n\nimport (\n\t\"time\"\n)\n\n// Point component for score.\ntype Point struct {\n\tID int `json:\"id\"`\n\t"
},
{
"path": "scores/score.go",
"chars": 249,
"preview": "package scores\n\nimport (\n\t\"time\"\n)\n\n// Score stores total points.\ntype Score struct {\n\tID int `json:\"id\"`\n"
},
{
"path": "scores/scorestest/service.go",
"chars": 587,
"preview": "// Code generated by mockery 2.9.0. DO NOT EDIT.\n\npackage scorestest\n\nimport (\n\tcontext \"context\"\n\n\tmock \"github.com/str"
},
{
"path": "scores/service.go",
"chars": 757,
"preview": "package scores\n\nimport (\n\t\"context\"\n\n\t\"github.com/go-rel/rel\"\n)\n\n//go:generate mockery --name=Service --case=underscore "
},
{
"path": "todos/README.md",
"chars": 395,
"preview": "# todos\n\nContains domain related entities and business logic implementations. The business functionality should be expor"
},
{
"path": "todos/clear.go",
"chars": 212,
"preview": "package todos\n\nimport (\n\t\"context\"\n\n\t\"github.com/go-rel/rel\"\n)\n\ntype clear struct {\n\trepository rel.Repository\n}\n\nfunc ("
},
{
"path": "todos/clear_test.go",
"chars": 428,
"preview": "package todos\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/go-rel/rel\"\n\t\"github.com/go-rel/reltest\"\n\t\"github.com/stretc"
},
{
"path": "todos/create.go",
"chars": 653,
"preview": "package todos\n\nimport (\n\t\"context\"\n\n\t\"github.com/Fs02/go-todo-backend/scores\"\n\t\"github.com/go-rel/rel\"\n\t\"go.uber.org/zap"
},
{
"path": "todos/create_test.go",
"chars": 1515,
"preview": "package todos\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/Fs02/go-todo-backend/scores/scorestest\"\n\t\"github.com/go-rel/"
},
{
"path": "todos/delete.go",
"chars": 211,
"preview": "package todos\n\nimport (\n\t\"context\"\n\n\t\"github.com/go-rel/rel\"\n)\n\ntype delete struct {\n\trepository rel.Repository\n}\n\nfunc "
},
{
"path": "todos/delete_test.go",
"chars": 448,
"preview": "package todos\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/go-rel/reltest\"\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfun"
},
{
"path": "todos/search.go",
"chars": 580,
"preview": "package todos\n\nimport (\n\t\"context\"\n\n\t\"github.com/go-rel/rel\"\n)\n\n// Filter for search.\ntype Filter struct {\n\tKeyword st"
},
{
"path": "todos/search_test.go",
"chars": 714,
"preview": "package todos\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/go-rel/rel\"\n\t\"github.com/go-rel/reltest\"\n\t\"github.com/stretc"
},
{
"path": "todos/service.go",
"chars": 1348,
"preview": "package todos\n\nimport (\n\t\"context\"\n\n\t\"github.com/Fs02/go-todo-backend/scores\"\n\t\"github.com/go-rel/rel\"\n\t\"go.uber.org/zap"
},
{
"path": "todos/todo.go",
"chars": 982,
"preview": "package todos\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"os\"\n\t\"time\"\n)\n\nvar (\n\t// TodoURLPrefix to be returned when e"
},
{
"path": "todos/todo_test.go",
"chars": 827,
"preview": "package todos\n\nimport (\n\t\"encoding/json\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc init() {\n\tTodoURLPref"
},
{
"path": "todos/todostest/README.md",
"chars": 248,
"preview": "# todostest\n\nThis package should be named using `[domain]test` format, which is also used by standard package such as `n"
},
{
"path": "todos/todostest/service.go",
"chars": 1692,
"preview": "// Code generated by mockery 2.9.0. DO NOT EDIT.\n\npackage todostest\n\nimport (\n\tcontext \"context\"\n\n\trel \"github.com/go-re"
},
{
"path": "todos/todostest/todos.go",
"chars": 1623,
"preview": "package todostest\n\nimport (\n\tcontext \"context\"\n\n\ttodos \"github.com/Fs02/go-todo-backend/todos\"\n\trel \"github.com/go-rel/r"
},
{
"path": "todos/update.go",
"chars": 802,
"preview": "package todos\n\nimport (\n\t\"context\"\n\n\t\"github.com/Fs02/go-todo-backend/scores\"\n\t\"github.com/go-rel/rel\"\n\t\"go.uber.org/zap"
},
{
"path": "todos/update_test.go",
"chars": 2461,
"preview": "package todos\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/Fs02/go-todo-backend/scores/scorestest\"\n\t\"github.com/go-rel/"
},
{
"path": "vendor/github.com/davecgh/go-spew/LICENSE",
"chars": 766,
"preview": "ISC License\n\nCopyright (c) 2012-2016 Dave Collins <dave@davec.name>\n\nPermission to use, copy, modify, and/or distribute "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/bypass.go",
"chars": 4715,
"preview": "// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this sof"
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/bypasssafe.go",
"chars": 1741,
"preview": "// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this sof"
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/common.go",
"chars": 10364,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/config.go",
"chars": 12842,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/doc.go",
"chars": 8527,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/dump.go",
"chars": 13794,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/format.go",
"chars": 11314,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/davecgh/go-spew/spew/spew.go",
"chars": 5969,
"preview": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this "
},
{
"path": "vendor/github.com/go-chi/chi/.gitignore",
"chars": 20,
"preview": ".idea\n*.sw?\n.vscode\n"
},
{
"path": "vendor/github.com/go-chi/chi/.travis.yml",
"chars": 395,
"preview": "language: go\n\ngo:\n - 1.10.x\n - 1.11.x\n - 1.12.x\n - 1.13.x\n - 1.14.x\n\nscript:\n - go get -d -t ./...\n - go vet ./.."
},
{
"path": "vendor/github.com/go-chi/chi/CHANGELOG.md",
"chars": 8300,
"preview": "# Changelog\n\n## v4.1.2 (2020-06-02)\n\n- fix that handles MethodNotAllowed with path variables, thank you @caseyhadden for"
},
{
"path": "vendor/github.com/go-chi/chi/CONTRIBUTING.md",
"chars": 1070,
"preview": "# Contributing\n\n## Prerequisites\n\n1. [Install Go][go-install].\n2. Download the sources and switch the working directory:"
},
{
"path": "vendor/github.com/go-chi/chi/LICENSE",
"chars": 1123,
"preview": "Copyright (c) 2015-present Peter Kieltyka (https://github.com/pkieltyka), Google Inc.\n\nMIT License\n\nPermission is hereby"
},
{
"path": "vendor/github.com/go-chi/chi/README.md",
"chars": 19045,
"preview": "# <img alt=\"chi\" src=\"https://cdn.rawgit.com/go-chi/chi/master/_examples/chi.svg\" width=\"220\" />\n\n\n[![GoDoc Widget]][GoD"
},
{
"path": "vendor/github.com/go-chi/chi/chain.go",
"chars": 1517,
"preview": "package chi\n\nimport \"net/http\"\n\n// Chain returns a Middlewares type from a slice of middleware handlers.\nfunc Chain(midd"
},
{
"path": "vendor/github.com/go-chi/chi/chi.go",
"chars": 4623,
"preview": "//\n// Package chi is a small, idiomatic and composable router for building HTTP services.\n//\n// chi requires Go 1.10 or "
},
{
"path": "vendor/github.com/go-chi/chi/context.go",
"chars": 5059,
"preview": "package chi\n\nimport (\n\t\"context\"\n\t\"net\"\n\t\"net/http\"\n\t\"strings\"\n)\n\n// URLParam returns the url parameter from a http.Requ"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/basic_auth.go",
"chars": 788,
"preview": "package middleware\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n)\n\n// BasicAuth implements a simple middleware handler for adding basic "
},
{
"path": "vendor/github.com/go-chi/chi/middleware/compress.go",
"chars": 11617,
"preview": "package middleware\n\nimport (\n\t\"bufio\"\n\t\"compress/flate\"\n\t\"compress/gzip\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"net\"\n\t\"ne"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/content_charset.go",
"chars": 1283,
"preview": "package middleware\n\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\n\n// ContentCharset generates a handler that writes a 415 Unsupport"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/content_encoding.go",
"chars": 1087,
"preview": "package middleware\n\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\n\n// AllowContentEncoding enforces a whitelist of request Content-E"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/content_type.go",
"chars": 1238,
"preview": "package middleware\n\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\n\n// SetHeader is a convenience handler to set a response header ke"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/get_head.go",
"chars": 974,
"preview": "package middleware\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/go-chi/chi\"\n)\n\n// GetHead automatically route undefined HEAD requ"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/heartbeat.go",
"chars": 731,
"preview": "package middleware\n\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\n\n// Heartbeat endpoint middleware useful to setting up a path like"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/logger.go",
"chars": 4531,
"preview": "package middleware\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"log\"\n\t\"net/http\"\n\t\"os\"\n\t\"time\"\n)\n\nvar (\n\t// LogEntryCtxKey is the con"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/middleware.go",
"chars": 684,
"preview": "package middleware\n\nimport \"net/http\"\n\n// New will create a new middleware handler from a http.Handler.\nfunc New(h http."
},
{
"path": "vendor/github.com/go-chi/chi/middleware/nocache.go",
"chars": 1438,
"preview": "package middleware\n\n// Ported from Goji's middleware, source:\n// https://github.com/zenazn/goji/tree/master/web/middlewa"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/profiler.go",
"chars": 1290,
"preview": "package middleware\n\nimport (\n\t\"expvar\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/http/pprof\"\n\n\t\"github.com/go-chi/chi\"\n)\n\n// Profiler is "
},
{
"path": "vendor/github.com/go-chi/chi/middleware/realip.go",
"chars": 1666,
"preview": "package middleware\n\n// Ported from Goji's middleware, source:\n// https://github.com/zenazn/goji/tree/master/web/middlewa"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/recoverer.go",
"chars": 4519,
"preview": "package middleware\n\n// The original work was derived from Goji's middleware, source:\n// https://github.com/zenazn/goji/t"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/request_id.go",
"chars": 2966,
"preview": "package middleware\n\n// Ported from Goji's middleware, source:\n// https://github.com/zenazn/goji/tree/master/web/middlewa"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/route_headers.go",
"chars": 4339,
"preview": "package middleware\n\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\n\n// RouteHeaders is a neat little header-based router that allows "
},
{
"path": "vendor/github.com/go-chi/chi/middleware/strip.go",
"chars": 1511,
"preview": "package middleware\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\n\t\"github.com/go-chi/chi\"\n)\n\n// StripSlashes is a middleware that will m"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/terminal.go",
"chars": 1885,
"preview": "package middleware\n\n// Ported from Goji's middleware, source:\n// https://github.com/zenazn/goji/tree/master/web/middlewa"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/throttle.go",
"chars": 3837,
"preview": "package middleware\n\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"time\"\n)\n\nconst (\n\terrCapacityExceeded = \"Server capacity exceeded."
},
{
"path": "vendor/github.com/go-chi/chi/middleware/timeout.go",
"chars": 1237,
"preview": "package middleware\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"time\"\n)\n\n// Timeout is a middleware that cancels ctx after a given"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/url_format.go",
"chars": 1742,
"preview": "package middleware\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"strings\"\n\n\t\"github.com/go-chi/chi\"\n)\n\nvar (\n\t// URLFormatCtxKey is"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/value.go",
"chars": 448,
"preview": "package middleware\n\nimport (\n\t\"context\"\n\t\"net/http\"\n)\n\n// WithValue is a middleware that sets a given key/value in a con"
},
{
"path": "vendor/github.com/go-chi/chi/middleware/wrap_writer.go",
"chars": 4642,
"preview": "package middleware\n\n// The original work was derived from Goji's middleware, source:\n// https://github.com/zenazn/goji/t"
},
{
"path": "vendor/github.com/go-chi/chi/mux.go",
"chars": 14951,
"preview": "package chi\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"sync\"\n)\n\nvar _ Router = &Mux{}\n\n// Mux is a simple HTTP"
},
{
"path": "vendor/github.com/go-chi/chi/tree.go",
"chars": 20015,
"preview": "package chi\n\n// Radix tree implementation below is a based on the original work by\n// Armon Dadgar in https://github.com"
},
{
"path": "vendor/github.com/goware/cors/LICENSE",
"chars": 1154,
"preview": "Copyright (c) 2014 Olivier Poitrey <rs@dailymotion.com>\nCopyright (c) 2016-Present https://github.com/go-chi authors\n\nMI"
},
{
"path": "vendor/github.com/goware/cors/README.md",
"chars": 1577,
"preview": "# CORS net/http middleware\n\n[go-chi/cors](https://github.com/go-chi/cors) is a fork of [github.com/rs/cors](https://gith"
},
{
"path": "vendor/github.com/goware/cors/cors.go",
"chars": 12290,
"preview": "// cors package is net/http handler to handle CORS related requests\n// as defined by http://www.w3.org/TR/cors/\n//\n// Yo"
},
{
"path": "vendor/github.com/goware/cors/utils.go",
"chars": 1456,
"preview": "package cors\n\nimport \"strings\"\n\nconst toLower = 'a' - 'A'\n\ntype converter func(string) string\n\ntype wildcard struct {\n\tp"
},
{
"path": "vendor/github.com/jinzhu/inflection/LICENSE",
"chars": 1075,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2015 - Jinzhu\n\nPermission is hereby granted, free of charge, to any person obtainin"
},
{
"path": "vendor/github.com/jinzhu/inflection/README.md",
"chars": 1708,
"preview": "# Inflection\n\nInflection pluralizes and singularizes English nouns\n\n[ => \"people\"\n\t\tinflection"
},
{
"path": "vendor/github.com/jinzhu/inflection/wercker.yml",
"chars": 354,
"preview": "box: golang\n\nbuild:\n steps:\n - setup-go-workspace\n\n # Gets the dependencies\n - script:\n name: go get\n "
},
{
"path": "vendor/github.com/lib/pq/.gitignore",
"chars": 33,
"preview": ".db\n*.test\n*~\n*.swp\n.idea\n.vscode"
},
{
"path": "vendor/github.com/lib/pq/LICENSE.md",
"chars": 1110,
"preview": "Copyright (c) 2011-2013, 'pq' Contributors\nPortions Copyright (C) 2011 Blake Mizerany\n\nPermission is hereby granted, fre"
},
{
"path": "vendor/github.com/lib/pq/README.md",
"chars": 1254,
"preview": "# pq - A pure Go postgres driver for Go's database/sql package\n\n[\n\ntype readBuf []byte\n\nfunc (b *readBuf) int"
},
{
"path": "vendor/github.com/lib/pq/conn.go",
"chars": 50503,
"preview": "package pq\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"context\"\n\t\"crypto/md5\"\n\t\"crypto/sha256\"\n\t\"database/sql\"\n\t\"database/sql/driver\"\n"
},
{
"path": "vendor/github.com/lib/pq/conn_go115.go",
"chars": 111,
"preview": "//go:build go1.15\n// +build go1.15\n\npackage pq\n\nimport \"database/sql/driver\"\n\nvar _ driver.Validator = &conn{}\n"
},
{
"path": "vendor/github.com/lib/pq/conn_go18.go",
"chars": 5767,
"preview": "package pq\n\nimport (\n\t\"context\"\n\t\"database/sql\"\n\t\"database/sql/driver\"\n\t\"fmt\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"time\"\n)\n\nconst (\n\twat"
},
{
"path": "vendor/github.com/lib/pq/connector.go",
"chars": 3658,
"preview": "package pq\n\nimport (\n\t\"context\"\n\t\"database/sql/driver\"\n\t\"errors\"\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n)\n\n// Connector represents a fi"
},
{
"path": "vendor/github.com/lib/pq/copy.go",
"chars": 7650,
"preview": "package pq\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"database/sql/driver\"\n\t\"encoding/binary\"\n\t\"errors\"\n\t\"fmt\"\n\t\"sync\"\n)\n\nvar (\n\ter"
},
{
"path": "vendor/github.com/lib/pq/doc.go",
"chars": 9613,
"preview": "/*\nPackage pq is a pure Go Postgres driver for the database/sql package.\n\nIn most cases clients will use the database/sq"
},
{
"path": "vendor/github.com/lib/pq/encode.go",
"chars": 16756,
"preview": "package pq\n\nimport (\n\t\"bytes\"\n\t\"database/sql/driver\"\n\t\"encoding/binary\"\n\t\"encoding/hex\"\n\t\"errors\"\n\t\"fmt\"\n\t\"math\"\n\t\"regex"
},
{
"path": "vendor/github.com/lib/pq/error.go",
"chars": 15843,
"preview": "package pq\n\nimport (\n\t\"database/sql/driver\"\n\t\"fmt\"\n\t\"io\"\n\t\"net\"\n\t\"runtime\"\n)\n\n// Error severities\nconst (\n\tEfatal = \"F"
},
{
"path": "vendor/github.com/lib/pq/krb.go",
"chars": 815,
"preview": "package pq\n\n// NewGSSFunc creates a GSS authentication provider, for use with\n// RegisterGSSProvider.\ntype NewGSSFunc fu"
},
{
"path": "vendor/github.com/lib/pq/notice.go",
"chars": 2556,
"preview": "//go:build go1.10\n// +build go1.10\n\npackage pq\n\nimport (\n\t\"context\"\n\t\"database/sql/driver\"\n)\n\n// NoticeHandler returns t"
},
{
"path": "vendor/github.com/lib/pq/notify.go",
"chars": 25594,
"preview": "package pq\n\n// Package pq is a pure Go Postgres driver for the database/sql package.\n// This module contains support for"
},
{
"path": "vendor/github.com/lib/pq/oid/doc.go",
"chars": 137,
"preview": "// Package oid contains OID constants\n// as defined by the Postgres server.\npackage oid\n\n// Oid is a Postgres Object ID."
},
{
"path": "vendor/github.com/lib/pq/oid/types.go",
"chars": 10622,
"preview": "// Code generated by gen.go. DO NOT EDIT.\n\npackage oid\n\nconst (\n\tT_bool Oid = 16\n\tT_bytea Oid = 1"
},
{
"path": "vendor/github.com/lib/pq/rows.go",
"chars": 2457,
"preview": "package pq\n\nimport (\n\t\"math\"\n\t\"reflect\"\n\t\"time\"\n\n\t\"github.com/lib/pq/oid\"\n)\n\nconst headerSize = 4\n\ntype fieldDesc struct"
},
{
"path": "vendor/github.com/lib/pq/scram/scram.go",
"chars": 7701,
"preview": "// Copyright (c) 2014 - Gustavo Niemeyer <gustavo@niemeyer.net>\n//\n// All rights reserved.\n//\n// Redistribution and use "
},
{
"path": "vendor/github.com/lib/pq/ssl.go",
"chars": 6457,
"preview": "package pq\n\nimport (\n\t\"crypto/tls\"\n\t\"crypto/x509\"\n\t\"io/ioutil\"\n\t\"net\"\n\t\"os\"\n\t\"os/user\"\n\t\"path/filepath\"\n\t\"strings\"\n)\n\n//"
},
{
"path": "vendor/github.com/lib/pq/ssl_permissions.go",
"chars": 2964,
"preview": "//go:build !windows\n// +build !windows\n\npackage pq\n\nimport (\n\t\"errors\"\n\t\"os\"\n\t\"syscall\"\n)\n\nconst (\n\trootUserID = uint32("
},
{
"path": "vendor/github.com/lib/pq/ssl_windows.go",
"chars": 286,
"preview": "//go:build windows\n// +build windows\n\npackage pq\n\n// sslKeyPermissions checks the permissions on user-supplied ssl key f"
},
{
"path": "vendor/github.com/lib/pq/url.go",
"chars": 1655,
"preview": "package pq\n\nimport (\n\t\"fmt\"\n\t\"net\"\n\tnurl \"net/url\"\n\t\"sort\"\n\t\"strings\"\n)\n\n// ParseURL no longer needs to be used by clien"
},
{
"path": "vendor/github.com/lib/pq/user_other.go",
"chars": 234,
"preview": "// Package pq is a pure Go Postgres driver for the database/sql package.\n\n//go:build js || android || hurd || zos\n// +bu"
},
{
"path": "vendor/github.com/lib/pq/user_posix.go",
"chars": 579,
"preview": "// Package pq is a pure Go Postgres driver for the database/sql package.\n\n//go:build aix || darwin || dragonfly || freeb"
},
{
"path": "vendor/github.com/lib/pq/user_windows.go",
"chars": 871,
"preview": "// Package pq is a pure Go Postgres driver for the database/sql package.\npackage pq\n\nimport (\n\t\"path/filepath\"\n\t\"syscall"
},
{
"path": "vendor/github.com/lib/pq/uuid.go",
"chars": 555,
"preview": "package pq\n\nimport (\n\t\"encoding/hex\"\n\t\"fmt\"\n)\n\n// decodeUUIDBinary interprets the binary format of a uuid, returning it "
},
{
"path": "vendor/github.com/pmezard/go-difflib/LICENSE",
"chars": 1445,
"preview": "Copyright (c) 2013, Patrick Mezard\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or with"
},
{
"path": "vendor/github.com/pmezard/go-difflib/difflib/difflib.go",
"chars": 22879,
"preview": "// Package difflib is a partial port of Python difflib module.\n//\n// It provides tools to compare sequences of strings a"
},
{
"path": "vendor/github.com/serenize/snaker/.travis.yml",
"chars": 230,
"preview": "language: go\narch:\n - amd64\n - ppc64le\ngo:\n - 1.8\n - 1.9\n - tip\n# Disable version go:1.8\njobs:\n exclude:\n - arc"
},
{
"path": "vendor/github.com/serenize/snaker/LICENSE.txt",
"chars": 1076,
"preview": "Copyright (c) 2015 Serenize UG (haftungsbeschränkt)\n\nPermission is hereby granted, free of charge, to any person obtaini"
},
{
"path": "vendor/github.com/serenize/snaker/README.md",
"chars": 740,
"preview": "# snaker\n\n[](https://travis-ci.org/serenize/snak"
},
{
"path": "vendor/github.com/serenize/snaker/snaker.go",
"chars": 3088,
"preview": "// Package snaker provides methods to convert CamelCase names to snake_case and back.\n// It considers the list of allowe"
},
{
"path": "vendor/github.com/stretchr/objx/.codeclimate.yml",
"chars": 291,
"preview": "engines:\n gofmt:\n enabled: true\n golint:\n enabled: true\n govet:\n enabled: true\n\nexclude_patterns:\n- \".github"
},
{
"path": "vendor/github.com/stretchr/objx/.gitignore",
"chars": 185,
"preview": "# Binaries for programs and plugins\n*.exe\n*.dll\n*.so\n*.dylib\n\n# Test binary, build with `go test -c`\n*.test\n\n# Output of"
},
{
"path": "vendor/github.com/stretchr/objx/LICENSE",
"chars": 1117,
"preview": "The MIT License\n\nCopyright (c) 2014 Stretchr, Inc.\nCopyright (c) 2017-2018 objx contributors\n\nPermission is hereby grant"
},
{
"path": "vendor/github.com/stretchr/objx/README.md",
"chars": 3541,
"preview": "# Objx\n[](https://travis-ci.org/stretchr/objx)\n[!["
},
{
"path": "vendor/github.com/stretchr/objx/Taskfile.yml",
"chars": 464,
"preview": "version: '2'\n\nenv:\n GOFLAGS: -mod=vendor\n\ntasks:\n default:\n deps: [test]\n\n lint:\n desc: Checks code style\n c"
},
{
"path": "vendor/github.com/stretchr/objx/accessors.go",
"chars": 4782,
"preview": "package objx\n\nimport (\n\t\"reflect\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"strings\"\n)\n\nconst (\n\t// PathSeparator is the character used to "
},
{
"path": "vendor/github.com/stretchr/objx/conversions.go",
"chars": 7031,
"preview": "package objx\n\nimport (\n\t\"bytes\"\n\t\"encoding/base64\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"net/url\"\n\t\"strconv\"\n)\n\n// Signatu"
},
{
"path": "vendor/github.com/stretchr/objx/doc.go",
"chars": 2135,
"preview": "/*\nObjx - Go package for dealing with maps, slices, JSON and other data.\n\nOverview\n\nObjx provides the `objx.Map` type, w"
},
{
"path": "vendor/github.com/stretchr/objx/map.go",
"chars": 5840,
"preview": "package objx\n\nimport (\n\t\"encoding/base64\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"io/ioutil\"\n\t\"net/url\"\n\t\"strings\"\n)\n\n// MSIConvert"
},
{
"path": "vendor/github.com/stretchr/objx/mutations.go",
"chars": 2082,
"preview": "package objx\n\n// Exclude returns a new Map with the keys in the specified []string\n// excluded.\nfunc (m Map) Exclude(exc"
},
{
"path": "vendor/github.com/stretchr/objx/security.go",
"chars": 243,
"preview": "package objx\n\nimport (\n\t\"crypto/sha1\"\n\t\"encoding/hex\"\n)\n\n// HashWithKey hashes the specified string using the security k"
},
{
"path": "vendor/github.com/stretchr/objx/tests.go",
"chars": 362,
"preview": "package objx\n\n// Has gets whether there is something at the specified selector\n// or not.\n//\n// If m is nil, Has will al"
},
{
"path": "vendor/github.com/stretchr/objx/type_specific.go",
"chars": 9242,
"preview": "package objx\n\n/*\n MSI (map[string]interface{} and []map[string]interface{})\n*/\n\n// MSI gets the value as a map[string]"
},
{
"path": "vendor/github.com/stretchr/objx/type_specific_codegen.go",
"chars": 63666,
"preview": "package objx\n\n/*\n Inter (interface{} and []interface{})\n*/\n\n// Inter gets the value as a interface{}, returns the opti"
},
{
"path": "vendor/github.com/stretchr/objx/value.go",
"chars": 4084,
"preview": "package objx\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n)\n\n// Value provides methods for extracting interface{} data in various\n// type"
},
{
"path": "vendor/github.com/stretchr/testify/LICENSE",
"chars": 1103,
"preview": "MIT License\n\nCopyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors.\n\nPermission is hereby granted, free of ch"
},
{
"path": "vendor/github.com/stretchr/testify/assert/assertion_compare.go",
"chars": 11632,
"preview": "package assert\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"time\"\n)\n\ntype CompareType int\n\nconst (\n\tcompareLess CompareType = "
},
{
"path": "vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go",
"chars": 403,
"preview": "//go:build go1.17\n// +build go1.17\n\n// TODO: once support for Go 1.16 is dropped, this file can be\n// merged/remov"
},
{
"path": "vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go",
"chars": 399,
"preview": "//go:build !go1.17\n// +build !go1.17\n\n// TODO: once support for Go 1.16 is dropped, this file can be\n// merged/rem"
},
{
"path": "vendor/github.com/stretchr/testify/assert/assertion_format.go",
"chars": 32686,
"preview": "/*\n* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen\n* THIS FILE MUST NOT BE EDITED BY HAND\n */\n\n"
},
{
"path": "vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl",
"chars": 184,
"preview": "{{.CommentFormat}}\nfunc {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool {\n\tif h, ok := t.(tHelper); ok { h.Helper"
},
{
"path": "vendor/github.com/stretchr/testify/assert/assertion_forward.go",
"chars": 58170,
"preview": "/*\n* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen\n* THIS FILE MUST NOT BE EDITED BY HAND\n */\n\n"
},
{
"path": "vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl",
"chars": 185,
"preview": "{{.CommentWithoutT \"a\"}}\nfunc (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool {\n\tif h, ok := a.t.(tHelper); ok { h.H"
},
{
"path": "vendor/github.com/stretchr/testify/assert/assertion_order.go",
"chars": 2779,
"preview": "package assert\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n)\n\n// isOrdered checks that collection contains orderable elements.\nfunc isOr"
},
{
"path": "vendor/github.com/stretchr/testify/assert/assertions.go",
"chars": 58691,
"preview": "package assert\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"math\"\n\t\"os\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"runtim"
},
{
"path": "vendor/github.com/stretchr/testify/assert/doc.go",
"chars": 1329,
"preview": "// Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.\n//\n// # Examp"
},
{
"path": "vendor/github.com/stretchr/testify/assert/errors.go",
"chars": 326,
"preview": "package assert\n\nimport (\n\t\"errors\"\n)\n\n// AnError is an error instance useful for testing. If the code does not care\n// "
},
{
"path": "vendor/github.com/stretchr/testify/assert/forward_assertions.go",
"chars": 428,
"preview": "package assert\n\n// Assertions provides assertion methods around the\n// TestingT interface.\ntype Assertions struct {\n\tt T"
},
{
"path": "vendor/github.com/stretchr/testify/assert/http_assertions.go",
"chars": 5546,
"preview": "package assert\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"net/url\"\n\t\"strings\"\n)\n\n// httpCode is a helper that r"
},
{
"path": "vendor/github.com/stretchr/testify/mock/doc.go",
"chars": 1553,
"preview": "// Package mock provides a system by which it is possible to mock your objects\n// and verify calls are happening as expe"
},
{
"path": "vendor/github.com/stretchr/testify/mock/mock.go",
"chars": 35721,
"preview": "package mock\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"path\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strings\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com"
},
{
"path": "vendor/gopkg.in/yaml.v3/LICENSE",
"chars": 2151,
"preview": "\nThis project is covered by two different licenses: MIT and Apache.\n\n#### MIT License ####\n\nThe following files were por"
},
{
"path": "vendor/gopkg.in/yaml.v3/NOTICE",
"chars": 560,
"preview": "Copyright 2011-2016 Canonical Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this"
},
{
"path": "vendor/gopkg.in/yaml.v3/README.md",
"chars": 3453,
"preview": "# YAML support for the Go language\n\nIntroduction\n------------\n\nThe yaml package enables Go programs to comfortably encod"
},
{
"path": "vendor/gopkg.in/yaml.v3/apic.go",
"chars": 21999,
"preview": "// \n// Copyright (c) 2011-2019 Canonical Ltd\n// Copyright (c) 2006-2010 Kirill Simonov\n// \n// Permission is hereby grant"
},
{
"path": "vendor/gopkg.in/yaml.v3/decode.go",
"chars": 24953,
"preview": "//\n// Copyright (c) 2011-2019 Canonical Ltd\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you"
},
{
"path": "vendor/gopkg.in/yaml.v3/emitterc.go",
"chars": 55187,
"preview": "//\n// Copyright (c) 2011-2019 Canonical Ltd\n// Copyright (c) 2006-2010 Kirill Simonov\n//\n// Permission is hereby granted"
},
{
"path": "vendor/gopkg.in/yaml.v3/encode.go",
"chars": 14789,
"preview": "//\n// Copyright (c) 2011-2019 Canonical Ltd\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you"
},
{
"path": "vendor/gopkg.in/yaml.v3/parserc.go",
"chars": 40822,
"preview": "//\n// Copyright (c) 2011-2019 Canonical Ltd\n// Copyright (c) 2006-2010 Kirill Simonov\n//\n// Permission is hereby granted"
},
{
"path": "vendor/gopkg.in/yaml.v3/readerc.go",
"chars": 14089,
"preview": "// \n// Copyright (c) 2011-2019 Canonical Ltd\n// Copyright (c) 2006-2010 Kirill Simonov\n// \n// Permission is hereby grant"
},
{
"path": "vendor/gopkg.in/yaml.v3/resolve.go",
"chars": 8514,
"preview": "//\n// Copyright (c) 2011-2019 Canonical Ltd\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you"
},
{
"path": "vendor/gopkg.in/yaml.v3/scannerc.go",
"chars": 87956,
"preview": "//\n// Copyright (c) 2011-2019 Canonical Ltd\n// Copyright (c) 2006-2010 Kirill Simonov\n//\n// Permission is hereby granted"
},
{
"path": "vendor/gopkg.in/yaml.v3/sorter.go",
"chars": 3345,
"preview": "//\n// Copyright (c) 2011-2019 Canonical Ltd\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you"
},
{
"path": "vendor/gopkg.in/yaml.v3/writerc.go",
"chars": 1834,
"preview": "// \n// Copyright (c) 2011-2019 Canonical Ltd\n// Copyright (c) 2006-2010 Kirill Simonov\n// \n// Permission is hereby grant"
},
{
"path": "vendor/gopkg.in/yaml.v3/yaml.go",
"chars": 20084,
"preview": "//\n// Copyright (c) 2011-2019 Canonical Ltd\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you"
},
{
"path": "vendor/gopkg.in/yaml.v3/yamlh.go",
"chars": 29046,
"preview": "//\n// Copyright (c) 2011-2019 Canonical Ltd\n// Copyright (c) 2006-2010 Kirill Simonov\n//\n// Permission is hereby granted"
},
{
"path": "vendor/gopkg.in/yaml.v3/yamlprivateh.go",
"chars": 6129,
"preview": "// \n// Copyright (c) 2011-2019 Canonical Ltd\n// Copyright (c) 2006-2010 Kirill Simonov\n// \n// Permission is hereby grant"
},
{
"path": "vendor/modules.txt",
"chars": 1651,
"preview": "# github.com/davecgh/go-spew v1.1.1\n## explicit\ngithub.com/davecgh/go-spew/spew\n# github.com/go-chi/chi v4.1.2+incompati"
}
]
About this extraction
This page contains the full source code of the Fs02/go-todo-backend GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 188 files (1.1 MB), approximately 323.8k tokens, and a symbol index with 2180 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.