Skip to content

Commit

Permalink
feat: optimize client initialization and reduce required parameters (#64
Browse files Browse the repository at this point in the history
)

Signed-off-by: yehao <[email protected]>
  • Loading branch information
goyjy authored Aug 26, 2024
1 parent 0270c41 commit 0818565
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
10 changes: 5 additions & 5 deletions opengemini_client/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ class BatchConfig:
@dataclass
class Config:
address: List[Address]
batch_config: BatchConfig
timeout: timedelta
connection_timeout: timedelta
gzip_enabled: bool
tls_enabled: bool
batch_config: BatchConfig = None
timeout: timedelta = None
connection_timeout: timedelta = None
gzip_enabled: bool = False
tls_enabled: bool = False
auth_config: AuthConfig = None
tls_config: ssl.SSLContext = None

Expand Down
9 changes: 1 addition & 8 deletions opengemini_client/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import datetime

from opengemini_client import client_impl
from opengemini_client import models


def get_test_default_client():
cfg = models.Config(address=[models.Address(host='127.0.0.1', port=8086)],
batch_config=models.BatchConfig(batch_size=10, batch_interval=10),
timeout=datetime.timedelta(seconds=10),
connection_timeout=datetime.timedelta(seconds=10),
gzip_enabled=False, tls_enabled=False
)
cfg = models.Config(address=[models.Address(host='127.0.0.1', port=8086)])
cli = client_impl.OpenGeminiDBClient(cfg)
return cli

0 comments on commit 0818565

Please sign in to comment.