-
Notifications
You must be signed in to change notification settings - Fork 3
Library Reference
Gabriel Francisco edited this page Jul 17, 2022
·
7 revisions
-
stringname: Identifier for the database -
stringdriver: Driver to be used, see drivers section -
optionaltableconninfo: Connection information, accepts the following:-
stringaddress: Host Address -
stringport: Port to connect with -
stringdatabase: Database name -
stringuser: User Name -
stringpassword: User Password
-
For Builtin SQLite
sqlier.Initialize("db_example", "sqlite")For External MySQLoo
sqlier.Initialize("db_example", "mysqloo", {
address = "127.0.0.1",
port = "3306",
database = "db_example_database",
user = "username",
pass = "pass"
})returns: Model
-
tablemodelstruct: Table that contains all the model information-
stringTable: Table to store the Model information in -
stringoptionalDatabase: Database identifier for the model to be created in -
stringIdentity: Keyname of the Primary key for the model -
tableColumns: Contains the columns of the Model, each column entry contains these methods:-
typeType: Type of the column -
anyDefault: Default value -
anyOptionalArgs: These are optional, type specific arguments
-
-
Example Model
local User = sqlier.Model({
Table = "user",
Columns = {
Id = {
Type = sqlier.Type.Integer,
AutoIncrement = true
},
Name = {
Type = sqlier.Type.String
},
Rank = {
Type = sqlier.Type.String,
MaxLength = 15
},
SteamId64 = {
Type = sqlier.Type.SteamId64
},
CreateTimestamp = {
Type = sqlier.Type.Timestamp
}
},
Identity = "Id"
})Usage of the previous model
local new_user = User({
Name = ply:Nick(),
SteamId = ply:SteamId64(),
Rank = "user"
})
new_user:save()
new_user.Rank = "donator"
new_user:save()List of all databases, created with sqlier.Initialize
Contains one method, log(string prefix, string log, number severity), which prints out the information passed to it.
Is the metatable of all Models
Is the metatable of all ModelInstances
All the following are stored in the table sqlier.Type
Special Parameters:
-
MaxLength: Defines the max length of the string (VARCHAR(MaxLength))
Special Parameters:
-
AutoIncrement: Tells SQL to automatically increment this based on the current amount (AUTOINCREMENTorAUTO_INCREMENT)
No Special Parameters
(Identical to String except a max of 17 chars)
No Special Parameters
No Special Parameters
No Special Parameters
No Special Parameters
No Special Parameters