Skip to content

Releases: G4brym/workers-qb

v1.2.1

02 Mar 21:33

Choose a tag to compare

What's Changed

  • fields now defaults to * when left undefined
  • Added a simplified where interface when calling without arguments, the interface is still the same when calling with parameters
const fetched = await qb
  .fetchAll({
    tableName: 'employees',
    where: ['active = true', 'department = "HR"'],
  })
  .execute()

// The example above is the same as this

const fetched = await qb
  .fetchAll({
    tableName: 'employees',
    fields: '*',
    where: {
      conditions: ['active = true', 'department = "HR"'],
    },
  })
  .execute()

Full Changelog: v1.2.0...v1.2.1

v1.2.0

28 Feb 23:19

Choose a tag to compare

What's Changed

  • Add sql results type hints
type Employee = {
  name: string
  role: string
  level: number
}

// Send your table type in every query like this:
const employeeList = await qb
  .fetchAll<Employee>({
    tableName: 'employees',
    fields: '*',
    where: {
      conditions: 'active = ?1',
      params: [true],
    },
  })
  .execute()

// You will then get type hints inside results in the shape of your table:
employeeList.results[0].name

Full Changelog: v1.1.1...v1.2.0

v1.1.1

16 Sep 10:12

Choose a tag to compare

What's Changed

  • Turn underlying db client a public property by @G4brym in #37
  • Add raw query support by @G4brym in #38

Full Changelog: v1.1.0...v1.1.1

v1.1.0

25 Jul 18:24
40dd28c

Choose a tag to compare

What's Changed

Full Changelog: v1.0.2...v1.1.0

v1.0.2

18 Jul 22:18
4a4f000

Choose a tag to compare

What's Changed

Full Changelog: v1.0.1...v1.0.2

v1.0.1

08 Jul 17:54
c047cf6

Choose a tag to compare

What's Changed

  • Fix type definition by @G4brym in #29
  • Fix FetchOne() to start returning undefined when no results by @G4brym in #30

Full Changelog: v1.0.0...v1.0.1

v1.0.0

06 Jul 11:27
bb81dfa

Choose a tag to compare

Breaking Changes

  • For upgrading you must append .execute() at the end of every query, read more here

What's Changed

  • D1 batch queries by @ejyager00 in #25
  • Fix bug when passing execute function in creation of new Query by @ejyager00 in #26
  • Update docs to match new interface and refactor tests by @G4brym in #27

Full Changelog: v0.1.12...v1.0.0

v0.1.12

19 Jun 18:22
1f5c6aa

Choose a tag to compare

What's Changed

  • Add debugger option to see generated query + parameters by @G4brym in #23
  • Allow use of subqueries in join clauses by @ejyager00 in #24

Full Changelog: v0.1.11...v0.1.12

v0.1.11

28 May 09:42

Choose a tag to compare

Fixes

  • Fix D1 insert() to respect response schema

Full Changelog: v0.1.10...v0.1.11

v0.1.10

24 May 22:25

Choose a tag to compare

Breaking Changes

  • Simplified .insert()response format to make results a single object when inserting a single record
    • If you are using .insert() with the returning option, and inserting a single record, you will be required to update the code from const user = inserted.results[0] into const user = inserted.results
    • If you are inserting multiple record at once or not using the returning option, no change is required from you

Fixes

  • Fix Raw parameter from being sent to the database as an argument

Full Changelog: v0.1.9...v0.1.10