JSONexusSync-Client
Introduction
Installation
pip install jsonexussync-clientUsage
import asyncio
import json
from jsonexussync_client import JSONexusSyncClient
async def main():
config = {
"api_key":"YourApiKey",
"server_uri": "ws://localhost:8765"
}
client = JSONexusSyncClient(config)
# Insert a new item into the 'users' collection
await client.insert_data('users', {'name': 'Charlie', 'age': 35, 'email': 'charlie@example.com'})
# Find users with a specific query
result = await client.find_data('users', {'age': {'_op': '$eq', '_value': 35}})
print(result)
# Delete users with a specific query
await client.delete_data('users', {'name': {'_op': '$eq', '_value': "Melissa Villarreal"}})
# Update users with a specific query
result = await client.update_data('users', {"age": {'_op': '$eq', '_value': 23}}, {"job": "Ethical Hacker"})
# Creating a new database
result = await client.create_db('my_app')
# Generate an API key
result = await client.generate_api_key('admin', 'my_app')
# Gell all Databases Name
result = await client.get_dbs()
print(result)
result = await client.create_collection("students")
print(result)
if __name__ == "__main__":
asyncio.run(main())Conclusion
Last updated