Field.js 649 B

1234567891011121314151617181920212223242526
  1. var Types = require('../constants/types');
  2. module.exports = Field;
  3. function Field(options) {
  4. options = options || {};
  5. this.parser = options.parser;
  6. this.packet = options.packet;
  7. this.db = options.packet.db;
  8. this.table = options.packet.table;
  9. this.name = options.packet.name;
  10. this.type = Types[options.packet.type];
  11. this.length = options.packet.length;
  12. }
  13. Field.prototype.string = function () {
  14. return this.parser.parseLengthCodedString();
  15. };
  16. Field.prototype.buffer = function () {
  17. return this.parser.parseLengthCodedBuffer();
  18. };
  19. Field.prototype.geometry = function () {
  20. return this.parser.parseGeometryValue();
  21. };