Skip to content

v1.0.3

Latest
Compare
Choose a tag to compare
@szkiba szkiba released this 21 Feb 16:53
d47a5cd

xk6-sql v1.0.3 is here 🎉!

This release includes:

New features

  • Connection options in the open function: An optional options parameter can be used in open() to specify database connection-related options.

    sql.open(driver, "roster_db", opts)

    Properties:

    • conn_max_idle_time: Sets the maximum amount of time a connection may be idle. If 0, connections are not closed due to a connection's idle time. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". Example:
      const db = sql.open(driver, "roster_db", { conn_max_idle_time: "1h10m10s" });
    • conn_max_lifetime: Sets the maximum amount of time a connection may be reused. If 0, connections are not closed due to a connection's age. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". Example:
      const db = sql.open(driver, "roster_db", { conn_max_lifetime: "10h" });
    • max_idle_conns: Sets the maximum number of connections in the idle connection pool. If 0, no idle connections are retained. The default is currently 2. Example:
      const db = sql.open(driver, "roster_db", { max_idle_conns: 3 });
    • max_open_conns: Sets the maximum number of open connections to the database. If 0, then there is no limit on the number of open connections. The default is 0 (unlimited). Example:
      const db = sql.open(driver, "roster_db", { max_open_conns: 100 });

Bugfixes

  • Symbol type driver parameter support: The open() function now accepts Symbol (class) type driver ids in addition to the primitive symbol type. This is because when a driver is imported with the require() function, it is not a primitive symbol that is imported, but a Symbol class type. Also fixes #115