database

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

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

Go to latest
Published: Sep 13, 2022 License: GPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README


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.

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