File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 33"""
44
55from dataclasses import dataclass
6+ from typing import Generic , TypeVar
67
78from . import _engine
89from .convert import dump_engine_object
910
11+ T = TypeVar ("T" )
12+
1013@dataclass
11- class AuthEntryReference :
14+ class AuthEntryReference ( Generic [ T ]) :
1215 """Reference an auth entry by its key."""
1316 key : str
1417
15- def add_auth_entry (key : str , value ) -> AuthEntryReference :
18+ def add_auth_entry (key : str , value : T ) -> AuthEntryReference [ T ] :
1619 """Add an auth entry to the registry. Returns its reference."""
1720 _engine .add_auth_entry (key , dump_engine_object (value ))
1821 return AuthEntryReference (key )
Original file line number Diff line number Diff line change 55from . import op
66from . import index
77from .auth_registry import AuthEntryReference
8+ from .setting import DatabaseConnectionSpec
89
910class Postgres (op .StorageSpec ):
1011 """Storage powered by Postgres and pgvector."""
11-
12- database : AuthEntryReference | None = None
12+ database : AuthEntryReference [DatabaseConnectionSpec ] | None = None
1313 table_name : str | None = None
1414
1515@dataclass
@@ -72,15 +72,14 @@ class Relationships:
7272
7373class Neo4j (op .StorageSpec ):
7474 """Graph storage powered by Neo4j."""
75-
76- connection : AuthEntryReference
75+ connection : AuthEntryReference [Neo4jConnection ]
7776 mapping : Nodes | Relationships
7877
7978class Neo4jDeclaration (op .DeclarationSpec ):
8079 """Declarations for Neo4j."""
8180
8281 kind = "Neo4j"
83- connection : AuthEntryReference
82+ connection : AuthEntryReference [ Neo4jConnection ]
8483 nodes_label : str
8584 primary_key_fields : Sequence [str ]
8685 vector_indexes : Sequence [index .VectorIndexDef ] = ()
You can’t perform that action at this time.
0 commit comments