Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

drizzle-orm-pg

Package Overview
Dependencies
Maintainers
3
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drizzle-orm-pg - npm Package Compare versions

Comparing version 0.12.0-beta.8 to 0.12.0-beta.9

10

columns/enum.d.ts
import { ColumnData, ColumnDriverParam, ColumnHasDefault, ColumnNotNull, TableName } from 'drizzle-orm/branded-types';
import { AnyPgTable } from '../table';
import { PgColumnBuilder, PgColumnWithMapper } from './common';
export declare class PgEnum<TValues extends string> {
export interface PgEnum<TValues extends string> {
readonly enumName: string;
readonly enumValues: TValues[];
constructor(enumName: string, enumValues: TValues[]);
}
export declare class PgEnumBuilder<TData extends ColumnData<string> = ColumnData<string>, TNotNull extends ColumnNotNull = ColumnNotNull<false>, THasDefault extends ColumnHasDefault = ColumnHasDefault<false>> extends PgColumnBuilder<TData, ColumnDriverParam<string>, TNotNull, THasDefault> {
export declare function isPgEnum(obj: unknown): obj is PgEnum<string>;
export declare class PgEnumColumnBuilder<TData extends ColumnData<string> = ColumnData<string>, TNotNull extends ColumnNotNull = ColumnNotNull<false>, THasDefault extends ColumnHasDefault = ColumnHasDefault<false>> extends PgColumnBuilder<TData, ColumnDriverParam<string>, TNotNull, THasDefault> {
constructor(name: string, enumName: string, values: string[]);

@@ -15,5 +15,5 @@ }

protected brand: 'PgEnumColumn';
constructor(table: AnyPgTable<TTableName>, builder: PgEnumBuilder<TData, TNotNull, THasDefault>, enumName: string);
constructor(table: AnyPgTable<TTableName>, builder: PgEnumColumnBuilder<TData, TNotNull, THasDefault>, enumName: string);
getSQLType(): string;
}
export declare function pgEnum<T extends string = string>(enumName: string, values: T[]): PgEnum<T> & ((name: string) => PgEnumBuilder<ColumnData<T>, ColumnNotNull<false>, ColumnHasDefault<false>>);
export declare function pgEnum<T extends string = string>(enumName: string, values: T[]): ((name: string) => PgEnumColumnBuilder<ColumnData<T>, ColumnNotNull<false>, ColumnHasDefault<false>>) & PgEnum<T>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pgEnum = exports.PgEnumColumn = exports.PgEnumBuilder = exports.PgEnum = void 0;
exports.pgEnum = exports.PgEnumColumn = exports.PgEnumColumnBuilder = exports.isPgEnum = void 0;
const common_1 = require("./common");
class PgEnum {
constructor(enumName, enumValues) {
this.enumName = enumName;
this.enumValues = enumValues;
}
const isPgEnumSym = Symbol('isPgEnum');
function isPgEnum(obj) {
return !!obj && typeof obj === 'object' && isPgEnumSym in obj;
}
exports.PgEnum = PgEnum;
class PgEnumBuilder extends common_1.PgColumnBuilder {
exports.isPgEnum = isPgEnum;
class PgEnumColumnBuilder extends common_1.PgColumnBuilder {
constructor(name, enumName, values) {

@@ -23,3 +21,3 @@ super(name);

}
exports.PgEnumBuilder = PgEnumBuilder;
exports.PgEnumColumnBuilder = PgEnumColumnBuilder;
class PgEnumColumn extends common_1.PgColumnWithMapper {

@@ -36,7 +34,11 @@ constructor(table, builder, enumName) {

function pgEnum(enumName, values) {
const result = new PgEnum(enumName, values);
const columnFactory = (name) => new PgEnumBuilder(name, enumName, values);
return Object.assign(result, columnFactory);
const enumValue = {
enumName,
enumValues: values,
[isPgEnumSym]: true,
};
const columnFactory = (name) => new PgEnumColumnBuilder(name, enumName, values);
return Object.assign(columnFactory, enumValue);
}
exports.pgEnum = pgEnum;
//# sourceMappingURL=enum.js.map
{
"name": "drizzle-orm-pg",
"version": "0.12.0-beta.8",
"version": "0.12.0-beta.9",
"description": "Drizzle ORM package for PostgreSQL database",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc