Struct edgedb_client::Builder [−][src]
pub struct Builder { /* fields omitted */ }
Expand description
A builder used to create connections
Implementations
Initializes Builder using project or environment variables
Reads the project config if found
Projects are initialized using command-line tool:
edgedb project init
Linking to already running EdgeDB is also possible:
edgedb project init --link
Returns boolean value of whether project have been found
A displayable form for address
Are credentials set on this builder
Read environment variables and set respective configuration parameters
This function initializes builder if one of the following is set:
EDGEDB_CREDENTIALS_FILE
EDGEDB_INSTANCE
EDGEDB_DSN
EDGEDB_HOST
orEDGEDB_PORT
On the same ocassion it will reset all previously credentials.
If one of the following are set:
EDGEDB_DATABASE
EDGEDB_USER
EDGEDB_PASSWORD
Then this function overrides just specified parameters.
The insecure_dev_mode
and connection parameters are never modified by
this function for now.
Read environment variables that aren’t credentials
Set whole credentials
This marks builder as initialized
Read credentials from named instance
Named instances are created using command-line tool, directly:
edgedb instance create <name>
or when initializing a project:
edgedb project init
In the latter case you should use read_project instead if possible.
This will mark builder as initialized (if reading is successful) and
overwrite all the credentials. Although, insecure_dev_mode
, pools
sizes and timeouts are kept intact.
Read credentials from a file
This will mark builder as initialized (if reading is successful) and
overwrite all the credentials. Although, insecure_dev_mode
, pools
sizes and timeouts are kept intact.
Initialize credentials using data source name (DSN)
DSN’s that EdgeDB like are URL with egdgedb::/scheme
:
edgedb://user:secret@localhost:5656/
All the credentials can be specified using DSN, although ingesing
DSN may also include reading environment variables (if query arguments
of the for *_env
are specified) and local files (for query arguments
named *_file
).
This will mark builder as initialized (if reading is successful) and
overwrite all the credentials. Although, insecure_dev_mode
, pools
sizes and timeouts are kept intact.
Creates a new builder that has to be intialized by calling some methods
Useful only if you have connections to multiple unrelated databases, or want to have total control on the initialization of the database.
Usually Builder::from_env()
should be used instead.
Extract credentials from the Builder so they can be saved as JSON
Initialize credentials using host/port data
If any of host or port is None
it is replaced with the default of
localhost
and 5656
respectively.
This will mark builder as initialized and overwrite all the
credentials. Although, insecure_dev_mode
, pools sizes and timeouts
are kept intact.
Set user name for SCRAM authentication
Set password for SCRAM authentication
Get database name
Time to wait for database server to become available
This works by ignoring certain errors known to happen while database is starting up or restarting (e.g. “connecction refused” or early “connection reset”)
Note: the whole time that connection is being established can be up to
wait_until_available + connect_timeout
A timeout for a single connect attempt
Default is 10 seconds. Subsecond timeout should be fine for most networks, but since this timeout includes authentication, and currently that means:
- Checking a password (slow by design)
- Creating a compiler process (slow now, may be optimized later)
So in concurrent case on slower VM (such as CI with parallel tests) 10 seconds is more reasonable default.
The wait_until_available
should be larger than this value to allow
multiple attempts. And also the whole time that connection is being
established can be up to wait_until_available + connect_timeout
Set allowed certificate as pem file
Instructs TLS code to enable or disable verification
By default verification is disable if specific certificate are configured and enabled if root certificates are used.
Enables insecure dev mode
This disables certificate validation entirely
Maximum number of underlying database connections
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Builder
impl UnwindSafe for Builder
Blanket Implementations
Mutably borrows from an owned value. Read more