refrakt_cli/gen

Code generators: page, resource, migration, auth.

Values

pub fn auth() -> Nil
pub fn base_type(field_type: String) -> String

The type inside optional(<type>), or the type itself.

pub fn first_string_field(
  domain: String,
) -> option.Option(String)

The first name: String field of a generated domain type, such as pub type Post { Post(id: Int, title: String) } on one line or several.

pub fn is_optional(field_type: String) -> Bool

Whether a field type is optional(<type>): a nullable column and an Option in Gleam.

pub fn island(name: String) -> Nil
pub fn live(name: String) -> Nil
pub fn migration(name: String) -> Nil
pub fn page(name: String) -> Nil
pub fn parse_field(
  spec: String,
) -> Result(#(String, String), String)

Parse one name:type field spec, such as price:optional(float).

pub fn parse_fields(
  raw: List(String),
) -> Result(List(#(String, String)), String)

Parse name:type field specs. A type is one of field_types or optional(<one of them>); the result holds the normalized type (optional(float)), or a message saying which spec is wrong.

pub fn resource(name: String, raw_args: List(String)) -> Nil
pub fn to_gleam_type(field_type: String) -> String
pub fn to_sql_type(field_type: String) -> String
✨ Search Document