pub struct Server<A: DatabaseAdapter> { /* private fields */ }Expand description
FraiseQL HTTP Server.
Implementations§
Source§impl<A: DatabaseAdapter + Clone + Send + Sync + 'static> Server<A>
impl<A: DatabaseAdapter + Clone + Send + Sync + 'static> Server<A>
Sourcepub async fn new(
config: ServerConfig,
schema: CompiledSchema,
adapter: Arc<A>,
db_pool: Option<PgPool>,
) -> Result<Self>
pub async fn new( config: ServerConfig, schema: CompiledSchema, adapter: Arc<A>, db_pool: Option<PgPool>, ) -> Result<Self>
Create new server.
§Arguments
config- Server configurationschema- Compiled GraphQL schemaadapter- Database adapterdb_pool- Database connection pool (optional, required for observers)
§Errors
Returns error if OIDC validator initialization fails (e.g., unable to fetch discovery document or JWKS).
§Example
ⓘ
let config = ServerConfig::default();
let schema = CompiledSchema::from_json(schema_json)?;
let adapter = Arc::new(PostgresAdapter::new(db_url).await?);
let server = Server::new(config, schema, adapter, None).await?;
server.serve().await?;Auto Trait Implementations§
impl<A> Freeze for Server<A>
impl<A> !RefUnwindSafe for Server<A>
impl<A> Send for Server<A>
impl<A> Sync for Server<A>
impl<A> Unpin for Server<A>
impl<A> !UnwindSafe for Server<A>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request