### Hierarchy

- _NanoSQLQuery

## Index

### Constructors

- constructor

### Properties

- _AV
- _action
- _error
- _modifiers
- _table
- _transactionID

### Methods

- _manualExec
- exec
- groupBy
- having
- join
- limit
- offset
- orderBy
- orm
- range
- tID
- toCSV
- trieSearch
- where

## Constructors

### constructor

- new _NanoSQLQuery(table: string, db: NanoSQLInstance, actionOrView?: undefined | string): _NanoSQLQuery

- - Defined in index-query.ts:22

  #### Parameters

  - ##### table: string

  - ##### db: NanoSQLInstance

  - ##### Optional actionOrView: undefined | string

  #### Returns _NanoSQLQuery

## Properties

### _AV

_AV: string

- Defined in index-query.ts:20

### _action

_action: object

- Defined in index-query.ts:9

#### Type declaration

- ##### args: any

- ##### type: string

### _error

_error: string

- Defined in index-query.ts:18

### _modifiers

_modifiers: any[]

- Defined in index-query.ts:14

### _table

_table: string

- Defined in index-query.ts:16

### _transactionID

_transactionID: number

- Defined in index-query.ts:22

## Methods

### _manualExec

- _manualExec(table: string, modifiers: any[]): Promise<Array<Object | NanoSQLInstance>>

- - Defined in index-query.ts:305

  #### Parameters

  - ##### table: string

  - ##### modifiers: any[]

  #### Returns Promise<Array<Object | NanoSQLInstance>>

### exec

- exec(): Promise<Array<Object | NanoSQLInstance>>

