document-database-from-scratch

command module
v0.0.0-...-3807eb5 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: MIT Imports: 4 Imported by: 0

README

document-database-from-scratch

Example

Post document

$ curl --get -H 'Content-Type: application/json' -d '{"name": "Kevin", "age": "45"}' http://localhost:8080/docs
{"body":{"id":"9b7cecae-d88e-43ee-bcdb-db54d9828a84"},"status":"ok"}

Get document by id

$ curl http://localhost:8080/docs/9b7cecae-d88e-43ee-bcdb-db54d9828a84
{"body":{"document":{"age":"45","name":"Kevin"}},"status":"ok"}

Search documents

$ curl --get http://localhost:8080/docs
{"body":{"count":1,"documents":[{"body":{"age":"45","name":"Kevin"},"id":"9b7cecae-d88e-43ee-bcdb-db54d9828a84"}]},"status":"ok"}

$ curl --get http://localhost:8080/docs --data-urlencode 'q=name:Kevin'
{"body":{"count":1,"documents":[{"body":{"age":"45","name":"Kevin"},"id":"9b7cecae-d88e-43ee-bcdb-db54d9828a84"}]},"status":"ok"}

$ curl --get http://localhost:8080/docs --data-urlencode 'q=age:<30'
{"body":{"count":0,"documents":null},"status":"ok"}

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