Updates
This commit is contained in:
@@ -30,7 +30,8 @@ export type ApiGetParams = Param;
|
||||
* # Make a get request to Datasquirel API
|
||||
*/
|
||||
export default async function get<
|
||||
T extends { [k: string]: any } = { [k: string]: any }
|
||||
T extends { [k: string]: any } = { [k: string]: any },
|
||||
R extends any = any
|
||||
>({
|
||||
key,
|
||||
db,
|
||||
@@ -40,7 +41,7 @@ export default async function get<
|
||||
user_id,
|
||||
debug,
|
||||
forceLocal,
|
||||
}: Param<T>): Promise<GetReturn> {
|
||||
}: Param<T>): Promise<GetReturn<R>> {
|
||||
const grabedHostNames = grabHostNames();
|
||||
const { host, port, scheme } = grabedHostNames;
|
||||
|
||||
|
||||
@@ -62,6 +62,10 @@ export default function sqlGenerator<
|
||||
|
||||
if (queryObj.equality == "LIKE") {
|
||||
str = `LOWER(${finalFieldName}) LIKE LOWER('%${valueParsed}%')`;
|
||||
} else if (queryObj.equality == "REGEXP") {
|
||||
str = `${finalFieldName} REGEXP '${valueParsed}'`;
|
||||
} else if (queryObj.equality == "FULLTEXT") {
|
||||
str = `MATCH(${finalFieldName}) AGAINST('${valueParsed}' IN BOOLEAN MODE)`;
|
||||
} else if (queryObj.equality == "NOT EQUAL") {
|
||||
str = `${finalFieldName} != ?`;
|
||||
sqlSearhValues.push(valueParsed);
|
||||
|
||||
@@ -291,9 +291,9 @@ export interface UpdateUserFunctionReturn {
|
||||
payload?: Object[] | string;
|
||||
}
|
||||
|
||||
export interface GetReturn {
|
||||
export interface GetReturn<R extends any = any> {
|
||||
success: boolean;
|
||||
payload?: any;
|
||||
payload?: R;
|
||||
msg?: string;
|
||||
error?: string;
|
||||
schema?: DSQL_TableSchemaType;
|
||||
@@ -1092,7 +1092,13 @@ export type FetchApiReturn = {
|
||||
};
|
||||
|
||||
export const ServerQueryOperators = ["AND", "OR"] as const;
|
||||
export const ServerQueryEqualities = ["EQUAL", "LIKE", "NOT EQUAL"] as const;
|
||||
export const ServerQueryEqualities = [
|
||||
"EQUAL",
|
||||
"LIKE",
|
||||
"NOT EQUAL",
|
||||
"REGEXP",
|
||||
"FULLTEXT",
|
||||
] as const;
|
||||
|
||||
export type ServerQueryParam<
|
||||
T extends { [k: string]: any } = { [k: string]: any }
|
||||
@@ -1295,6 +1301,7 @@ export type HandleSocialDbFunctionParams = {
|
||||
additionalFields?: string[];
|
||||
debug?: boolean;
|
||||
loginOnly?: boolean;
|
||||
social_id?: string | number;
|
||||
};
|
||||
|
||||
export type HandleSocialDbFunctionReturn = {
|
||||
|
||||
Reference in New Issue
Block a user