zormz 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +174 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,2 +1,174 @@
1
- # ZORM
2
- Un ORM simple pero poderoso para el uso de cualquier usuario , no te enredes con cosas como definir las tablas
1
+ # ZORMZ
2
+
3
+ Un ORM ligero escrito en TypeScript para MySQL y PostgreSQL, diseñado para ser simple, rápido y extensible.
4
+
5
+ ---
6
+
7
+ ## Características
8
+
9
+ * Compatible con **ESM** y **CommonJS**
10
+ * Tipado completo en **TypeScript**
11
+ * Builder con sintaxis encadenada: `select().from().where().execute()`
12
+ * Insert múltiple con arrays
13
+ * Soporte para MySQL y PostgreSQL
14
+ * Sin dependencias pesadas
15
+ * Fácil de extender
16
+
17
+ ---
18
+
19
+ ## Instalación
20
+
21
+ ```bash
22
+ npm install zormz
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Uso básico
28
+
29
+ ### Importación (ESM)
30
+
31
+ ```ts
32
+ import { connecionLocal, getConexion } from "zormz";
33
+ ```
34
+
35
+ ### Importación (CommonJS)
36
+
37
+ ```js
38
+ const { connecionLocal, getConexion } = require("zormz");
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Ejemplo: Insertar datos
44
+
45
+ ```ts
46
+ const response = await DB.Insert('datosPrueba',
47
+ ['nombre', 'data']).Values(['yunno','magic wind']).execute();
48
+ ```
49
+
50
+ Resultado esperado:
51
+
52
+ ```sql
53
+ INSERT INTO datosPrueba (nombre, data) VALUES (?, ?);
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Ejemplo: Select
59
+
60
+ ```ts
61
+ let datos = await DB.select().from("datosPrueba").execute();
62
+ console.log(datos);
63
+ ```
64
+
65
+ ---
66
+
67
+ ## Conexión a la base de datos
68
+ ### mysql local
69
+ ```ts
70
+ import { connecionLocal, DB, getConexion } from "zormz";
71
+ //de preferencia esto en el archivo raiz index.ts
72
+ const conexion: connecionLocal = {
73
+ database: "pruebamaster",
74
+ user: "root",
75
+ password: "",
76
+ port: 3306,
77
+ host: "localhost",
78
+ };
79
+
80
+ getConexion("mysql", conexion);
81
+ ```
82
+
83
+ ---
84
+
85
+ ### pg en linea
86
+
87
+ ```ts
88
+ const conexionPg:connecionRed = {
89
+ connectionString:"ruta de la conexion"
90
+ }
91
+ getConexion("pg",conexionPg);
92
+ ```
93
+ ---
94
+
95
+ ## Métodos disponibles
96
+
97
+ ### **Select**
98
+
99
+ * `DB.select(campos)`
100
+ * `.from(tabla)`
101
+ * `.where(condición, valores).execute()`
102
+
103
+ ### **Insert**
104
+
105
+ * `DB.Insert(campos)`
106
+ * `.valores(arrayDeValores).execute()`
107
+
108
+ ### **Update**
109
+
110
+ * `DB.update(tabla)`
111
+ * `.set(campos).execute()`
112
+
113
+ ### **Delete**
114
+
115
+ * `DB.deleteFrom(tabla).where(condicionales).execute()`
116
+
117
+
118
+ ## Ejemplo completo
119
+
120
+ ```ts
121
+ import { connecionLocal, DB, eq, getConexion, ORQ } from "zormz";
122
+
123
+ const conexion: connecionLocal = {
124
+ database: "pruebamaster",
125
+ user: "root",
126
+ password: "",
127
+ port: 3306,
128
+ host: "localhost",
129
+ };
130
+
131
+ getConexion("mysql", conexion);
132
+
133
+ async function pruebaData() {
134
+ let datos = await DB.select().from("datosPrueba").execute();
135
+ console.log(datos);
136
+
137
+ let response = await DB.Insert("datosPrueba", ["nombre", "data"])
138
+ .Values([
139
+ ["yunno", "magic wind"],
140
+ ["astta", "no magic"],
141
+ ])
142
+ .execute();
143
+ console.log(response);
144
+
145
+ let update = await DB.update("datosPrueba")
146
+ .set({ nombre: "yukio", data: "es un juego ?" })
147
+ .where(eq("id", 1))
148
+ .execute();
149
+ console.log(update);
150
+
151
+ let eliminados = await DB.Delete("datosPrueba")
152
+ .where(ORQ("id", 3, 4, 5, 6))
153
+ .execute();
154
+ console.log(eliminados);
155
+ }
156
+
157
+ pruebaData().catch((e) => {
158
+ console.log("error al cargar los datos");
159
+ });
160
+
161
+ ```
162
+
163
+ ---
164
+
165
+ ## 📝 Notas
166
+
167
+ * Este ORM está en versión inicial.
168
+ * Puedes extenderlo o contribuir con nuevas funciones.
169
+
170
+ ---
171
+
172
+ ## 📄 Licencia
173
+
174
+ ISC © Yukio-kayaba
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zormz",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC",