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
Usage
- Clone the repo & cd into it
git clone git@github.com:albertofp/rinha-de-backend.git && cd rinha-de-backend
- 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
Version
1.0
License
MIT
Alberto F. Pluecker
albertopluecker@gmail.com
Github
Terms Of Service
http://swagger.io/terms/
URI Schemes
Consumes
Produces
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
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
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
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
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
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
Produces
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 |
|
|
|
|