import { entityKind } from "../../entity.js";
import { CockroachColumn } from "./common.js";
import { CockroachIntColumnBaseBuilder } from "./int.common.js";
class CockroachSmallIntBuilder extends CockroachIntColumnBaseBuilder {
  static [entityKind] = "CockroachSmallIntBuilder";
  constructor(name) {
    super(name, "number", "CockroachSmallInt");
  }
  /** @internal */
  build(table) {
    return new CockroachSmallInt(
      table,
      this.config
    );
  }
}
class CockroachSmallInt extends CockroachColumn {
  static [entityKind] = "CockroachSmallInt";
  getSQLType() {
    return "int2";
  }
  mapFromDriverValue = (value) => {
    if (typeof value === "string") {
      return Number(value);
    }
    return value;
  };
}
function smallint(name) {
  return new CockroachSmallIntBuilder(name ?? "");
}
function int2(name) {
  return new CockroachSmallIntBuilder(name ?? "");
}
export {
  CockroachSmallInt,
  CockroachSmallIntBuilder,
  int2,
  smallint
};
//# sourceMappingURL=smallint.js.map