import { Uint8ArrayType } from './Uint8ArrayType.js';
/** Maps a database BLOB/BYTEA column to a Node.js `Buffer`. */
export class BlobType extends Uint8ArrayType {
  convertToJSValue(value) {
    if (value instanceof Buffer || !value) {
      return value;
    }
    if (value.buffer instanceof Buffer) {
      return value.buffer;
    }
    return Buffer.from(value);
  }
  compareAsType() {
    return 'Buffer';
  }
  getColumnType(prop, platform) {
    return platform.getBlobDeclarationSQL();
  }
}
