FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
onenode-py/onenode/_database.py at main · onenodehq/onenode-py · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
onenodehq
/
onenode-py
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
onenode-py
/
onenode
/
_database.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
22 lines (17 loc) · 821 Bytes
Breadcrumbs
onenode-py
/
onenode
/
_database.py
Copy path
File metadata and controls
22 lines (17 loc) · 821 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from
onenode
.
_collection
import
Collection
class
Database
:
"""Database in OneNode."""
def
__init__
(
self
,
api_key
:
str
,
project_id
:
str
,
db_name
:
str
):
"""Initialize database instance."""
self
.
api_key
=
api_key
self
.
project_id
=
project_id
self
.
db_name
=
db_name
def
collection
(
self
,
collection_name
:
str
)
->
Collection
:
"""Get collection by name."""
return
Collection
(
self
.
api_key
,
self
.
project_id
,
self
.
db_name
,
collection_name
)
def
__getattr__
(
self
,
name
:
str
)
->
Collection
:
"""Allow collection access via attribute: db.my_collection"""
return
self
.
collection
(
name
)
def
__getitem__
(
self
,
name
:
str
)
->
Collection
:
"""Allow collection access via dictionary: db["my_collection"]"""
return
self
.
collection
(
name
)
Back
|
FazBrowse Home
|
New Git URL