move datatypes

This commit is contained in:
Johannes Jöns 2024-02-06 17:49:57 +01:00
parent 166c3ff202
commit 90577ea86e
3 changed files with 37 additions and 1 deletions

1
.gitignore vendored
View file

@ -14,7 +14,6 @@ dist/
downloads/ downloads/
eggs/ eggs/
.eggs/ .eggs/
lib/
lib64/ lib64/
parts/ parts/
sdist/ sdist/

37
fuzzer/filldb.py Normal file
View file

@ -0,0 +1,37 @@
import string
from dataclasses import fields
from surrealdb import Surreal
import random
from lib.datatypes import Customer
async def mainold():
"""Example of how to use the SurrealDB client."""
async with Surreal("ws://localhost:8000/rpc") as db:
await db.signin({"user": "root", "pass": "root"})
await db.use("test", "test")
for k in range(1, 20):
await db.create(
"Kunde",
fill_data().dict(),
)
def randomword(length):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(length))
def fill_data():
data = Customer(1, "a", "a", "a", "a", "a", 1, "a", 1, "a")
for var in fields(Customer):
if var.type == type("str"):
setattr(data, var.name, randomword(random.randint(1, 20)))
elif var.type == type(1):
setattr(data, var.name, random.randint(0, 100))
return data
print(fill_data())