ormlette/schema/create

Types

pub type Column {
  Column(
    name: String,
    type_: ColumnType,
    is_primary: Bool,
    is_nullable: Bool,
    is_unique: Bool,
    default: Option(dynamic.Dynamic),
    references: Option(Reference),
  )
}

Constructors

  • Column(
      name: String,
      type_: ColumnType,
      is_primary: Bool,
      is_nullable: Bool,
      is_unique: Bool,
      default: Option(dynamic.Dynamic),
      references: Option(Reference),
    )
pub type ColumnType {
  Int
  String
  Bool
  ForeignKey
  Serial
}

Constructors

  • Int
  • String
  • Bool
  • ForeignKey
  • Serial
pub type DbType {
  Integer
  Text
  Real
  Blob
}

Constructors

  • Integer
  • Text
  • Real
  • Blob
pub type Reference {
  Reference(
    table: Table,
    column: String,
    on_delete: Option(String),
    on_update: Option(String),
  )
}

Constructors

  • Reference(
      table: Table,
      column: String,
      on_delete: Option(String),
      on_update: Option(String),
    )
pub type Table {
  Table(name: String, columns: List(Column))
}

Constructors

  • Table(name: String, columns: List(Column))

Functions

pub fn dbtype_to_string(dbtype: ColumnType) -> String
pub fn default(col: Column, value: a) -> Column
pub fn define_table(name: String, columns: List(Column)) -> Table
pub fn foreign_key(
  col: Column,
  references_table: Table,
  references_column: String,
) -> Column
pub fn format_column_sql(column: Column) -> String
pub fn int(name: String) -> Column
pub fn nullable(col: Column) -> Column
pub fn primary(col: Column) -> Column
pub fn serial(name: String) -> Column
pub fn text(name: String) -> Column
pub fn unique(col: Column) -> Column
Search Document