Update Types

This commit is contained in:
Benjamin Toby 2026-03-22 13:07:38 +01:00
parent 462b897615
commit 7d320f26ef
5 changed files with 18 additions and 7 deletions

View File

@ -530,11 +530,14 @@ export type TableSelectFieldsObject<T extends {
};
export type ServerQueryValuesObject = {
value?: string | number;
/**
* Defaults to EQUAL
*/
equality?: (typeof ServerQueryEqualities)[number];
tableName?: string;
fieldName?: string;
};
export type ServerQueryObjectValue = string | (string | ServerQueryValuesObject | undefined | null) | (string | ServerQueryValuesObject | undefined | null)[];
export type ServerQueryObjectValue = string | number | ServerQueryValuesObject | undefined | null | (string | number | ServerQueryValuesObject | undefined | null)[];
export type ServerQueryObject<T extends object = {
[key: string]: any;
}, K extends string = string> = {

View File

@ -27,7 +27,7 @@ export default function sqlGenerator({ tableName, genObject, dbFullName, count }
const valueParsed = val;
if (!valueParsed)
return;
const valueString = typeof valueParsed == "string"
const valueString = typeof valueParsed == "string" || typeof valueParsed == "number"
? valueParsed
: valueParsed
? valueParsed.fieldName && valueParsed.tableName

View File

@ -1,6 +1,6 @@
{
"name": "@moduletrace/bun-sqlite",
"version": "1.0.14",
"version": "1.0.15",
"description": "SQLite manager for Bun",
"author": "Benjamin Toby",
"main": "dist/index.js",

View File

@ -601,6 +601,9 @@ export type TableSelectFieldsObject<
export type ServerQueryValuesObject = {
value?: string | number;
/**
* Defaults to EQUAL
*/
equality?: (typeof ServerQueryEqualities)[number];
tableName?: string;
fieldName?: string;
@ -608,8 +611,11 @@ export type ServerQueryValuesObject = {
export type ServerQueryObjectValue =
| string
| (string | ServerQueryValuesObject | undefined | null)
| (string | ServerQueryValuesObject | undefined | null)[];
| number
| ServerQueryValuesObject
| undefined
| null
| (string | number | ServerQueryValuesObject | undefined | null)[];
export type ServerQueryObject<
T extends object = { [key: string]: any },

View File

@ -60,13 +60,15 @@ export default function sqlGenerator<
let str = `${finalFieldName}=?`;
function grabValue(val?: string | ServerQueryValuesObject | null) {
function grabValue(
val?: string | number | ServerQueryValuesObject | null,
) {
const valueParsed = val;
if (!valueParsed) return;
const valueString =
typeof valueParsed == "string"
typeof valueParsed == "string" || typeof valueParsed == "number"
? valueParsed
: valueParsed
? valueParsed.fieldName && valueParsed.tableName