You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-37
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,14 @@ Are you tired of these lots of heavy database libraries which do a lot of things
2
2
3
3
> Alert: This project will not fill all the edge database cases and does not aim to do so.
4
4
5
+
## Documentation
6
+
You can find the full library documentaion [here](https://github.com/ceifa/sqlier/wiki).
7
+
5
8
## Usage
6
9
7
10
### Setup a database
8
11
9
-
Firstly you will need to setup your databases, you can do it in two ways.
10
-
#### First method: Initialize function
11
-
sqlier can be itnialized by running the initializer function `sqlier.Initialize(name, drive, conn)` which accepts the following arguments:
12
+
Firstly you will need to setup your databases, sqlier can be initialized by running the initializer function `sqlier.Initialize(name, drive, conn)` which accepts the following arguments:
12
13
13
14
1.`STRING``name`: Identification name for the database (can be anything)
14
15
2.`STRING``driver`: The desired database driver, currently supports:
sqlier will also search for the `data/sqlier/database` directory:
29
-
30
-
* db2.json
31
-
```json
32
-
{
33
-
"driver": "mysqloo",
34
-
"address": "localhost",
35
-
"port": "3306",
36
-
"database": "GmodServer",
37
-
"user": "root",
38
-
"password": ""
39
-
}
40
-
```
41
28
42
29
### Setup a model
43
30
@@ -71,19 +58,6 @@ local User = sqlier.Model({
71
58
72
59
The columns `CreateTimestamp` and `UpdateTimestamp` are hard-coded internally populated automatically.
73
60
74
-
Available data types are:
75
-
76
-
```lua
77
-
sqlier.Type.String
78
-
sqlier.Type.Integer
79
-
sqlier.Type.Float
80
-
sqlier.Type.SteamId64
81
-
sqlier.Type.Bool
82
-
sqlier.Type.Date
83
-
sqlier.Type.DateTime
84
-
sqlier.Type.Timestamp
85
-
```
86
-
87
61
### Instantiate, update or delete a model
88
62
89
63
```lua
@@ -98,9 +72,6 @@ new_user.Rank = "donator"
98
72
new_user:save()
99
73
100
74
new_user:delete()
101
-
102
-
-- throw an error
103
-
new_user:save()
104
75
```
105
76
106
77
If you want to know when a save or delete is done, you can pass a callback or use their async api, if using `util.Promise`:
@@ -155,7 +126,3 @@ else
155
126
error("Database driver not supported")
156
127
end
157
128
```
158
-
159
-
### Logs
160
-
161
-
To enable the querying logs, set the convar `sqlier_logs` to `1`. Error logs will always log at the console and to the `data/sqlier` folder, at the `errors.txt` file.
0 commit comments