rinha-de-backend

command module
v0.0.0-...-a137641 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2023 License: MIT Imports: 7 Imported by: 0

README

Rinha de Backend Q3 2023 - Alberto Pluecker

Tech used:

Built for the friendly competition Rinha de Backend Q3 2023 by zanfranceschi, competition details (in portuguese) found here

test diagram

Usage

  1. Clone the repo & cd into it
   git clone git@github.com:albertofp/rinha-de-backend.git && cd rinha-de-backend
  1. Start the containers
  docker compose up

API exposed at:

localhost:9999/

Docs at

localhost:9999/docs

To run the stress test, run make stress

Docs auto-generated by Swagger

Information

Version

1.0

License

MIT

Contact

Alberto F. Pluecker albertopluecker@gmail.com Github

Terms Of Service

http://swagger.io/terms/

URI Schemes
  • http
Consumes
  • application/json
Produces
  • application/json

All endpoints

count
Method URI Name Summary
GET /contagem-pessoas get contagem pessoas Count total amount of people in the database
getall
Method URI Name Summary
GET /getall get getall Get every person in the database
pessoas
Method URI Name Summary
GET /pessoas get pessoas Search by term
GET /pessoas/{id} get pessoas ID Search person by ID
POST /pessoas post pessoas Create new person document
status
Method URI Name Summary
GET /status get status Health check

Paths

Count total amount of people in the database (GetContagemPessoas)

GET /contagem-pessoas

Produces
  • application/json
All responses
Code Status Description Has headers Schema
200 OK OK schema
500 Internal Server Error Internal Server Error schema
Responses
200 - OK

Status: OK

Schema

ModelsCountResponse

500 - Internal Server Error

Status: Internal Server Error

Schema

ModelsErrorResponse

Get every person in the database (GetGetall)

GET /getall

Returns an empty array if no people found.

Produces
  • application/json
All responses
Code Status Description Has headers Schema
200 OK OK schema
Responses
200 - OK

Status: OK

Schema

[]ModelsPersonDTO

Search by term (GetPessoas)

GET /pessoas

Search for a person in database by a given query string. Search term must not be empty

Produces
  • application/json
Parameters
Name Source Type Go type Separator Required Default Description
t query string string Search term
All responses
Code Status Description Has headers Schema
200 OK OK schema
400 Bad Request Bad Request schema
500 Internal Server Error Internal Server Error schema
Responses
200 - OK

Status: OK

Schema

[]ModelsPersonDTO

400 - Bad Request

Status: Bad Request

Schema

ModelsErrorResponse

500 - Internal Server Error

Status: Internal Server Error

Schema

ModelsErrorResponse

Search person by ID (GetPessoasID)

GET /pessoas/{id}

Returns a person with the given id (UUID format)

Produces
  • application/json
Parameters
Name Source Type Go type Separator Required Default Description
id path string string Person ID
All responses
Code Status Description Has headers Schema
200 OK OK schema
400 Bad Request Bad Request schema
404 Not Found Not Found schema
500 Internal Server Error Internal Server Error schema
Responses
200 - OK

Status: OK

Schema

ModelsPersonDTO

400 - Bad Request

Status: Bad Request

Schema

ModelsErrorResponse

404 - Not Found

Status: Not Found

Schema

ModelsErrorResponse

500 - Internal Server Error

Status: Internal Server Error

Schema

ModelsErrorResponse

Health check (GetStatus)

GET /status

All responses
Code Status Description Has headers Schema
200 OK OK schema
Responses
200 - OK

Status: OK

Schema

[]string

Create new person document (PostPessoas)

POST /pessoas

Adds a person to the database. Returns an error if another person with the same value for the "apelido" field exists. Apelido and Nome have to be strings of length up to 32 and 100, respectively. Nascimento has to follow date format YYYY-MM-DD. Stack is optional, but each entry contained has to be a string of up to 32 chars in length.

Consumes
  • application/json
Produces
  • application/json
Parameters
Name Source Type Go type Separator Required Default Description
request body ModelsPersonCreateRequest models.ModelsPersonCreateRequest Request body
All responses
Code Status Description Has headers Schema
201 Created Created schema
422 Unprocessable Entity Unprocessable Entity schema
500 Internal Server Error Internal Server Error schema
Responses
201 - Created

Status: Created

Schema

ModelsPersonCreateResponse

422 - Unprocessable Entity

Status: Unprocessable Entity

Schema

ModelsErrorResponse

500 - Internal Server Error

Status: Internal Server Error

Schema

ModelsErrorResponse

Models

models.CountResponse

Properties

Name Type Go type Required Default Description Example
count integer int64
models.ErrorResponse

Properties

Name Type Go type Required Default Description Example
message string string
models.PersonCreateRequest

Properties

Name Type Go type Required Default Description Example
apelido string string
nascimento string string
nome string string
stack []string []string
models.PersonCreateResponse

Properties

Name Type Go type Required Default Description Example
id string string
message string string
models.PersonDTO

Properties

Name Type Go type Required Default Description Example
apelido string string
id string string
nascimento string string
nome string string
stack []string []string


Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL