The SPOD
SPOD stands for Simple Persistence Objects Database. It is a functionality of the library to allow one to define objects in haXe and save and retrieve them easily from a database.
In fact, you will need to map haXe classes to tables in your database and you will be able to insert new records, delete them, update them, and search them.
Setting a SPOD object
To create objects that you will be able to use as SPOD objects, you have to create a class that extends neko.db.Object
or php.db.Object
.
Simply create the fields that exist in your table in the class as you would normally do:
class User extends neko.db.Object { public var id : Int; public var userName : String; public var password : String; }
We will also need to define a manager
; it will be in charge of managing many operations for objects of this type. There is a standard one that you can use:
class User extends neko.db.Object { public var id : Int; public var userName : String; public var password : String; ...