Sitelet https://github.com/flume-cloud-services/database
Skip to content

Latest commit

 

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Database

Golang Database via HTTP using LevelDB and GJSON & SJSON (by Flume Cloud Services)

Installation

Docker

docker run -d -p 8080:8080 flumecloudservices/database

Manually

mkdir $GOPATH/src/github.com/flume-cloud-services && cd $GOPATH/src/github.com/flume-cloud-services
git clone https://github.com/flume-cloud-services/database.git && cd database
go get -d -v
go install -v

FLUME_DATABASE_ADMIN=admin_name FLUME_DATABASE_SECRET=secret_token database

Usage

Use the signin route with the following body to generate the JWT token :

POST /signin

Body:
    - username: The admin name given in FLUME_DATABASE_ADMIN by default it's simply "admin"

Return:
    - If success :
        - A JWT Token
        - The cookie with the previously generated JWT Token
    - If failed :
        - Unauthorized Status
        - Bad request Status

Check if the jwt is correctly generated by visiting welcome route :

GET /welcome

Return:
    - If success :
        - Welcome to you visitor !
    -If failed :
        - Unauthorized Status

Then create a database using the /database/create route :

POST /database/create

Body:
    - name: The database name

Return:
    - If success :
        - Database <name> succesfully created
    - If failed :
        - Bad Request Status
        - Internal Server Error Status

You can delete the previously created database using the database/delete route :

POST /database/delete

Body:
    - name: The database name

Return:
    - If success :
        - Database <name> succesfully deleted
    - If failed :
        - Bad Request Status
        - Internal Server Error Status

Then you have to insert data into a specific table using SJSON (I recommend you to know the basics of GJSON Syntax) and the route /insert :

POST /insert

Body:
    - database: The database name
    - query: The GJSON query
    - content: The JSON stringified content of the table

Return:
    - If success :
        - Data successfully inserted into table
    - If failed :
        - Bad Request Status
        - Internal Server Error Status

Now you can query your database using GJSON (I recommend you to know the basics of GJSON Syntax) and the /query route :

POST /query

Body:
    - name: The database name
    - query: The GJSON query

Return:
    - If success :
        - The response of the given query
    - If failed :
        - Bad Request Status
        - Internal Server Error Status

Example of Query

Query : table.0.key

Give the specified key into the specified table at the index '0'

Example of Insert

Query : table.0.key Content : Key Content

Set the specified content into the specified key into the specified table at the index '0'

Dashboard

You can access the dashboard here /dash by giving the admin name and the secret.

About

Golang Database via HTTP using LevelDB (by Flume Cloud Services)

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages