1 line
21 KiB
JavaScript
1 line
21 KiB
JavaScript
"use strict";(self.webpackChunkdocusaurus=self.webpackChunkdocusaurus||[]).push([[162],{184:(e,r,s)=>{s.r(r),s.d(r,{assets:()=>t,contentTitle:()=>l,default:()=>j,frontMatter:()=>c,metadata:()=>n,toc:()=>h});const n=JSON.parse('{"id":"classes/select","title":"Select","description":"Performs a query to retrieve data from a table.","source":"@site/docs/classes/select.md","sourceDirName":"classes","slug":"/classes/select","permalink":"/awSQL/classes/select","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":3,"frontMatter":{"sidebar_position":3},"sidebar":"defaultSidebar","previous":{"title":"Instance","permalink":"/awSQL/classes/instance"},"next":{"title":"Insert","permalink":"/awSQL/classes/insert"}}');var d=s(4848),i=s(8453);const c={sidebar_position:3},l="Select",t={},h=[{value:"Methods",id:"methods",level:2},{value:"selectDatabase()",id:"selectdatabase",level:3},{value:"distinct()",id:"distinct",level:3},{value:"where()",id:"where",level:3},{value:"having()",id:"having",level:3},{value:"order()",id:"order",level:3},{value:"count()",id:"count",level:3},{value:"sum()",id:"sum",level:3},{value:"avg()",id:"avg",level:3},{value:"group()",id:"group",level:3},{value:"join()",id:"join",level:3},{value:"limit()",id:"limit",level:3},{value:"pagination()",id:"pagination",level:3},{value:"execute()",id:"execute",level:3}];function x(e){const r={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,i.R)(),...e.components};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(r.header,{children:(0,d.jsx)(r.h1,{id:"select",children:"Select"})}),"\n",(0,d.jsx)(r.p,{children:"Performs a query to retrieve data from a table."}),"\n",(0,d.jsx)(r.hr,{}),"\n",(0,d.jsx)(r.h2,{id:"methods",children:"Methods"}),"\n",(0,d.jsx)(r.hr,{}),"\n",(0,d.jsx)(r.h3,{id:"selectdatabase",children:"selectDatabase()"}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 (",(0,d.jsx)(r.code,{children:"database"})," = ",(0,d.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.p,{children:"Selects a different database for this query."}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,d.jsxs)(r.table,{children:[(0,d.jsx)(r.thead,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.th,{children:"Parameter"}),(0,d.jsx)(r.th,{children:"Type"}),(0,d.jsx)(r.th,{children:"Description"})]})}),(0,d.jsx)(r.tbody,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"database"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"String"})}),(0,d.jsx)(r.td,{children:"Name of the database to select"})]})})]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.hr,{}),"\n",(0,d.jsx)(r.h3,{id:"distinct",children:"distinct()"}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 () \u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.p,{children:"Ensures that only unique values are returned in the query results."}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Example"})}),"\n",(0,d.jsxs)(r.p,{children:["Scenario: We want to get the ",(0,d.jsx)(r.code,{children:"EmployeeID"}),"s of the Employees that have open orders in ",(0,d.jsx)(r.a,{href:"../example-db/Orders",children:"Orders"})]}),"\n",(0,d.jsx)(r.pre,{children:(0,d.jsx)(r.code,{className:"language-js",metastring:"showLineNumbers",children:'const empOrders = await instance.select("Orders", "EmployeeID") // Selects "EmployeeID" from "Orders"\r\n .distinct() // Ensures unique EmployeeIDs\r\n .execute();\r\nconsole.log(empOrders);\r\n/* Output:\r\n[\r\n { EmployeeID: 5 },\r\n { EmployeeID: 6 },\r\n { EmployeeID: 4 },\r\n { EmployeeID: 3 },\r\n { EmployeeID: 9 },\r\n { EmployeeID: 1 },\r\n { EmployeeID: 8 },\r\n { EmployeeID: 2 },\r\n { EmployeeID: 7 }\r\n]\r\n*/\n'})}),"\n",(0,d.jsx)(r.hr,{}),"\n",(0,d.jsx)(r.h3,{id:"where",children:"where()"}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 (",(0,d.jsx)(r.code,{children:"string"})," = ",(0,d.jsx)(r.strong,{children:"String"}),", ",(0,d.jsx)(r.code,{children:"values"})," = ",(0,d.jsx)(r.strong,{children:"Array"}),"<",(0,d.jsx)(r.strong,{children:"any"}),">) \u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsxs)(r.p,{children:["Adds a ",(0,d.jsx)(r.code,{children:"WHERE"})," clause to filter results."]}),"\n",(0,d.jsxs)(r.ul,{children:["\n",(0,d.jsxs)(r.li,{children:["Use ",(0,d.jsx)(r.code,{children:"?"})," as placeholders in the condition string to prevent SQL injection."]}),"\n",(0,d.jsxs)(r.li,{children:["If using joins, specify columns as ",(0,d.jsx)(r.code,{children:"table.column"}),"."]}),"\n"]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,d.jsxs)(r.table,{children:[(0,d.jsx)(r.thead,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.th,{children:"Parameter"}),(0,d.jsx)(r.th,{children:"Type"}),(0,d.jsx)(r.th,{children:"Description"})]})}),(0,d.jsxs)(r.tbody,{children:[(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"string"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"String"})}),(0,d.jsxs)(r.td,{children:[(0,d.jsx)(r.code,{children:"WHERE"})," clause with ",(0,d.jsx)(r.code,{children:"?"})," placeholders for values."]})]}),(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"values"})}),(0,d.jsxs)(r.td,{children:[(0,d.jsx)(r.strong,{children:"Array"}),"<",(0,d.jsx)(r.strong,{children:"any"}),">"]}),(0,d.jsxs)(r.td,{children:["Values to replace ",(0,d.jsx)(r.code,{children:"?"}),", in order."]})]})]})]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Example"})}),"\n",(0,d.jsxs)(r.p,{children:["Scenario: We only want to get the ",(0,d.jsx)(r.a,{href:"../example-db/Orders",children:"Orders"})," from the Customers with the id ",(0,d.jsx)(r.code,{children:"90"})," and ",(0,d.jsx)(r.code,{children:"34"})]}),"\n",(0,d.jsx)(r.pre,{children:(0,d.jsx)(r.code,{className:"language-js",metastring:"showLineNumbers",children:"const filteredOrders = await instance.select(\"Orders\") // Select \"Orders\" table\r\n .where(\"CustomerID = ? OR CustomerID = ?\", [90, 34])\r\n .execute();\r\nconsole.log(filteredOrders);\r\n/* Output:\r\n[\r\n { OrderID: 10248, CustomerID: 90, EmployeeID: 5, OrderDate: '1996-07-04', ShipperID: 3 },\r\n { OrderID: 10250, CustomerID: 34, EmployeeID: 4, OrderDate: '1996-07-08', ShipperID: 2 },\r\n { OrderID: 10253, CustomerID: 34, EmployeeID: 3, OrderDate: '1996-07-10', ShipperID: 2 }\r\n]\r\n*/\n"})}),"\n",(0,d.jsx)(r.hr,{}),"\n",(0,d.jsx)(r.h3,{id:"having",children:"having()"}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 (",(0,d.jsx)(r.code,{children:"string"})," = ",(0,d.jsx)(r.strong,{children:"String"}),", ",(0,d.jsx)(r.code,{children:"values"})," = ",(0,d.jsx)(r.strong,{children:"Array"}),"<",(0,d.jsx)(r.strong,{children:"any"}),">) \u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsxs)(r.p,{children:["Same as ",(0,d.jsx)(r.a,{href:"#where",children:".where()"}),", but allows filtering after aggregation."]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,d.jsxs)(r.table,{children:[(0,d.jsx)(r.thead,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.th,{children:"Parameter"}),(0,d.jsx)(r.th,{children:"Type"}),(0,d.jsx)(r.th,{children:"Description"})]})}),(0,d.jsxs)(r.tbody,{children:[(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"string"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"String"})}),(0,d.jsxs)(r.td,{children:[(0,d.jsx)(r.code,{children:"HAVING"})," clause with ",(0,d.jsx)(r.code,{children:"?"})," placeholders.."]})]}),(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"values"})}),(0,d.jsxs)(r.td,{children:[(0,d.jsx)(r.strong,{children:"Array"}),"<",(0,d.jsx)(r.strong,{children:"any"}),">"]}),(0,d.jsxs)(r.td,{children:["Values to replace ",(0,d.jsx)(r.code,{children:"?"}),", in order."]})]})]})]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.hr,{}),"\n",(0,d.jsx)(r.h3,{id:"order",children:"order()"}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 (",(0,d.jsx)(r.code,{children:"column"})," = ",(0,d.jsx)(r.strong,{children:"String"}),", ",(0,d.jsx)(r.code,{children:"desc"})," = ",(0,d.jsx)(r.strong,{children:"Boolean"}),", ",(0,d.jsx)(r.code,{children:"aggregation"})," = ",(0,d.jsx)(r.strong,{children:"Enum"}),") \u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.p,{children:"Adds sorting to the query."}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,d.jsxs)(r.table,{children:[(0,d.jsx)(r.thead,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.th,{children:"Parameter"}),(0,d.jsx)(r.th,{children:"Type"}),(0,d.jsx)(r.th,{children:"Description"})]})}),(0,d.jsxs)(r.tbody,{children:[(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"column"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"String"})}),(0,d.jsx)(r.td,{children:"Column to order by."})]}),(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"desc"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"Boolean"})}),(0,d.jsxs)(r.td,{children:["Sort in descending order? Defaults to ",(0,d.jsx)(r.code,{children:"false"}),"."]})]}),(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"aggregation"})}),(0,d.jsxs)(r.td,{children:[(0,d.jsx)(r.strong,{children:"Enum"})," \u2192 ",(0,d.jsx)(r.code,{children:"MIN"}),"/",(0,d.jsx)(r.code,{children:"MAX"}),"/",(0,d.jsx)(r.code,{children:"COUNT"}),"/",(0,d.jsx)(r.code,{children:"SUM"}),"/",(0,d.jsx)(r.code,{children:"AVG"})]}),(0,d.jsx)(r.td,{children:"Optional aggregation function."})]})]})]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.hr,{}),"\n",(0,d.jsx)(r.h3,{id:"count",children:"count()"}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 (",(0,d.jsx)(r.code,{children:"doParse"})," = ",(0,d.jsx)(r.strong,{children:"Boolean"}),") \u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.p,{children:"Counts the number of rows in the first selected column."}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,d.jsxs)(r.table,{children:[(0,d.jsx)(r.thead,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.th,{children:"Parameter"}),(0,d.jsx)(r.th,{children:"Type"}),(0,d.jsx)(r.th,{children:"Description"})]})}),(0,d.jsx)(r.tbody,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"doParse"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"Boolean"})}),(0,d.jsxs)(r.td,{children:["If ",(0,d.jsx)(r.code,{children:"true"}),", returns a number instead of an array. Defaults to ",(0,d.jsx)(r.code,{children:"false"}),"."]})]})})]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.hr,{}),"\n",(0,d.jsx)(r.h3,{id:"sum",children:"sum()"}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 (",(0,d.jsx)(r.code,{children:"doParse"})," = ",(0,d.jsx)(r.strong,{children:"Boolean"}),") \u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.p,{children:"Sums numerical rows of the first selected column."}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,d.jsxs)(r.table,{children:[(0,d.jsx)(r.thead,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.th,{children:"Parameter"}),(0,d.jsx)(r.th,{children:"Type"}),(0,d.jsx)(r.th,{children:"Description"})]})}),(0,d.jsx)(r.tbody,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"doParse"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"Boolean"})}),(0,d.jsxs)(r.td,{children:["If ",(0,d.jsx)(r.code,{children:"true"}),", returns a number. Defaults to ",(0,d.jsx)(r.code,{children:"false"}),"."]})]})})]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.hr,{}),"\n",(0,d.jsx)(r.h3,{id:"avg",children:"avg()"}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 (",(0,d.jsx)(r.code,{children:"doParse"})," = ",(0,d.jsx)(r.strong,{children:"Boolean"}),") \u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.p,{children:"Calculates the average value of numerical rows in the first selected column."}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,d.jsxs)(r.table,{children:[(0,d.jsx)(r.thead,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.th,{children:"Parameter"}),(0,d.jsx)(r.th,{children:"Type"}),(0,d.jsx)(r.th,{children:"Description"})]})}),(0,d.jsx)(r.tbody,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"doParse"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"Boolean"})}),(0,d.jsxs)(r.td,{children:["If ",(0,d.jsx)(r.code,{children:"true"}),", returns a number. Defaults to ",(0,d.jsx)(r.code,{children:"false"}),"."]})]})})]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.hr,{}),"\n",(0,d.jsx)(r.h3,{id:"group",children:"group()"}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 (",(0,d.jsx)(r.code,{children:"...columns"})," = ",(0,d.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.p,{children:"Groups rows by the specified columns."}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,d.jsxs)(r.table,{children:[(0,d.jsx)(r.thead,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.th,{children:"Parameter"}),(0,d.jsx)(r.th,{children:"Type"}),(0,d.jsx)(r.th,{children:"Description"})]})}),(0,d.jsx)(r.tbody,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"...columns"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"String"})}),(0,d.jsx)(r.td,{children:"Columns to group by."})]})})]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.hr,{}),"\n",(0,d.jsx)(r.h3,{id:"join",children:"join()"}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 (",(0,d.jsx)(r.code,{children:"type"})," = ",(0,d.jsx)(r.strong,{children:"Enum"}),", ",(0,d.jsx)(r.code,{children:"table"})," = ",(0,d.jsx)(r.strong,{children:"String"}),", ",(0,d.jsx)(r.code,{children:"onOriginalColumn"})," = ",(0,d.jsx)(r.strong,{children:"String"}),", ",(0,d.jsx)(r.code,{children:"onJoinedColumn"})," = ",(0,d.jsx)(r.strong,{children:"String"}),", ",(0,d.jsx)(r.code,{children:"...columns"})," = ",(0,d.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsxs)(r.p,{children:["Performs a ",(0,d.jsx)(r.code,{children:"SQL JOIN"}),"."]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,d.jsxs)(r.table,{children:[(0,d.jsx)(r.thead,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.th,{children:"Parameter"}),(0,d.jsx)(r.th,{children:"Type"}),(0,d.jsx)(r.th,{children:"Description"})]})}),(0,d.jsxs)(r.tbody,{children:[(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"type"})}),(0,d.jsxs)(r.td,{children:[(0,d.jsx)(r.strong,{children:"Enum"})," \u2192 ",(0,d.jsx)(r.code,{children:"LEFT"}),"/",(0,d.jsx)(r.code,{children:"INNER"}),"/",(0,d.jsx)(r.code,{children:"RIGHT"}),"/",(0,d.jsx)(r.code,{children:"FULL OUTER"})]}),(0,d.jsx)(r.td,{children:"Type of join."})]}),(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"table"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"String"})}),(0,d.jsx)(r.td,{children:"Table to join with."})]}),(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"onOriginalColumn"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"String"})}),(0,d.jsx)(r.td,{children:"Column from the original table."})]}),(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"onJoinedColumn"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"String"})}),(0,d.jsx)(r.td,{children:"Column from the joined table."})]}),(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"...columns"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"String"})}),(0,d.jsx)(r.td,{children:"Columns to select."})]})]})]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.hr,{}),"\n",(0,d.jsx)(r.h3,{id:"limit",children:"limit()"}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 (",(0,d.jsx)(r.code,{children:"number"})," = ",(0,d.jsx)(r.strong,{children:"Number"}),", ",(0,d.jsx)(r.code,{children:"offset"})," = ",(0,d.jsx)(r.strong,{children:"Number"}),") \u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.p,{children:"Limits the number of returned rows and sets an offset."}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,d.jsxs)(r.table,{children:[(0,d.jsx)(r.thead,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.th,{children:"Parameter"}),(0,d.jsx)(r.th,{children:"Type"}),(0,d.jsx)(r.th,{children:"Description"})]})}),(0,d.jsxs)(r.tbody,{children:[(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"number"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"Number"})}),(0,d.jsx)(r.td,{children:"Maximum rows to return."})]}),(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"offset"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"Number"})}),(0,d.jsx)(r.td,{children:"Offset for starting position."})]})]})]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.hr,{}),"\n",(0,d.jsx)(r.h3,{id:"pagination",children:"pagination()"}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 (",(0,d.jsx)(r.code,{children:"page"})," = ",(0,d.jsx)(r.strong,{children:"Number"}),", ",(0,d.jsx)(r.code,{children:"itemsPerPage"})," = ",(0,d.jsx)(r.strong,{children:"Number"}),") \u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.p,{children:"Applies pagination to the query results."}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,d.jsxs)(r.table,{children:[(0,d.jsx)(r.thead,{children:(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.th,{children:"Parameter"}),(0,d.jsx)(r.th,{children:"Type"}),(0,d.jsx)(r.th,{children:"Description"})]})}),(0,d.jsxs)(r.tbody,{children:[(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"page"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"Number"})}),(0,d.jsx)(r.td,{children:"The page number (starting from 1)."})]}),(0,d.jsxs)(r.tr,{children:[(0,d.jsx)(r.td,{children:(0,d.jsx)(r.code,{children:"itemsPerPage"})}),(0,d.jsx)(r.td,{children:(0,d.jsx)(r.strong,{children:"Number"})}),(0,d.jsx)(r.td,{children:"Number of items per page."})]})]})]}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 ",(0,d.jsx)(r.code,{children:"this"})]}),"\n",(0,d.jsx)(r.hr,{}),"\n",(0,d.jsx)(r.h3,{id:"execute",children:"execute()"}),"\n",(0,d.jsxs)(r.p,{children:[(0,d.jsx)(r.code,{children:"async"})," \u2192 () \u2192 ",(0,d.jsx)(r.strong,{children:"Number"})," / ",(0,d.jsx)(r.strong,{children:"Array"}),"<",(0,d.jsx)(r.strong,{children:"Object"}),">"]}),"\n",(0,d.jsx)(r.p,{children:"Executes the query."}),"\n",(0,d.jsx)(r.p,{children:(0,d.jsx)(r.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(r.p,{children:["\u2192 ",(0,d.jsx)(r.strong,{children:"Number"})," - if (",(0,d.jsx)(r.code,{children:"doParse"})," is ",(0,d.jsx)(r.code,{children:"true"}),")",(0,d.jsx)("br",{}),"\r\n\u2192 ",(0,d.jsx)(r.strong,{children:"Array"}),"<",(0,d.jsx)(r.strong,{children:"Object"}),"> - Query Result"]}),"\n",(0,d.jsx)(r.hr,{})]})}function j(e={}){const{wrapper:r}={...(0,i.R)(),...e.components};return r?(0,d.jsx)(r,{...e,children:(0,d.jsx)(x,{...e})}):x(e)}},8453:(e,r,s)=>{s.d(r,{R:()=>c,x:()=>l});var n=s(6540);const d={},i=n.createContext(d);function c(e){const r=n.useContext(i);return n.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function l(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(d):e.components||d:c(e.components),n.createElement(i.Provider,{value:r},e.children)}}}]); |