Application Data Model¶
Each application requires a different data structure and kitsune understands it. Hence one can define their own structure, and kitsune would create the optimal database architecture corresponding to it.
A schema is basically made of classes and its properties. Kitsune comes with basic data types number, string, image, link, bool. One can create custom data types too in their schema and kitsune will work using the schema.
You can create your own schema using the language editor present in the kitsune IDE.
Basic syntax that should be followed while creating the schema:
- The name of the classes and their properties can only have alphanumeric characters (A-Z, a-z, 0-9) and underscore (_).
- Don't keep the name of the class and object same.
Example DataModel¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | coffeeshop { string name string description string facebook string twitter contact contactperson blog blogpost[] testimonial review featured special[] menu section[] location address } contact { number primaryno number fax } blog { string title image blogimage kstring description } featured { string name string description string price string discount } testimonial { string name string description } menu { string header products product[] } products { string name string price } location { string address1 string address2 string country string city string state string pincode } |
Note
We'll be using this schema example throughout the documentation for reference :)
Here coffeeshop
is the base class which has properties like name
, description
, email
, location
, blog
, menu
etc. Which is the basic information about the business.
Now if you will see address
is an object of the location
class, which consists of some more properties like city
, state
, country
etc.
section
is an object of the menu class which is an array, as there will be multiple sections in a menu and the products
class (object product
) has properties name
, price
, description
, currencycode
, image
etc. in the menu class
Similarly blogpost
is an object of the blog
class, which again has properties title
and description
, where description has data type kstring.
Info
kstring is different from string data type. In kstring you also get auto-generated keywords (for SEO) relevant to the data item stored in that property.