-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
200 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
VERSION='0.0.2' | ||
VERSION='0.1.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,28 @@ | ||
from surrealdb.async_surrealdb import AsyncSurrealDB | ||
from surrealdb.surrealdb import SurrealDB | ||
from surrealdb.errors import SurrealDbError, SurrealDbConnectionError | ||
from surrealdb.errors import SurrealDbError, SurrealDbConnectionError, SurrealDbDecodeError, SurrealDbEncodeError | ||
|
||
__all__ = ("SurrealDB", "AsyncSurrealDB", "SurrealDbError", "SurrealDbConnectionError") | ||
from surrealdb.data.models import Patch, QueryResponse, GraphQLOptions | ||
from surrealdb.data.types.duration import Duration | ||
from surrealdb.data.types.future import Future | ||
from surrealdb.data.types.geometry import Geometry, GeometryPoint, GeometryLine, GeometryPolygon, GeometryMultiPoint, \ | ||
GeometryMultiLine, GeometryMultiPolygon, GeometryCollection | ||
from surrealdb.data.types.range import Bound, BoundIncluded, BoundExcluded, Range | ||
from surrealdb.data.types.record_id import RecordID | ||
from surrealdb.data.types.table import Table | ||
|
||
__all__ = ( | ||
"SurrealDB", "AsyncSurrealDB", | ||
"SurrealDbError", "SurrealDbConnectionError", "SurrealDbDecodeError", "SurrealDbEncodeError", | ||
|
||
"Patch", "QueryResponse", "GraphQLOptions", | ||
|
||
"Duration", | ||
"Future", | ||
"Geometry", "GeometryPoint", "GeometryLine", "GeometryPolygon", "GeometryMultiPoint", | ||
"GeometryMultiLine", "GeometryMultiPolygon", "GeometryCollection", | ||
"Bound", "BoundIncluded", "BoundExcluded", "Range", | ||
"RecordID", | ||
"Table" | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
REQUEST_ID_LENGTH = 10 | ||
|
||
AUTH_TOKEN_KEY = "auth_token" | ||
|
||
ALLOWED_CONNECTION_SCHEMES = ['http', 'https', 'ws', 'wss'] | ||
HTTP_CONNECTION_SCHEMES = ['http', 'https'] | ||
WS_CONNECTION_SCHEMES = ['ws', 'wss'] | ||
|
||
DEFAULT_CONNECTION_URL = "http://127.0.0.1:8000" | ||
|
||
UNSUPPORTED_HTTP_METHODS = ["kill", "live"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class RecordID: | ||
def __init__(self, table_name: str, identifier): | ||
self.table_name = table_name | ||
self.id = identifier | ||
|
||
def __repr__(self) -> str: | ||
def __str__(self) -> str: | ||
return f"{self.table_name}:{self.id}" | ||
|
||
def __repr__(self) -> str: | ||
return f'{self.__class__.__name__}(table_name={self.table_name}, record_id={self.id})'.format(self=self) | ||
|
||
@staticmethod | ||
def parse(record_str: str): | ||
if ":" not in record_str: | ||
raise ValueError('invalid string provided for parse. the expected string format is "table_name:record_id"') | ||
|
||
table, record_id = record_str.split(":") | ||
return RecordID(table, record_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
class Table: | ||
def __init__(self, table_name: str): | ||
self.table_name = table_name | ||
|
||
def __str__(self) -> str: | ||
return f"{self.table_name}" | ||
|
||
def __repr__(self) -> str: | ||
return f"{self.table_name}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.