How to use knex-postgis - 1 common examples

To help you get started, we’ve selected a few knex-postgis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github catamphetamine / webapp / backend / code / common / sql.js View on Github external
if (!is_object(where))
		{
			where = { [this.id]: where }
		}

		if (!where)
		{
			throw new Error(`No argument supplied for SQL .delete()`)
		}

		return knex(this.table).where(where).del()
	}
}

const knex = Knex(knexfile)
const knex_postgis = knex_postgis_plugin(knex)

knex.postgisDefineExtras(function(knex, formatter)
{
	const extras =
	{
		longitude_latitude(longitude, latitude)
		{
			return knex.raw('ST_SetSRID(ST_MakePoint(?, ?), 4326)', [longitude, latitude])
		}
	}

	return extras
})

Sql.knex_postgis = () => knex_postgis

knex-postgis

postgis extension for knex

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis

Popular knex-postgis functions