Mosql.Schema (mosql v0.1.0)

Represents the schema mapping between MongoDB collection and SQL table ns is the namespace

Link to this section Summary

Types

t()

Schema type definition

Functions

Returns the SQL table column names for a schema mapping definition

Returns if the column for a schema mapping is a primary key

Creates a schema struct based on the collection schema definition, which is a JSON that defines the mapping between MongoDB collection and the SQL table definition

Returns the mongo document key for a schema mapping definition and the given column

store the schema mapping as key value in the Schema store <namespace>.<collection>.name = <value> <namespace>.<collection>.table = <value> <namespace>.<collection>.columns = [values...] <namespace>.<collection>.<mongo_key>.indexes = [values...] <namespace>.<collection>.<mongo_key>.column = <value> <namespace>.<collection>.<mongo_key>.type = <value> <namespace>.<collection>.<sql_column>.type = <value> <namespace>.<collection>.<sql_column>.mongo_key = <value>

Returns the primary key column name

Return the saved schema mapping struct for the given namespace and collection

Returns the schema name for a schema mapping definition

Default sorting of schemas by alphabetic ordering of the collection

Returns the SQL table name for a schema mapping definition

Returns the SQL table column type for a schema mapping definition and the given column

Link to this section Types

@type t() :: %Mosql.Schema{
  collection: String.t(),
  description: String.t(),
  indexes: term(),
  mappings: term(),
  name: String.t(),
  ns: String.t(),
  primary_keys: term(),
  table: String.t()
}

Schema type definition

Link to this section Functions

Link to this function

all_collections(ns)

Link to this function

columns(schema)

Returns the SQL table column names for a schema mapping definition

Link to this function

init_schema_store(ns)

Link to this function

is_primary_key?(schema, column)

Returns if the column for a schema mapping is a primary key

Link to this function

load_collection(collection)

Creates a schema struct based on the collection schema definition, which is a JSON that defines the mapping between MongoDB collection and the SQL table definition

Link to this function

load_schema_file(namespace, path)

Link to this function

load_schema_files(namespace, schema_path)

Link to this function

mongo_key(schema, column)

Returns the mongo document key for a schema mapping definition and the given column

Link to this function

populate_schema_store(schema)

store the schema mapping as key value in the Schema store <namespace>.<collection>.name = <value> <namespace>.<collection>.table = <value> <namespace>.<collection>.columns = [values...] <namespace>.<collection>.<mongo_key>.indexes = [values...] <namespace>.<collection>.<mongo_key>.column = <value> <namespace>.<collection>.<mongo_key>.type = <value> <namespace>.<collection>.<sql_column>.type = <value> <namespace>.<collection>.<sql_column>.mongo_key = <value>

Link to this function

primary_key(schema)

Returns the primary key column name

Link to this function

saved_schema(ns, collection)

Return the saved schema mapping struct for the given namespace and collection

Link to this function

schema_name(schema)

Returns the schema name for a schema mapping definition

Link to this function

sort_schemas(schemas)

Default sorting of schemas by alphabetic ordering of the collection

Link to this function

table_name(schema)

Returns the SQL table name for a schema mapping definition

Link to this function

type(schema, column)

Returns the SQL table column type for a schema mapping definition and the given column