C is Create

From Onix OS Wiki
Jump to: navigation, search

The creation process is used on models. An object is created using the ready-made structures of the models. This object is stored as hash and then automatically updated as the changes are made. But in this language, additional functions are used to update.


create(modeldef, {values and keys... for create})

In this language, the "create()" function is used to send a new data to the model. In this way, all data is sent at once and a new data is automatically created.


def db = (database("sqlite3","sqlite_database_example.db"))
def user = (model(db, "users", {
	"id": "int"
	"name": "text",
	"surname": "text",
	"username": "text",
	"email": "text",
	"password": "text",
create(user, {
	"id": 1,
	"name": "Oytun",
	"username": "oytunistrator"

We created a database and assigned a model to the database, and we automatically sent a new data to the database using this process.