Module surrealpy.http.models

Expand source code
from typing import Optional
import dataclasses
from surrealpy import utils


@dataclasses.dataclass(frozen=True)
class Result:
    time: str
    status: str
    result: list[Optional[dict]]


@dataclasses.dataclass(frozen=True)
class SurrealResponse:
    results: list[Result]


def to_json(obj):
    return utils.json_dumps(dataclasses.asdict(obj))


def to_dict(obj):
    return dataclasses.asdict(obj)


def from_json(json, cls=SurrealResponse):
    return cls(**utils.json_loads(json))


def from_dict(dict, cls=SurrealResponse):
    return cls(**dict)

Functions

def from_dict(dict, cls=surrealpy.http.models.SurrealResponse)
Expand source code
def from_dict(dict, cls=SurrealResponse):
    return cls(**dict)
def from_json(json, cls=surrealpy.http.models.SurrealResponse)
Expand source code
def from_json(json, cls=SurrealResponse):
    return cls(**utils.json_loads(json))
def to_dict(obj)
Expand source code
def to_dict(obj):
    return dataclasses.asdict(obj)
def to_json(obj)
Expand source code
def to_json(obj):
    return utils.json_dumps(dataclasses.asdict(obj))

Classes

class Result (time: str, status: str, result: list[typing.Optional[dict]])

Result(time: str, status: str, result: list[typing.Optional[dict]])

Expand source code
@dataclasses.dataclass(frozen=True)
class Result:
    time: str
    status: str
    result: list[Optional[dict]]

Class variables

var result : list[typing.Optional[dict]]
var status : str
var time : str
class SurrealResponse (results: list[Result])

SurrealResponse(results: list[surrealpy.http.models.Result])

Expand source code
@dataclasses.dataclass(frozen=True)
class SurrealResponse:
    results: list[Result]

Class variables

var results : list[Result]