NOTE: Shangwa DB is still in BETA feedback would be appriciated!
Shangwa DB is a NO-SQL document data store that programmers can use during testing and development. There are situations where you might want to test your app using a mock or fake database, Shangwa DB is there for you.
- Its local so there is no need to make metwork calls which can be slow
- It can be git ignored (optional) to reduce the bloat of your git repository
- Easy to use api
Database -> Clusters -> Documents
// Initializing a database
const db = createDatabase({
name : 'test-db',
});
The following directory is automatically created for you but you don't have to ever touch it! JUst know that thats where your database leaves
-- .local
|
-- test_db
// Creates a collection called users
const usersCol = db.createCollection({
name : 'users'
})
// Define a class representing your json object
@JsonEntity
class User {
[x: string]: any;
constructor(
public id : string,
public username : string,
public password : string,
)
}
// create an instance of your user class
const newUser = new User('tadiwa', '12345678');
// Insert the doc
usersCol.insertDoc(newUser.toDb())
useersCol.insertDoc({
username : 'tadiwa',
password : '12345678'
})
const docID = 'user-1';
usersCol.deleteDoc(docId)
const docID = 'user-1';
const newData = {
username : 'tadiwa',
password: 'i_hate_typescript'
}
usersCol.updateDoc(docId)
const docID = 'user-1';
usersCol.getDocData(docId)
const username = 'tadiwa';
usersCol.getDocWhere('username', 'tadiwa')
const docs = usersCol.getAllDocs();
console.log(docs)