backend

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

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

Go to latest
Published: May 20, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

README

backend

A Flexible Database for storing records with mixed Columns

Package backend implements an Rest API that manages a "company" database.

  • This package implements a two level Key/Store Data Base:
  • The Data Records are indexed by ID Number as the Key
  • The Data Records are implemented internally as a Key/Store
  • Data Records are made up of a variable number of TAG Pairs
  • TAGS are identified by the first character which is a "|" ie |TAG
  • The |TAG is followed by any number of Words

Example: |NAME John Smith |AGE 50

Since Records are Key/Stores the Record Format is completely flexible.

Each Record can have Unique Tag Pairs - The User can add special Tag to Any Record: For Example:

** Server is on localhost:3000** Responds to endpoint /backend/<CMD> [ <data list> ]

Syntax Description

<CMD> <Data List>

<CMD> = Single Upper Case Text Word

<Data List> = <Tag Pair> [ <Tag Pair> ... ]

<Tag Pair> = <TAG> <Word> [ <Word> ... ]

<TAG> = <|><Single Upper Case Text Word><space>

<Word> = <space><Text><space>

Commands

     /NEW <data list>                  - Creates a new record (ID # -Automatic)
     /UPDATE <|ID Number> <data list>  - Updates specified ID
     /GET/<ID Record Number>           - Returns spedified ID
     /DELETE/<ID Record Number>        - Deletes specified ID
     /LIST/                            - Lists all records
     /EXIT/                            - Close Database and exit
Example: https://localhost:3000/backend/NEW |NAME John Smith |AGE 50

Example: https://localhost:3000/backend/UPDATE |ID Rec# |NAME Mike Browm

 NOTES:
	- TAGs should be unique ( |NAME <string> |NAME <string> ) Is Wrong!!
	- Commands should be in UPPER CASE (For CLarity)
	- !TAG must be an exact match (TAG and tag are NOT the same)
    - TAGS should be in UPPER CASE (For CLarity)
	- There is no escape for the "|" Character is the TAG Prefix identifier
	- All <data list Tags and Words are strings! Numbers are specified as <strings>

Example of LIST Command

CMD:  LIST

1   |NAME John Jones |AGE 50
2   |NAME Mark Smith |AGE 29
3   |NAME Bob Brown  |AGE 35

Error Messages: "Recoverable Errors are Display and Processing Continues"

Unrecoverable Errors are handled by the "log.Fatal" package function.

Documentation

Overview

Package backend implements an Rest API that manages a "company" database.

This package implements a two level Key/Store Data Base:
The Data Records are indexed by ID Number ID/RECORD DATA
The Data Records are implemented internally as a Key/Store
	Data Records are made up of a variable number of TAG Pairs

. TAGS are identified by the first character which is a "|" ie |TAG

			The |TAG is followed by any number of Words
				Example: |NAME John Smith |AGE 50
Since Records are Key/Stores the Record Format is Flexiable.
	Each Record can have any Tag Pairs - The User can a special Tags
	to Any Record:  For Example:  Some Records might be Flagged in some way.

Server is on localhost:3000 Responds to endpoint "/backend/<cmd> <data list>"

Command Format:

<data list> is made up a variable number of <tag pairs>
	<tag pairs> consist of a <|TAG> and variable number of <text words>

For Examples:

			/NEW |NAME John Smith |AGE 56
			/UPDATE |ID 10 |NAME Bob Lay  - Changes Name Value of ID 10

 Commands:

    /NEW <data list>   		- Creates a new record (Using next avaiable ID Value)
    /UPDATE <|ID Number> <data list>	 - Updates specified ID
	   /GET/<ID string>						 - Returns spedified ID
    /DELETE/<ID Number>					 - Deletes specified ID
	   /LIST/								 - Lists all records in database
	   /EXIT/		 						 - Close Database and exit

Example: https://localhost:3000/backend/NEW |NEW John Smith |AGE 50

 NOTES:
	- TAGs should be unique (If |NAME <string> |NAME <string> (Both will be present?)
	- Commands should be in UPPER CASE (For CLarity)
	- !TAG must be an exact match (TAG and tag are NOT the same)
	- There is no escape for the "|" Character as it is the TAG Prefix identifier
	- All <data list Tags and Words are strings! Numbers are specified as <strings>

Result List Example: CMD: LIST tagList: [] 1 |NAME John jones |AGE 50 2 |NAME John jones |AGE 50 3 |NAME John jones |AGE 50

Error Messages:

"Recoverable Errors are Display and Processing Continues"

Unrecoverable Errors are handled by the "log" package.

Jump to

Keyboard shortcuts

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