How to use the GEOMETRY function from sequelize

Find comprehensive JavaScript sequelize.GEOMETRY code examples handpicked from public code repositorys.

18
19
20
21
22
23
24
25
26
27
  type: Sequelize.UUID,
  allowNull: false,
  unique: 'projectItemId'
},
pin: {
  type: Sequelize.GEOMETRY('POINT', 4326),
  allowNull: false
},
quadkey: {
  type: Sequelize.STRING,
fork icon13
star icon15
watch icon24

54
55
56
57
58
59
60
61
62
63
exports._HSTORE    = Sequelize.HSTORE;
exports._JSON      = Sequelize.JSON;
exports._JSONB     = Sequelize.JSONB;
exports._ARRAY     = Sequelize.ARRAY;
exports._RANGE     = Sequelize.RANGE;
exports._GEOMETRY  = Sequelize.GEOMETRY;
exports._GEOGRAPHY = Sequelize.GEOGRAPHY;
exports._VIRTUAL   = Sequelize.VIRTUAL;
exports._ENUM      = function (arr) {
  return Sequelize.ENUM.apply(this, arr);
fork icon10
star icon15
watch icon25

+ 9 other calls in file

9
10
11
12
13
14
15
16
17
18
if (dbConfig.mysqlSTGeoMode || process.env.MYSQL_ST_GEO_MODE === 'on') {
        const wkx = require('wkx')
        Sequelize.GEOMETRY.prototype._stringify = function _stringify(value, options) {
          return `ST_GeomFromText(${options.escape(wkx.Geometry.parseGeoJSON(value).toWkt())})`;
        }
        Sequelize.GEOMETRY.prototype._bindParam = function _bindParam(value, options) {
          return `ST_GeomFromText(${options.bindParam(wkx.Geometry.parseGeoJSON(value).toWkt())})`;
        }
        Sequelize.GEOGRAPHY.prototype._stringify = function _stringify(value, options) {
          return `ST_GeomFromText(${options.escape(wkx.Geometry.parseGeoJSON(value).toWkt())})`;
fork icon9
star icon0
watch icon1

+ 3 other calls in file

4
5
6
7
8
9
10
11
12
13
id: {
  type: Sequelize.BIGINT,
  primaryKey: true
},
origin: {
  type: Sequelize.GEOMETRY('POINT')
},
destination: {
  type: Sequelize.GEOMETRY('POINT')
},
fork icon4
star icon0
watch icon3

+ 3 other calls in file

115
116
117
118
119
120
121
122
123
124
},
route: {
  type: Sequelize.GEOMETRY('LINESTRING', 4326)
},
altRouteA: {
  type: Sequelize.GEOMETRY('LINESTRING', 4326),
  allowNull: true
},
altRouteB: {
  type: Sequelize.GEOMETRY('LINESTRING', 4326),
fork icon0
star icon0
watch icon4

+ 11 other calls in file