NAME

lib::Daje::Generate::Sql::Script::Fields - lib::Daje::Generate::Sql::Script::Fields

SYNOPSIS

my $json = from_json( qq (
    {
        "fields": {
            "userid": "varchar",
            "username": "varchar",
            "password": "varchar",
            "phone": "varchar",
            "active": "bigint",
            "support": "bigint",
            "is_admin": "bigint"
        }
    }
));

  my $template = GenerateSQL::Tools::Datasections->new(
      data_sections => "table,foregin_key,index" ,
      source        => 'GenerateSQL::Template::Templates'
  );

  my $fields = GenerateSQL::Sql::Table::Fields->new(
      json     => $json,
      template => $template,
  );

  $fields->create_fields();
  my $sql = $fields->sql;

DESCRIPTION

GenerateSQL::Sql::Table::Fields -- create the fields part of a create table script

REQUIRES

Syntax::Keyword::Match

feature

v5.40

METHODS

create_fields() Create the SQL for field creation from JSON
get_defaults($datatype) Get defaults part for the sql datatype