pub struct EmptyDatamodelConnector;
Expand description
A Connector implementor meant to be used as a default when no datasource is defined.
Trait Implementations§
source§impl Connector for EmptyDatamodelConnector
impl Connector for EmptyDatamodelConnector
source§fn provider_name(&self) -> &'static str
fn provider_name(&self) -> &'static str
The name of the provider, for string comparisons determining which connector we are on.
source§fn referential_actions(&self) -> BitFlags<ReferentialAction>
fn referential_actions(&self) -> BitFlags<ReferentialAction>
The referential actions supported by the connector.
source§fn capabilities(&self) -> ConnectorCapabilities
fn capabilities(&self) -> ConnectorCapabilities
The static list of capabilities for the connector.
source§fn max_identifier_length(&self) -> usize
fn max_identifier_length(&self) -> usize
The maximum length of constraint names in bytes. Connectors without a
limit should return usize::MAX.
source§fn available_native_type_constructors(&self) -> &'static [NativeTypeConstructor]
fn available_native_type_constructors(&self) -> &'static [NativeTypeConstructor]
Returns all available native type constructors available through this connector.
Powers the auto completion of the VSCode plugin.
source§fn scalar_type_for_native_type(
&self,
_native_type: &NativeTypeInstance
) -> ScalarType
fn scalar_type_for_native_type( &self, _native_type: &NativeTypeInstance ) -> ScalarType
Returns the default scalar type for the given native type
source§fn default_native_type_for_scalar_type(
&self,
_scalar_type: &ScalarType
) -> Option<NativeTypeInstance>
fn default_native_type_for_scalar_type( &self, _scalar_type: &ScalarType ) -> Option<NativeTypeInstance>
On each connector, each built-in Prisma scalar type (
Boolean
,
String
, Float
, etc.) has a corresponding native type.source§fn native_type_is_default_for_scalar_type(
&self,
_native_type: &NativeTypeInstance,
_scalar_type: &ScalarType
) -> bool
fn native_type_is_default_for_scalar_type( &self, _native_type: &NativeTypeInstance, _scalar_type: &ScalarType ) -> bool
Same mapping as
default_native_type_for_scalar_type()
, but in the opposite direction.source§fn native_type_to_parts(
&self,
_native_type: &NativeTypeInstance
) -> (&'static str, Vec<String>)
fn native_type_to_parts( &self, _native_type: &NativeTypeInstance ) -> (&'static str, Vec<String>)
Debug/error representation of a native type.
source§fn parse_native_type(
&self,
name: &str,
_: &[String],
span: Span,
diagnostics: &mut Diagnostics
) -> Option<NativeTypeInstance>
fn parse_native_type( &self, name: &str, _: &[String], span: Span, diagnostics: &mut Diagnostics ) -> Option<NativeTypeInstance>
This function is used during Schema parsing to calculate the concrete native type.
fn validate_url(&self, _url: &str) -> Result<(), String>
source§fn flavour(&self) -> Flavour
fn flavour(&self) -> Flavour
The database flavour, divergences in database backends capabilities might consider
us to use a different flavour, like in the case of CockroachDB. However other databases
are less divergent as to consider sharing a flavour with others, like Planetscale and MySQL
or Neon and Postgres, which respectively have the Mysql and Postgres flavours.
source§fn is_provider(&self, name: &str) -> bool
fn is_provider(&self, name: &str) -> bool
Must return true whenever the passed in provider name is a match.
source§fn has_capability(&self, capability: ConnectorCapability) -> bool
fn has_capability(&self, capability: ConnectorCapability) -> bool
Does the connector have this capability?
source§fn allowed_relation_mode_settings(&self) -> BitFlags<RelationMode>
fn allowed_relation_mode_settings(&self) -> BitFlags<RelationMode>
The relation modes that can be set through the relationMode datasource
argument.
source§fn default_relation_mode(&self) -> RelationMode
fn default_relation_mode(&self) -> RelationMode
The default relation mode to assume for this connector.
source§fn emulated_referential_actions(&self) -> BitFlags<ReferentialAction>
fn emulated_referential_actions(&self) -> BitFlags<ReferentialAction>
The referential actions supported when using relationMode = “prisma” by the connector.
There are in fact scenarios in which the set of emulated referential actions supported may change
depending on the connector. For example, Postgres’ NoAction mode behaves similarly to Restrict
(raising an error if any referencing rows still exist when the constraint is checked), but with
a subtle twist we decided not to emulate: NO ACTION allows the check to be deferred until later
in the transaction, whereas RESTRICT does not.
source§fn allows_set_null_referential_action_on_non_nullable_fields(
&self,
_relation_mode: RelationMode
) -> bool
fn allows_set_null_referential_action_on_non_nullable_fields( &self, _relation_mode: RelationMode ) -> bool
Most SQL databases reject table definitions with a SET NULL referential action referencing a non-nullable field,
but that’s not true for all of them.
This was introduced because Postgres accepts data definition language statements with the SET NULL
referential action referencing non-nullable fields, although this would lead to a runtime error once
the action is actually triggered.
fn supports_composite_types(&self) -> bool
fn supports_named_primary_keys(&self) -> bool
fn supports_named_foreign_keys(&self) -> bool
fn supports_named_default_values(&self) -> bool
fn supports_referential_action( &self, relation_mode: &RelationMode, action: ReferentialAction ) -> bool
source§fn scalar_filter_name(
&self,
scalar_type_name: String,
_native_type_name: Option<&str>
) -> Cow<'_, str>
fn scalar_filter_name( &self, scalar_type_name: String, _native_type_name: Option<&str> ) -> Cow<'_, str>
This is used by the query engine schema builder. Read more
source§fn string_filters(&self, input_object_name: &str) -> BitFlags<StringFilter>
fn string_filters(&self, input_object_name: &str) -> BitFlags<StringFilter>
This is used by the query engine schema builder. It is only called for filters of String
fields and aggregates. Read more
source§fn validate_native_type_arguments(
&self,
_native_type: &NativeTypeInstance,
_scalar_type: &ScalarType,
_span: Span,
_: &mut Diagnostics
)
fn validate_native_type_arguments( &self, _native_type: &NativeTypeInstance, _scalar_type: &ScalarType, _span: Span, _: &mut Diagnostics )
Validate that the arguments passed to a native type attribute are valid.
fn validate_enum(&self, _enum: EnumWalker<'_>, _: &mut Diagnostics)
fn validate_model( &self, _model: ModelWalker<'_>, _: RelationMode, _: &mut Diagnostics )
fn validate_relation_field( &self, _field: RelationFieldWalker<'_>, _: &mut Diagnostics )
fn validate_datasource( &self, _: BitFlags<PreviewFeature>, _: &Datasource, _: &mut Diagnostics )
fn validate_scalar_field_unknown_default_functions( &self, db: &ParserDatabase, diagnostics: &mut Diagnostics )
source§fn constraint_violation_scopes(&self) -> &'static [ConstraintScope]
fn constraint_violation_scopes(&self) -> &'static [ConstraintScope]
The scopes in which a constraint name should be validated. If empty, doesn’t check for name
clashes in the validation phase.
fn find_native_type_constructor( &self, name: &str ) -> Option<&NativeTypeConstructor>
fn supports_scalar_lists(&self) -> bool
fn supports_enums(&self) -> bool
fn supports_json(&self) -> bool
fn supports_json_lists(&self) -> bool
fn supports_auto_increment(&self) -> bool
fn supports_non_id_auto_increment(&self) -> bool
fn supports_multiple_auto_increment(&self) -> bool
fn supports_non_indexed_auto_increment(&self) -> bool
fn supports_compound_ids(&self) -> bool
fn supports_decimal(&self) -> bool
fn supported_index_types(&self) -> BitFlags<IndexAlgorithm>
fn supports_index_type(&self, algo: IndexAlgorithm) -> bool
fn allows_relation_fields_in_arbitrary_order(&self) -> bool
source§fn should_suggest_missing_referencing_fields_indexes(&self) -> bool
fn should_suggest_missing_referencing_fields_indexes(&self) -> bool
If true, the schema validator function checks whether the referencing fields in a
@relation
attribute
are included in an index.fn native_type_to_string(&self, instance: &NativeTypeInstance) -> String
fn native_instance_error( &self, instance: &NativeTypeInstance ) -> NativeTypeErrorFactory
fn datamodel_completions( &self, _db: &ParserDatabase, _position: SchemaPosition<'_>, _completions: &mut CompletionList )
fn datasource_completions( &self, _config: &Configuration, _completion_list: &mut CompletionList )
fn parse_datasource_properties( &self, _args: &mut HashMap<&str, (Span, &Expression)>, _diagnostics: &mut Diagnostics ) -> DatasourceConnectorData
fn parse_json_datetime( &self, _str: &str, _nt: Option<NativeTypeInstance> ) -> ParseResult<DateTime<FixedOffset>>
fn parse_json_bytes( &self, _str: &str, _nt: Option<NativeTypeInstance> ) -> PrismaValueResult<Vec<u8>>
Auto Trait Implementations§
impl RefUnwindSafe for EmptyDatamodelConnector
impl Send for EmptyDatamodelConnector
impl Sync for EmptyDatamodelConnector
impl Unpin for EmptyDatamodelConnector
impl UnwindSafe for EmptyDatamodelConnector
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