- - Defined in index-query.ts:328

  Executes the current pending query to the db engine, returns a promise with the rows as objects in an array. The second argument of the promise is always the NanoSQL variable, allowing you to chain commands.

  Example: NanoSQL("users").query("select").exec().then(function(rows, db) { console.log(rows) // <= [{id:1,username:"Scott",password:"1234"},{id:2,username:"Jeb",password:"1234"}] return db.query("upsert",{password:"something more secure"}).where(["id","=",1]).exec(); }).then(function(rows, db) { ... })...

  memberof

    NanoSQLInstance

  #### Returns Promise<Array<Object | NanoSQLInstance>>

### groupBy

- groupBy(columns: object): _NanoSQLQuery

- - Defined in index-query.ts:122

  Group By command, typically used with an aggregate function.

  Example:

      NanoSQL("users").query("select",["favoriteColor","count(*)"]).groupBy({"favoriteColor":"asc"}).exec();

  This will provide a list of all favorite colors and how many each of them are in the db.

  memberof

    _NanoSQLQuery

  #### Parameters

  - ##### columns: object

    - ##### [key: string]: "asc" | "desc"

  #### Returns _NanoSQLQuery

### having

- having(args: Array<any | Array<any>>): _NanoSQLQuery

- - Defined in index-query.ts:133

  Having statement, used to filter Group BY statements. Syntax is identical to where statements.

  memberof

    _NanoSQLQuery

  #### Parameters

  - ##### args: Array<any | Array<any>>

  #### Returns _NanoSQLQuery

### join

- join(args: JoinArgs): _NanoSQLQuery

- - Defined in index-query.ts:169

  Join command.

  Example:

       NanoSQL("orders")
       .query("select", ["orders.id","orders.title","users.name"])
       .where(["orders.status","=","complete"])
       .orderBy({"orders.date":"asc"})
       .join({
           type:"inner",
           table:"users",
           where:["orders.customerID","=","user.id"]
       }).exec();

  A few notes on the join command:

  1. You muse use dot notation with the table names in all "where", "select", "orderby", and "groupby" arguments.
  2. Possible join types are `inner`, `left`, `right`, and `outer`.
  3. The "table" argument lets you determine the data on the right side of the join.
  4. The "where" argument lets you set what conditions the tables are joined on.
  memberof

    _NanoSQLQuery

  #### Parameters

  - ##### args: JoinArgs

  #### Returns _NanoSQLQuery

### limit

- limit(args: number): _NanoSQLQuery

- - Defined in index-query.ts:188

  Limits the result to a specific amount. Example:

      .limit(20) // Limit to the first 20 results

  memberof

    _NanoSQLQuery

  #### Parameters

  - ##### args: number

  #### Returns _NanoSQLQuery

### offset

- offset(args: number): _NanoSQLQuery

- - Defined in index-query.ts:228

  Offsets the results by a specific amount from the beginning. Example:

      .offset(10) // Skip the first 10 results.

  memberof

    _NanoSQLQuery

  #### Parameters

  - ##### args: number

  #### Returns _NanoSQLQuery

### orderBy

- orderBy(args: object): _NanoSQLQuery

- - Defined in index-query.ts:102

  Order the results by a given column or columns.

  Examples:

      .orderBy({username:"asc"}) // order by username column, ascending
      .orderBy({balance:"desc",lastName:"asc"}) // order by balance descending, then lastName ascending.

  memberof

    _NanoSQLQuery

  #### Parameters

  - ##### args: object

    - ##### [key: string]: "asc" | "desc"

  #### Returns _NanoSQLQuery

### orm

- orm(ormArgs?: (string | ORMArgs)[]): _NanoSQLQuery

- - Defined in index-query.ts:83

  Trigge ORM queries for all result rows.

  memberof

    _NanoSQLQuery

  #### Parameters

  - ##### Optional ormArgs: (string | ORMArgs)[]

  #### Returns _NanoSQLQuery

### range

- range(limit: number, offset: number): _NanoSQLQuery

- - Defined in index-query.ts:71

  Query to get a specific range of rows very efficiently.

  memberof

    _NanoSQLQuery

  #### Parameters

  - ##### limit: number

  - ##### offset: number

  #### Returns _NanoSQLQuery

### tID

- tID(transactionID?: undefined | number): _NanoSQLQuery

- - Defined in index-query.ts:31

  #### Parameters

  - ##### Optional transactionID: undefined | number

  #### Returns _NanoSQLQuery

### toCSV

- toCSV(headers?: undefined | true | false): Promise<string>

- - Defined in index-query.ts:264

  Export the current query to a CSV file, use in place of "exec()";

  Example: NanoSQL("users").query("select").toCSV(true).then(function(csv, db) { console.log(csv); // Returns something like: id,name,pass,postIDs 1,"scott","1234","[1,2,3,4]" 2,"jeb","5678","[5,6,7,8]" });

  memberof

    NanoSQLInstance

  #### Parameters

  - ##### Optional headers: undefined | true | false

  #### Returns Promise<string>

### trieSearch

- trieSearch(column: string, stringToSearch: string): _NanoSQLQuery

- - Defined in index-query.ts:200

  Perform a trie search on a trie column.

  memberof

    _NanoSQLQuery

  #### Parameters

  - ##### column: string

  - ##### stringToSearch: string

  #### Returns _NanoSQLQuery

### where

- where(args: Array<any | Array<any>>): _NanoSQLQuery

- - Defined in index-query.ts:55

  Used to select specific rows based on a set of conditions. You can pass in a single array with a conditional statement or an array of arrays seperated by "and", "or" for compound selects. A single where statement has the column name on the left, an operator in the middle, then a comparison on the right.

  Where Examples:

      .where(['username','=','billy'])
      .where(['balance','>',20])
      .where(['catgory','IN',['jeans','shirts']])
      .where([['name','=','scott'],'and',['balance','>',200]])
      .where([['id','>',50],'or',['postIDs','IN',[12,20,30]],'and',['name','LIKE','Billy']])

  memberof

    _NanoSQLQuery

  #### Parameters

  - ##### args: Array<any | Array<any>>

  #### Returns _NanoSQLQuery

Generated using TypeDoc