Module barrel::types

source ·
Expand description

Types constructor module

A Type is an enum provided to other barrel APIs in order to generate SQL datatypes. Working with them directly is possible but not recommended.

Instead, you can use these helper functions to construct Type enums of different…types and constraints. Field metadata is added via chainable factory pattern functions.

Default values

If no additional arguments are provided, some assumptions will be made about the metadata of a column type.

  • nullable: false
  • indexed: false
  • unique: false
  • default: None
  • size: None (which will error if size is important)

Examples

extern crate barrel;
use barrel::types::*;
 
// Make your own Primary key :)
let col = integer().increments(true).unique(true);

Structs

Export only the Type struct A database column type and all the metadata attached to it

Functions

Export all builder functions Create an array of inner types
Export all builder functions
Export all builder functions
Export all builder functions
Export all builder functions
Export all builder functions
Export all builder functions Create a basic integer type
Export all builder functions
Export all builder functions Creates an auto-incrementing primary key type
Export all builder functions
Export all builder functions