Metainfo is ment to be used in templates and javascript environments. Aim is to make templates as general and reusable as possible. Metainfo is ment for similar things as:

  • titles/lables for fields
  • maximum length for strings
  • is text multiline on single line
  • maximum and minimum for numbers
  • allow sorting or not
  • field means money, percent, phone number, email, address, day of month, year, latitude or longitude etc.

User can attach any kind of information. Metainfo can be attached to table or field. It is key and value where value can be string, number or boolean (can't be null nor undefined).

Attaching metainfo:

zazler.db("n", "mysql://host/db",
{ read: "users",
  meta: {
    // set metainfo "key" to "id" for table "users"
    "users": { "key": "id" },
    // set metainfo "unsinged" to true for field ""
    "": { "unsigned": true }

In template metainfo is accessible from result.tableMeta and result.colsMeta. To see all metainfo for database there is special table _meta for that (/db/_meta.html).

meta = { table: result.tableMeta, cols: result.colsMeta }
print( JSON.stringify(meta) )


   table:  {
     "key": "id"
    colsMeta: {
      "id": {
          "unsigned": true

Automatic metainfo

Zazler fills some metadata automatically. For example primary keys and foreign keys.