import { FxSqlAggregation } from "./Aggregation"; import { FxSqlQueryComparator } from "./Comparators"; import { FxSqlQueryDialect } from "./Dialect"; import { FxSqlQueryHelpler } from "./Helper"; import { FxSqlQuerySubQuery } from "./SubQuery"; import { FxSqlQuery } from './Query'; export declare namespace FxSqlQuerySql { type DataToSet = { [key: string]: any; }; type SqlResultStr = string; type SqlFragmentStr = string; type SqlQueryStr = string; type SqlEscapeArgType = string | number | boolean | Date | String | Number | RegExp | Symbol; type SqlEscapeArgIdType = string | number; type SqlAssignmentValues = SqlEscapeArgType[]; type SqlAssignmentTuple = [FxSqlQuerySql.SqlFragmentStr, [...SqlAssignmentValues]?]; type SqlFromTableInput = import('@fxjs/knex').Knex.Raw | import('@fxjs/knex').Knex.QueryBuilder; type SqlTableTuple = [table: string | `(${string})` | SqlFromTableInput, alis: string]; type SqlTableInputType = string | SqlFromTableInput | SqlTableTuple; type WhereObj = { str: string; escapes: any[]; }; type WhereExistsLinkTuple_L1 = FxSqlQueryHelpler.BinaryTuple; type WhereExistsLinkTuple_L2 = FxSqlQueryHelpler.BinaryTuple; type WhereExistsLinkTuple = WhereExistsLinkTuple_L1 | WhereExistsLinkTuple_L2; interface DetailedQueryWhereCondition extends FxSqlQueryComparator.QueryComparatorObject { from: string; to: string; expr: FxSqlQueryComparator.QueryComparatorExprType; val: T; where: WhereObj; } type DetailedQueryWhereCondition__InStyle = DetailedQueryWhereCondition; interface QueryWhereConjunctionHash { or?: FxSqlQueryComparator.Input[]; and?: FxSqlQueryComparator.Input[]; not_or?: FxSqlQueryComparator.Input[]; not_and?: FxSqlQueryComparator.Input[]; not?: FxSqlQueryComparator.Input[]; } interface QueryWhereExtendItem { table: string; link_info: FxSqlQueryHelpler.Arraiable; table_linked: string; } type SqlColumnDescriptorDataType = any; interface SqlColumnDescriptor { data: SqlColumnDescriptorDataType; type?(): string; } type NormalizedSimpleSqlColumnType = string | '*'; type SqlColumnType = (SqlColumnDescriptor | string)[] | NormalizedSimpleSqlColumnType; interface SqlSelectFieldItemDescriptor { /** * @description fun name */ func_name?: string; /** * @description column name * expect NO table prefix * * ``` * recommended: `col` * ``` * * but this allowed also * * ``` * allowed also: `table.col` * ```` * */ column_name?: SqlColumnType; /** * @description column as */ as?: FxSqlQuerySql.NormalizedSimpleSqlColumnType; a?: SqlSelectFieldItemDescriptor['as']; /** * @description fun_stack */ func_stack?: FxSqlAggregation.SupportedAggregationFunction[]; /** * @description pure sql */ sql?: string; /** * @description GUESS: useful when this object refer to one complex descriptor? */ select?: string; /** * @description having sub query statement */ having?: string; } interface SqlSelectFieldsGenerator { (dialect: FxSqlQueryDialect.Dialect): string; } type SqlSelectFieldsType = SqlFragmentStr | SqlSelectFieldItemDescriptor | SqlSelectFieldsGenerator; interface QueryFromDescriptorOpts { joinType: string; } interface QueryFromDescriptor { table: string | import('@fxjs/knex').Knex.Raw | import('@fxjs/knex').Knex.QueryBuilder; alias: string; a?: string; joins?: QueryFromJoinTupleDescriptor[]; select?: SqlSelectFieldsType[]; opts?: QueryFromDescriptorOpts; } type QueryFromJoinTupleDescriptor = [ string, string, string ]; type SqlTableOrderTuple = [ string, string ]; interface SqlOrderDescriptor { c: string | SqlTableOrderTuple; d: 'DESC' | 'ASC'; } type SqlOrderPayloadType = SqlOrderDescriptor | FxSqlQuery.OrderSqlStyleTuple[0]; type SqlGroupByType = string; interface SqlFoundRowItem { [k: string]: any; } interface SqlQueryChainDescriptor { from?: QueryFromDescriptor[]; table?: string; set?: DataToSet; where?: FxSqlQuerySubQuery.SubQueryBuildDescriptor[]; order?: SqlOrderPayloadType[]; offset?: number; limit?: number; found_rows?: SqlFoundRowItem[] | boolean; group_by?: SqlGroupByType[]; where_exists?: boolean; } }