node.js: postgreSQL16 sequelize6 es6 ORM in webstorm 2023.1 and vscode

其實就是下載的包不一樣和數據庫配置連接不一樣,代碼基本是一樣,可以再架代碼可以改配置操作選擇數據庫配置,就可以少改動代碼,變換任一個主流數據庫。其實也是学习包的代碼架構方式,也可以讓代碼重復利用,初學都是一步一步學習,後再如何讓代碼如何架構設計的更有靈活性可易讀性等。

postgreSQL script

sql 复制代码
-- Database: geovindu

-- DROP DATABASE IF EXISTS geovindu;

CREATE DATABASE geovindu
    WITH
    OWNER = postgres
    ENCODING = 'UTF8'
    LC_COLLATE = 'Chinese (Simplified)_China.936'
    LC_CTYPE = 'Chinese (Simplified)_China.936'
    LOCALE_PROVIDER = 'libc'
    TABLESPACE = pg_default
    CONNECTION LIMIT = -1
    IS_TEMPLATE = False;

COMMENT ON DATABASE geovindu
    IS 'default administrative connection database';

SELECT version();



SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_name = 'userInfos';

SELECT * FROM pg_tables where schemaname = 'public';



select * from userInfos;

select * from public."userInfos";




insert into public."userInfos"("userName","userReal","userPassword","userIsOk","userMail","userMobile","createdAt","updatedAt") 
values('geovindu','涂聚文','geovindu',true,'geovindu@163.com','13824350518','2025-07-09','2025-09-01');



--创建表
create table BookKindList
(
    BookKindID SERIAL PRIMARY KEY,
    BookKindName varchar(500) not null,
    BookKindCode varchar(100) null,
    BookKindParent int null
);
 
--查询
select * from BookKindList;
--添加
insert into BookKindList(BookKindName,BookKindParent) values('六福书目录',0);
 
insert into BookKindList(BookKindName,BookKindParent) values('文学',1);
insert into BookKindList(BookKindName,BookKindParent) values('设计艺术',1);
insert into BookKindList(BookKindName,BookKindParent) values('自然科学',1);
 
insert into BookKindList(BookKindName,BookKindParent) values('小说',2);
insert into BookKindList(BookKindName,BookKindParent) values('诗词散曲',2);
 
select * from BookKindList where BookKindID=1;
--返回增加的ID
select lastval();


/*
Executing (default): SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_name = 'tutorials'
Executing (default): CREATE TABLE IF NOT EXISTS "tutorials" ("id"   SERIAL , "title" VARCHAR(255), "description" VARCHAR(255), "published" BOOLEAN, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, PRIMARY KEY ("id"));
Executing (default): SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) AS definition FROM pg_class t, pg_class i, pg_index ix, pg_attribute a WHERE t.oid
 = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND t.relkind = 'r' and t.relname = 'tutorials' GROUP BY i.relname, ix.indexrelid, ix.indisprimary, ix.indisunique, ix.indkey ORDER BY i.relname;
Executing (default): SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_name = 'userInfos'
Executing (default): CREATE TABLE IF NOT EXISTS "userInfos" ("id"   SERIAL , "userName" VARCHAR(255), "userReal" VARCHAR(255), "userPassword" VARCHAR(255), "userIsOk" BOOLEAN, "userMail" VARCHAR(255), "userMobile" VARCHAR(255), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE 
NOT NULL, PRIMARY KEY ("id"));
Executing (default): SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) AS definition FROM pg_class t, pg_class i, pg_index ix, pg_attribute a WHERE t.oid
 = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND t.relkind = 'r' and t.relname = 'userInfos' GROUP BY i.relname, ix.indexrelid, ix.indisprimary, ix.indisunique, ix.indkey ORDER BY i.relname;
*/


	
javascript 复制代码
/**
 @description WebStorm
 @author Geovin Du,涂聚文,塗聚文  geovindu
 @project vuejsproject
 @package npm install express sequelize pg pg-hstore cors --save
 @file dbConfig.js
 @ide webstorm 2023.1
 @database mysql 8.0 sql server 2019 postgresSQL 16
 @dev node 20 vue.js 3.0
 @date Created in 8:11 2024/08/18
 @edate eddit in
 */

/**
 *
 * @type {{dialect: string, PASSWORD: string, pool: {min: number, max: number, idle: number, acquire: number}, HOST: string, USER: string, DB: string}}
 */
module.exports = {
    HOST: "geovindu",
    USER: "postgres",
    PASSWORD: "geovindu",
    DB: "geovindu",
    dialect: "postgres",
    pool: {
        max: 5,
        min: 0,
        acquire: 30000,
        idle: 10000
    }
};


/**
 @description WebStorm
 @author Geovin Du,涂聚文,塗聚文  geovindu
 @project vuejsproject
 @package npm install express sequelize pg pg-hstore cors --save
 @file userinfo.model.js
 @ide webstorm 2023.1
 @database mysql 8.0 sql server 2019 postgresSQL 16
 @dev node 20 vue.js 3.0
 @date Created in 8:28 2024/08/18
 @edate eddit in
 */


/**
 * userInfo 实体类
 * @param sequelize
 * @param Sequelize
 * @returns {*}
 */
module.exports = (sequelize, Sequelize) => {
    const UserInfo = sequelize.define("userInfo", {
        userName: {
            type: Sequelize.STRING
        },
        userReal:{
            type:Sequelize.STRING
        },
        userPassword: {
            type: Sequelize.STRING
        },
        userIsOk: {
            type: Sequelize.BOOLEAN
        },
        userMail:
            {
                type:Sequelize.STRING
            },
        userMobile:
            {

                type:Sequelize.STRING

            }
    });

    return UserInfo;
};

/**
 @description WebStorm
 @author Geovin Du,涂聚文,塗聚文  geovindu
 @project vuejsproject
 @package  npm install express sequelize pg pg-hstore cors --save
 @file index.js
 @ide webstorm 2023.1
 @database mysql 8.0 sql server 2019 postgresSQL 16
 @dev node 20 vue.js 3.0
 @date Created in 8:19 2024/08/18
 @edate eddit in
 */

/**
 *
 * @type {{dialect: string, PASSWORD: string, pool: {min: number, max: number, idle: number, acquire: number}, HOST: string, USER: string, DB: string}|{HOST?: string, USER?: string, PASSWORD?: string, DB?: string, dialect?: string, pool?: {min: number, max: number, idle: number, acquire: number}}}
 */
const dbConfig = require("../config/dbconfig.js");

/**
 *
 * @type {{Optional: Omit<T, K> & Partial<Pick<T, K>>, TableHints: TableHints, Error: BaseError, DataTypes: {RealDataTypeConstructor: RealDataTypeConstructor, AbstractDataType: AbstractDataType, EnumDataTypeOptions: EnumDataTypeOptions, IntegerDataTypeOptions: IntegerDataTypeOptions, RangeDataTypeConstructor: RangeDataTypeConstructor, ARRAY: ArrayDataTypeConstructor, SMALLINT: SmallIntegerDataTypeConstructor, TextDataTypeConstructor: TextDataTypeConstructor, TIME: AbstractDataTypeConstructor, JSON: AbstractDataTypeConstructor, BIGINT: BigIntDataTypeConstructor, SmallIntegerDataTypeConstructor: SmallIntegerDataTypeConstructor, HSTORE: AbstractDataTypeConstructor, EnumDataTypeConstructor: EnumDataTypeConstructor, ENUM: EnumDataTypeConstructor, FLOAT: FloatDataTypeConstructor, NUMBER: NumberDataTypeConstructor, BlobDataTypeOptions: BlobDataTypeOptions, StringDataTypeOptions: StringDataTypeOptions, DecimalDataTypeOptions: DecimalDataTypeOptions, GEOMETRY: GeometryDataTypeConstructor, ArrayDataTypeOptions: ArrayDataTypeOptions, DOUBLE: DoubleDataTypeConstructor, NumberDataTypeOptions: NumberDataTypeOptions, DoubleDataType: DoubleDataType, NumberDataTypeConstructor: NumberDataTypeConstructor, RANGE: RangeDataTypeConstructor, GeometryDataTypeOptions: GeometryDataTypeOptions, RangeableDataType: IntegerDataTypeConstructor | IntegerDataType | BigIntDataTypeConstructor | BigIntDataType | DecimalDataTypeConstructor | DecimalDataType | DateOnlyDataTypeConstructor | DateOnlyDataType | DateDataTypeConstructor | DateDataType, DecimalDataType: DecimalDataType, ArrayDataTypeConstructor: ArrayDataTypeConstructor, IntegerDataTypeConstructor: IntegerDataTypeConstructor, VirtualDataTypeConstructor: VirtualDataTypeConstructor, GeographyDataTypeOptions: GeographyDataTypeOptions, DataTypeAbstract: AbstractDataTypeConstructor, DateOnlyDataType: DateOnlyDataType, RealDataTypeOptions: RealDataTypeOptions, INET: AbstractDataTypeConstructor, STRING: StringDataTypeConstructor, TinyIntegerDataTypeConstructor: TinyIntegerDataTypeConstructor, NOW: AbstractDataTypeConstructor, GeographyDataType: GeographyDataType, DoubleDataTypeConstructor: DoubleDataTypeConstructor, TextDataTypeOptions: TextDataTypeOptions, CharDataTypeConstructor: CharDataTypeConstructor, BLOB: BlobDataTypeConstructor, DATEONLY: DateOnlyDataTypeConstructor, CharDataTypeOptions: CharDataTypeOptions, BigIntDataType: BigIntDataType, GeometryDataType: GeometryDataType, DateOnlyDataTypeConstructor: DateOnlyDataTypeConstructor, BigIntDataTypeConstructor: BigIntDataTypeConstructor, TEXT: TextDataTypeConstructor, GEOGRAPHY: GeographyDataTypeConstructor, RangeDataType: RangeDataType, StringDataTypeConstructor: StringDataTypeConstructor, VIRTUAL: VirtualDataTypeConstructor, UUIDV4: AbstractDataTypeConstructor, AbstractDataTypeConstructor: AbstractDataTypeConstructor, CITEXT: AbstractDataTypeConstructor, FloatDataTypeOptions: FloatDataTypeOptions, NumberDataType: NumberDataType, CIDR: AbstractDataTypeConstructor, MediumIntegerDataType: MediumIntegerDataType, RealDataType: RealDataType, VirtualDataType: VirtualDataType, DECIMAL: DecimalDataTypeConstructor, DateDataType: DateDataType, DateDataTypeOptions: DateDataTypeOptions, FloatDataTypeConstructor: FloatDataTypeConstructor, TINYINT: TinyIntegerDataTypeConstructor, BOOLEAN: AbstractDataTypeConstructor, DataType: string | AbstractDataTypeConstructor | AbstractDataType, UUID: AbstractDataTypeConstructor, DATE: DateDataTypeConstructor, DecimalDataTypeConstructor: DecimalDataTypeConstructor, INTEGER: IntegerDataTypeConstructor, SmallIntegerDataType: SmallIntegerDataType, BlobDataType: BlobDataType, GeometryDataTypeConstructor: GeometryDataTypeConstructor, MediumIntegerDataTypeConstructor: MediumIntegerDataTypeConstructor, ArrayDataType: ArrayDataType, DoubleDataTypeOptions: DoubleDataTypeOptions, StringDataType: StringDataType, GeographyDataTypeConstructor: GeographyDataTypeConstructor, BlobDataTypeConstructor: BlobDataTypeConstructor, BlobSize: "tiny" | "medium" | "long", TinyIntegerDataType: TinyIntegerDataType, UUIDV1: AbstractDataTypeConstructor, JSONB: AbstractDataTypeConstructor, DateDataTypeConstructor: DateDataTypeConstructor, REAL: RealDataTypeConstructor, RangeDataTypeOptions: RangeDataTypeOptions, IntegerDataType: IntegerDataType, TSVECTOR: AbstractDataTypeConstructor, MACADDR: AbstractDataTypeConstructor, CharDataType: CharDataType, CHAR: CharDataTypeConstructor, ABSTRACT: AbstractDataTypeConstructor, TextLength: "tiny" | "medium" | "long", TextDataType: TextDataType, EnumDataType: EnumDataType, FloatDataType: FloatDataType, MEDIUMINT: MediumIntegerDataTypeConstructor}, Validator: Validator, useInflection: (inflection: Inflector) => void, Utils: {Fn: Fn, TICK_CHAR: string, spliceStr(str: string, index: number, count: number, add: string): string, stack(): NodeJS.CallSite[], camelize(str: string): string, cloneDeep<T>(obj: T, fn?: (el: unknown) => unknown): T, Primitive: "string" | "number" | "boolean", Json: Json, Col: Col, SequelizeMethod: SequelizeMethod, removeTicks(s: string, tickChar?: string): string, camelizeIf(string: string, condition?: boolean): string, isPrimitive(val: unknown): val is Primitive, classToInvokable<T extends {new(...args: any[]): any}>(ctor: T): (T & {(...args: ConstructorParameters<T>): T}), OptionsForMapping: OptionsForMapping, NullishPropertiesOf: {[P in keyof T]-?: undefined extends T[P] ? P : (null extends T[P] ? P : never)}[keyof T], combineTableNames(tableName1: string, tableName2: string): string, DeepWriteable: DeepWriteable, underscoredIf(string: string, condition?: boolean): string, format(arr: string[], dialect: string): string, singularize(s: string): string, Inflector: Inflector, mapValueFieldNames(dataValues: object, fields: string[], model: ModelType): object, defaultValueSchemable(hash: DataType): boolean, mapWhereFieldNames(attributes: object, model: ModelType): object, formatNamedParameters(sql: string, parameters: {[p: string]: string | number | boolean}, dialect: string): string, addTicks(s: string, tickChar?: string): string, MakeNullishOptional: T extends any ? Optional<T, NullishPropertiesOf<T>> : never, pluralize(s: string): string, isColString(value: string): boolean, useInflection(inflection: Inflector): void, mergeDefaults<T>(a: T, b: Partial<T>): T, Where: Where, now(dialect: string): Date, Literal: Literal, Cast: Cast, toDefaultValue<T>(value: unknown): unknown, canTreatArrayAsAnd(arr: unknown[]): boolean, mapOptionFieldNames<M extends Model, T extends OptionsForMapping<Attributes<M>>>(options: T, model: ModelCtor<M>): T, AnyFunction: (...args: any[]) => any, mapFinderOptions<M extends Model, T extends OptionsForMapping<Attributes<M>>>(options: T, model: ModelCtor<M>): T}, IndexHints: IndexHints, Deferrable: {SET_DEFERRED: SetDeferredDeferrableStatic, INITIALLY_DEFERRED: InitiallyDeferredDeferrableStatic, InitiallyDeferredDeferrableStatic: InitiallyDeferredDeferrableStatic, SetDeferredDeferrableStatic: SetDeferredDeferrableStatic, SetImmediateDeferrableStatic: SetImmediateDeferrableStatic, AbstractDeferrableStatic: AbstractDeferrableStatic, InitiallyDeferredDeferrable: InitiallyDeferredDeferrable, SET_IMMEDIATE: SetImmediateDeferrableStatic, InitiallyImmediateDeferrableStatic: InitiallyImmediateDeferrableStatic, Deferrable: Deferrable, NOT: NotDeferrableStatic, NotDeferrable: NotDeferrable, SetDeferredDeferrable: SetDeferredDeferrable, NotDeferrableStatic: NotDeferrableStatic, INITIALLY_IMMEDIATE: InitiallyImmediateDeferrableStatic, InitiallyImmediateDeferrable: InitiallyImmediateDeferrable, SetImmediateDeferrable: SetImmediateDeferrable}, Op: OpTypes, QueryTypes: QueryTypes, ForeignKeyOptions: ForeignKeyOptions, SingleAssociationAccessors: SingleAssociationAccessors, AssociationOptions: AssociationOptions, MultiAssociationAccessors: MultiAssociationAccessors, Association: Association, ManyToManyOptions: ManyToManyOptions, AssociationScope: AssociationScope, BelongsTo: BelongsTo, BelongsToGetAssociationMixin: (options?: BelongsToGetAssociationMixinOptions) => Promise<TModel>, BelongsToSetAssociationMixinOptions: BelongsToSetAssociationMixinOptions, BelongsToOptions: BelongsToOptions, BelongsToGetAssociationMixinOptions: BelongsToGetAssociationMixinOptions, BelongsToCreateAssociationMixin: (values?: CreationAttributes<TModel>, options?: BelongsToCreateAssociationMixinOptions) => Promise<TModel>, BelongsToCreateAssociationMixinOptions: BelongsToCreateAssociationMixinOptions, BelongsToSetAssociationMixin: (newAssociation?: (TModel | TPrimaryKey), options?: BelongsToSetAssociationMixinOptions) => Promise<void>, HasOneGetAssociationMixin: (options?: HasOneGetAssociationMixinOptions) => Promise<TModel>, HasOne: HasOne, HasOneCreateAssociationMixinOptions: HasOneCreateAssociationMixinOptions, HasOneSetAssociationMixin: (newAssociation?: (TModel | TModelPrimaryKey), options?: HasOneSetAssociationMixinOptions) => Promise<void>, HasOneGetAssociationMixinOptions: HasOneGetAssociationMixinOptions, HasOneCreateAssociationMixin: (values?: CreationAttributes<TModel>, options?: HasOneCreateAssociationMixinOptions) => Promise<TModel>, HasOneSetAssociationMixinOptions: HasOneSetAssociationMixinOptions, HasOneOptions: HasOneOptions, HasManyAddAssociationMixinOptions: HasManyAddAssociationMixinOptions, HasMany: HasMany, HasManyGetAssociationsMixin: (options?: HasManyGetAssociationsMixinOptions) => Promise<TModel[]>, HasManyCreateAssociationMixin: (values?: Omit<CreationAttributes<TModel>, TForeignKey | TScope>, options?: HasManyCreateAssociationMixinOptions) => Promise<TModel>, HasManyHasAssociationsMixin: (targets: (TModel | TModelPrimaryKey)[], options?: HasManyHasAssociationsMixinOptions) => Promise<boolean>, HasManyCreateAssociationMixinOptions: HasManyCreateAssociationMixinOptions, HasManyRemoveAssociationsMixin: (oldAssociateds?: (TModel | TModelPrimaryKey)[], options?: HasManyRemoveAssociationsMixinOptions) => Promise<void>, HasManyGetAssociationsMixinOptions: HasManyGetAssociationsMixinOptions, HasManyRemoveAssociationsMixinOptions: HasManyRemoveAssociationsMixinOptions, HasManyAddAssociationsMixin: (newAssociations?: (TModel | TModelPrimaryKey)[], options?: HasManyAddAssociationsMixinOptions) => Promise<void>, HasManySetAssociationsMixinOptions: HasManySetAssociationsMixinOptions, HasManyHasAssociationMixin: (target: (TModel | TModelPrimaryKey), options?: HasManyHasAssociationMixinOptions) => Promise<boolean>, HasManyOptions: HasManyOptions, HasManyRemoveAssociationMixin: (oldAssociated?: (TModel | TModelPrimaryKey), options?: HasManyRemoveAssociationMixinOptions) => Promise<void>, HasManyAddAssociationMixin: (newAssociation?: (TModel | TModelPrimaryKey), options?: HasManyAddAssociationMixinOptions) => Promise<void>, HasManyHasAssociationMixinOptions: HasManyHasAssociationMixinOptions, HasManySetAssociationsMixin: (newAssociations?: (TModel | TModelPrimaryKey)[], options?: HasManySetAssociationsMixinOptions) => Promise<void>, HasManyCountAssociationsMixinOptions: HasManyCountAssociationsMixinOptions, HasManyHasAssociationsMixinOptions: HasManyHasAssociationsMixinOptions, HasManyCountAssociationsMixin: (options?: HasManyCountAssociationsMixinOptions) => Promise<number>, HasManyRemoveAssociationMixinOptions: HasManyRemoveAssociationMixinOptions, HasManyAddAssociationsMixinOptions: HasManyAddAssociationsMixinOptions, BelongsToManyCreateAssociationMixinOptions: BelongsToManyCreateAssociationMixinOptions, BelongsToManyAddAssociationsMixinOptions: BelongsToManyAddAssociationsMixinOptions, BelongsToManyOptions: BelongsToManyOptions, BelongsToManyRemoveAssociationsMixin: (oldAssociateds?: (TModel | TModelPrimaryKey)[], options?: BelongsToManyRemoveAssociationsMixinOptions) => Promise<void>, BelongsToManyHasAssociationMixin: (target: (TModel | TModelPrimaryKey), options?: BelongsToManyHasAssociationMixinOptions) => Promise<boolean>, BelongsToManySetAssociationsMixinOptions: BelongsToManySetAssociationsMixinOptions, BelongsToManyCreateAssociationMixin: (values?: CreationAttributes<TModel>, options?: BelongsToManyCreateAssociationMixinOptions) => Promise<TModel>, BelongsToManyAddAssociationMixinOptions: BelongsToManyAddAssociationMixinOptions, BelongsToManyHasAssociationsMixin: (targets: (TModel | TModelPrimaryKey)[], options?: BelongsToManyHasAssociationsMixinOptions) => Promise<boolean>, ThroughOptions: ThroughOptions, BelongsToManyCountAssociationsMixinOptions: BelongsToManyCountAssociationsMixinOptions, BelongsToManyAddAssociationMixin: (newAssociation?: (TModel | TModelPrimaryKey), options?: BelongsToManyAddAssociationMixinOptions) => Promise<void>, BelongsToManyRemoveAssociationsMixinOptions: BelongsToManyRemoveAssociationsMixinOptions, JoinTableAttributes: JoinTableAttributes, BelongsToManyCountAssociationsMixin: (options?: BelongsToManyCountAssociationsMixinOptions) => Promise<number>, BelongsToManyGetAssociationsMixin: (options?: BelongsToManyGetAssociationsMixinOptions) => Promise<TModel[]>, BelongsToManyGetAssociationsMixinOptions: BelongsToManyGetAssociationsMixinOptions, BelongsToManySetAssociationsMixin: (newAssociations?: (TModel | TModelPrimaryKey)[], options?: BelongsToManySetAssociationsMixinOptions) => Promise<void>, BelongsToMany: BelongsToMany, BelongsToManyHasAssociationsMixinOptions: BelongsToManyHasAssociationsMixinOptions, BelongsToManyHasAssociationMixinOptions: BelongsToManyHasAssociationMixinOptions, BelongsToManyRemoveAssociationMixin: (oldAssociated?: (TModel | TModelPrimaryKey), options?: BelongsToManyRemoveAssociationMixinOptions) => Promise<void>, BelongsToManyRemoveAssociationMixinOptions: BelongsToManyRemoveAssociationMixinOptions, BelongsToManyAddAssociationsMixin: (newAssociations?: (TModel | TModelPrimaryKey)[], options?: BelongsToManyAddAssociationsMixinOptions) => Promise<void>, RealDataTypeConstructor: RealDataTypeConstructor, AbstractDataType: AbstractDataType, EnumDataTypeOptions: EnumDataTypeOptions, IntegerDataTypeOptions: IntegerDataTypeOptions, RangeDataTypeConstructor: RangeDataTypeConstructor, ARRAY: ArrayDataTypeConstructor, SMALLINT: SmallIntegerDataTypeConstructor, TextDataTypeConstructor: TextDataTypeConstructor, TIME: AbstractDataTypeConstructor, JSON: AbstractDataTypeConstructor, BIGINT: BigIntDataTypeConstructor, SmallIntegerDataTypeConstructor: SmallIntegerDataTypeConstructor, HSTORE: AbstractDataTypeConstructor, EnumDataTypeConstructor: EnumDataTypeConstructor, ENUM: EnumDataTypeConstructor, FLOAT: FloatDataTypeConstructor, NUMBER: NumberDataTypeConstructor, BlobDataTypeOptions: BlobDataTypeOptions, StringDataTypeOptions: StringDataTypeOptions, DecimalDataTypeOptions: DecimalDataTypeOptions, GEOMETRY: GeometryDataTypeConstructor, ArrayDataTypeOptions: ArrayDataTypeOptions, DOUBLE: DoubleDataTypeConstructor, NumberDataTypeOptions: NumberDataTypeOptions, DoubleDataType: DoubleDataType, NumberDataTypeConstructor: NumberDataTypeConstructor, RANGE: RangeDataTypeConstructor, GeometryDataTypeOptions: GeometryDataTypeOptions, RangeableDataType: IntegerDataTypeConstructor | IntegerDataType | BigIntDataTypeConstructor | BigIntDataType | DecimalDataTypeConstructor | DecimalDataType | DateOnlyDataTypeConstructor | DateOnlyDataType | DateDataTypeConstructor | DateDataType, DecimalDataType: DecimalDataType, ArrayDataTypeConstructor: ArrayDataTypeConstructor, IntegerDataTypeConstructor: IntegerDataTypeConstructor, VirtualDataTypeConstructor: VirtualDataTypeConstructor, GeographyDataTypeOptions: GeographyDataTypeOptions, DataTypeAbstract: AbstractDataTypeConstructor, DateOnlyDataType: DateOnlyDataType, RealDataTypeOptions: RealDataTypeOptions, INET: AbstractDataTypeConstructor, STRING: StringDataTypeConstructor, TinyIntegerDataTypeConstructor: TinyIntegerDataTypeConstructor, NOW: AbstractDataTypeConstructor, GeographyDataType: GeographyDataType, DoubleDataTypeConstructor: DoubleDataTypeConstructor, TextDataTypeOptions: TextDataTypeOptions, CharDataTypeConstructor: CharDataTypeConstructor, BLOB: BlobDataTypeConstructor, DATEONLY: DateOnlyDataTypeConstructor, CharDataTypeOptions: CharDataTypeOptions, BigIntDataType: BigIntDataType, GeometryDataType: GeometryDataType, DateOnlyDataTypeConstructor: DateOnlyDataTypeConstructor, BigIntDataTypeConstructor: BigIntDataTypeConstructor, TEXT: TextDataTypeConstructor, GEOGRAPHY: GeographyDataTypeConstructor, RangeDataType: RangeDataType, StringDataTypeConstructor: StringDataTypeConstructor, VIRTUAL: VirtualDataTypeConstructor, UUIDV4: AbstractDataTypeConstructor, AbstractDataTypeConstructor: AbstractDataTypeConstructor, CITEXT: AbstractDataTypeConstructor, FloatDataTypeOptions: FloatDataTypeOptions, NumberDataType: NumberDataType, CIDR: AbstractDataTypeConstructor, MediumIntegerDataType: MediumIntegerDataType, RealDataType: RealDataType, VirtualDataType: VirtualDataType, DECIMAL: DecimalDataTypeConstructor, DateDataType: DateDataType, DateDataTypeOptions: DateDataTypeOptions, FloatDataTypeConstructor: FloatDataTypeConstructor, TINYINT: TinyIntegerDataTypeConstructor, BOOLEAN: AbstractDataTypeConstructor, DataType: string | AbstractDataTypeConstructor | AbstractDataType, UUID: AbstractDataTypeConstructor, DATE: DateDataTypeConstructor, DecimalDataTypeConstructor: DecimalDataTypeConstructor, INTEGER: IntegerDataTypeConstructor, SmallIntegerDataType: SmallIntegerDataType, BlobDataType: BlobDataType, GeometryDataTypeConstructor: GeometryDataTypeConstructor, MediumIntegerDataTypeConstructor: MediumIntegerDataTypeConstructor, ArrayDataType: ArrayDataType, DoubleDataTypeOptions: DoubleDataTypeOptions, StringDataType: StringDataType, GeographyDataTypeConstructor: GeographyDataTypeConstructor, BlobDataTypeConstructor: BlobDataTypeConstructor, BlobSize: "tiny" | "medium" | "long", TinyIntegerDataType: TinyIntegerDataType, UUIDV1: AbstractDataTypeConstructor, JSONB: AbstractDataTypeConstructor, DateDataTypeConstructor: DateDataTypeConstructor, REAL: RealDataTypeConstructor, RangeDataTypeOptions: RangeDataTypeOptions, IntegerDataType: IntegerDataType, TSVECTOR: AbstractDataTypeConstructor, MACADDR: AbstractDataTypeConstructor, CharDataType: CharDataType, CHAR: CharDataTypeConstructor, ABSTRACT: AbstractDataTypeConstructor, TextLength: "tiny" | "medium" | "long", TextDataType: TextDataType, EnumDataType: EnumDataType, FloatDataType: FloatDataType, MEDIUMINT: MediumIntegerDataTypeConstructor, EmptyResultError: EmptyResultError, DatabaseError: DatabaseError, AssociationError: AssociationError, ValidationErrorItemOrigin: ValidationErrorItemOrigin, TimeoutError: TimeoutError, BulkRecordError: BulkRecordError, InstanceError: InstanceError, AsyncQueueError: AsyncQueueError, UnknownConstraintError: UnknownConstraintError, SequelizeScopeError: SequelizeScopeError, ValidationErrorItemType: ValidationErrorItemType, ExclusionConstraintError: ExclusionConstraintError, EagerLoadingError: EagerLoadingError, HostNotReachableError: HostNotReachableError, InvalidConnectionError: InvalidConnectionError, ForeignKeyConstraintError: ForeignKeyConstraintError, UniqueConstraintError: UniqueConstraintError, AccessDeniedError: AccessDeniedError, HostNotFoundError: HostNotFoundError, ConnectionRefusedError: ConnectionRefusedError, OptimisticLockError: OptimisticLockError, QueryError: QueryError, ConnectionAcquireTimeoutError: ConnectionAcquireTimeoutError, AggregateError: AggregateError, ConnectionTimedOutError: ConnectionTimedOutError, ValidationErrorItem: ValidationErrorItem, ValidationError: ValidationError, ConnectionError: ConnectionError, BaseError: BaseError, CreationOptional: T extends (null | undefined) ? T : (T & {"[CreationAttributeBrand]"?: true}), ProjectionAlias: readonly [(string | Literal | Fn | Col), string], OrOperator: OrOperator, ModelOptions: ModelOptions, AnyOperator: AnyOperator, IncrementDecrementOptions: IncrementDecrementOptions, WhereOperators: WhereOperators, IncludeThroughOptions: IncludeThroughOptions, Rangable: readonly [(lower: RangePart<number | T> | number | T), (higher: RangePart<number | T> | number | T)] | [], WhereOptions: ({"[Op.or]": AllowArray<AllowNotOrAndWithImplicitAndArrayRecursive<({[AttributeName in keyof TAttributes as AttributeName extends string ? (`$${AttributeName}$` | AttributeName) : never]?: WhereAttributeHashValue<TAttributes[AttributeName]>} & {[AttributeName in keyof TAttributes as AttributeName extends string ? (`${AttributeName}.${string}` | `$${AttributeName}$.${string}` | `${`$${AttributeName}$` | `${AttributeName}.${string}` | `$${AttributeName}$.${string}` | AttributeName}::${string}`) : never]?: WhereAttributeHashValue<any>} & {[p: `$${string}.${string}$`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$::${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}::${string}`]: WhereAttributeHashValue<any>}) | Literal | Fn | Where | Json>>} | {"[Op.and]": AllowArray<AllowNotOrAndWithImplicitAndArrayRecursive<({[AttributeName in keyof TAttributes as AttributeName extends string ? (`$${AttributeName}$` | AttributeName) : never]?: WhereAttributeHashValue<TAttributes[AttributeName]>} & {[AttributeName in keyof TAttributes as AttributeName extends string ? (`${AttributeName}.${string}` | `$${AttributeName}$.${string}` | `${`$${AttributeName}$` | `${AttributeName}.${string}` | `$${AttributeName}$.${string}` | AttributeName}::${string}`) : never]?: WhereAttributeHashValue<any>} & {[p: `$${string}.${string}$`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$::${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}::${string}`]: WhereAttributeHashValue<any>}) | Literal | Fn | Where | Json>>} | {"[Op.not]": AllowNotOrAndWithImplicitAndArrayRecursive<({[AttributeName in keyof TAttributes as AttributeName extends string ? (`$${AttributeName}$` | AttributeName) : never]?: WhereAttributeHashValue<TAttributes[AttributeName]>} & {[AttributeName in keyof TAttributes as AttributeName extends string ? (`${AttributeName}.${string}` | `$${AttributeName}$.${string}` | `${`$${AttributeName}$` | `${AttributeName}.${string}` | `$${AttributeName}$.${string}` | AttributeName}::${string}`) : never]?: WhereAttributeHashValue<any>} & {[p: `$${string}.${string}$`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$::${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}::${string}`]: WhereAttributeHashValue<any>}) | Literal | Fn | Where | Json>} | ({[AttributeName in keyof TAttributes as AttributeName extends string ? (`$${AttributeName}$` | AttributeName) : never]?: WhereAttributeHashValue<TAttributes[AttributeName]>} & {[AttributeName in keyof TAttributes as AttributeName extends string ? (`${AttributeName}.${string}` | `$${AttributeName}$.${string}` | `${`$${AttributeName}$` | `${AttributeName}.${string}` | `$${AttributeName}$.${string}` | AttributeName}::${string}`) : never]?: WhereAttributeHashValue<any>} & {[p: `$${string}.${string}$`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$::${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}::${string}`]: WhereAttributeHashValue<any>}) | Literal | Fn | Where | Json)[] | {"[Op.or]": AllowArray<AllowNotOrAndWithImplicitAndArrayRecursive<({[AttributeName in keyof TAttributes as AttributeName extends string ? (`$${AttributeName}$` | AttributeName) : never]?: WhereAttributeHashValue<TAttributes[AttributeName]>} & {[AttributeName in keyof TAttributes as AttributeName extends string ? (`${AttributeName}.${string}` | `$${AttributeName}$.${string}` | `${`$${AttributeName}$` | `${AttributeName}.${string}` | `$${AttributeName}$.${string}` | AttributeName}::${string}`) : never]?: WhereAttributeHashValue<any>} & {[p: `$${string}.${string}$`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$::${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}::${string}`]: WhereAttributeHashValue<any>}) | Literal | Fn | Where | Json>>} | {"[Op.and]": AllowArray<AllowNotOrAndWithImplicitAndArrayRecursive<({[AttributeName in keyof TAttributes as AttributeName extends string ? (`$${AttributeName}$` | AttributeName) : never]?: WhereAttributeHashValue<TAttributes[AttributeName]>} & {[AttributeName in keyof TAttributes as AttributeName extends string ? (`${AttributeName}.${string}` | `$${AttributeName}$.${string}` | `${`$${AttributeName}$` | `${AttributeName}.${string}` | `$${AttributeName}$.${string}` | AttributeName}::${string}`) : never]?: WhereAttributeHashValue<any>} & {[p: `$${string}.${string}$`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$::${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}::${string}`]: WhereAttributeHashValue<any>}) | Literal | Fn | Where | Json>>} | {"[Op.not]": AllowNotOrAndWithImplicitAndArrayRecursive<({[AttributeName in keyof TAttributes as AttributeName extends string ? (`$${AttributeName}$` | AttributeName) : never]?: WhereAttributeHashValue<TAttributes[AttributeName]>} & {[AttributeName in keyof TAttributes as AttributeName extends string ? (`${AttributeName}.${string}` | `$${AttributeName}$.${string}` | `${`$${AttributeName}$` | `${AttributeName}.${string}` | `$${AttributeName}$.${string}` | AttributeName}::${string}`) : never]?: WhereAttributeHashValue<any>} & {[p: `$${string}.${string}$`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$::${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}::${string}`]: WhereAttributeHashValue<any>}) | Literal | Fn | Where | Json>} | ({[AttributeName in keyof TAttributes as AttributeName extends string ? (`$${AttributeName}$` | AttributeName) : never]?: WhereAttributeHashValue<TAttributes[AttributeName]>} & {[AttributeName in keyof TAttributes as AttributeName extends string ? (`${AttributeName}.${string}` | `$${AttributeName}$.${string}` | `${`$${AttributeName}$` | `${AttributeName}.${string}` | `$${AttributeName}$.${string}` | AttributeName}::${string}`) : never]?: WhereAttributeHashValue<any>} & {[p: `$${string}.${string}$`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$::${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}::${string}`]: WhereAttributeHashValue<any>}) | Literal | Fn | Where | Json, UpsertOptions: UpsertOptions, InstanceDestroyOptions: InstanceDestroyOptions, SearchPathable: SearchPathable, RestoreOptions: RestoreOptions, ModelScopeOptions: ModelScopeOptions, AllowReadonlyArray: readonly T[] | T, WhereGeometryOptions: WhereGeometryOptions, CountWithOptions: Pick<CountOptions<TAttributes>, Exclude<keyof CountOptions<TAttributes>, "group">> & Required<Pick<CountOptions<TAttributes>, "group">> extends infer InferredType ? {[KeyType in keyof InferredType]: InferredType[KeyType]} : never, ModelIndexesOptions: IndexesOptions, UpdateOptions: UpdateOptions, ModelGetterOptions: ModelGetterOptions, AndOperator: AndOperator, OrderItem: string | Fn | Col | Literal | [(string | Col | Fn | Literal), string] | [(Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (string | Col | Fn | Literal)] | [(Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (string | Col | Fn | Literal), string] | [(Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (string | Col | Fn | Literal)] | [(Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (string | Col | Fn | Literal), string] | [(Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (string | Col | Fn | Literal)] | [(Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (string | Col | Fn | Literal), string] | [(Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (string | Col | Fn | Literal)] | [(Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (Association<Model, Model> | (NonConstructor<Model> & {new(): Model<any, TModelAttributes>}) | {model: ModelStatic<Model>, as: string} | string), (string | Col | Fn | Literal), string], ForeignKey: T extends (null | undefined) ? T : (T & {"[ForeignKeyBrand]"?: true}), ModelValidateOptions: ModelValidateOptions, ModelNameOptions: ModelNameOptions, Attributes: M["_attributes"], Projectable: Projectable, NonNullFindOptions: NonNullFindOptions, TruncateOptions: TruncateOptions, ScopeOptions: ScopeOptions, GroupedCountResultItem: GroupedCountResultItem, SetOptions: SetOptions, FindOrCreateOptions: FindOrCreateOptions, ModelAttributeColumnReferencesOptions: ModelAttributeColumnReferencesOptions, ModelType: ModelType, DestroyOptions: DestroyOptions, FindOptions: FindOptions, WhereAttributeHash: {[AttributeName in keyof TAttributes as AttributeName extends string ? (`$${AttributeName}$` | AttributeName) : never]?: WhereAttributeHashValue<TAttributes[AttributeName]>} & {[AttributeName in keyof TAttributes as AttributeName extends string ? (`${AttributeName}.${string}` | `$${AttributeName}$.${string}` | `${`$${AttributeName}$` | `${AttributeName}.${string}` | `$${AttributeName}$.${string}` | AttributeName}::${string}`) : never]?: WhereAttributeHashValue<any>} & {[p: `$${string}.${string}$`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$::${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}::${string}`]: WhereAttributeHashValue<any>}, CreateOptions: CreateOptions, BulkCreateOptions: BulkCreateOptions, Silent: Silent, Hookable: Hookable, Filterable: Filterable, AddScopeOptions: AddScopeOptions, BuildOptions: BuildOptions, IndexHint: IndexHint, FindAndCountOptions: FindAndCountOptions, DropOptions: DropOptions, ModelAttributes: ModelAttributes, Includeable: ModelType<any, TModelAttributes> | Association<Model, Model> | IncludeOptions | {all: true, nested?: true} | string, Order: Fn | Col | Literal | OrderItem[], IndexHintable: IndexHintable, Model: Model, WhereAttributeHashValue: {"[Op.or]": AllowArray<AllowNotOrAndRecursive<AttributeType extends any[] ? (WhereOperators<AttributeType>[typeof Op.eq] | WhereOperators<AttributeType>) : (WhereOperators<AttributeType>[typeof Op.in] | WhereOperators<AttributeType>[typeof Op.eq] | WhereOperators<AttributeType>)>>} | {"[Op.and]": AllowArray<AllowNotOrAndRecursive<AttributeType extends any[] ? (WhereOperators<AttributeType>[typeof Op.eq] | WhereOperators<AttributeType>) : (WhereOperators<AttributeType>[typeof Op.in] | WhereOperators<AttributeType>[typeof Op.eq] | WhereOperators<AttributeType>)>>} | {"[Op.not]": AllowNotOrAndRecursive<AttributeType extends any[] ? (WhereOperators<AttributeType>[typeof Op.eq] | WhereOperators<AttributeType>) : (WhereOperators<AttributeType>[typeof Op.in] | WhereOperators<AttributeType>[typeof Op.eq] | WhereOperators<AttributeType>)>} | AttributeType extends any[] ? (WhereOperators<AttributeType>[typeof Op.eq] | WhereOperators<AttributeType>) : (WhereOperators<AttributeType>[typeof Op.in] | WhereOperators<AttributeType>[typeof Op.eq] | WhereOperators<AttributeType>) | ({[p: string]: WhereAttributeHashValue<any>, [p: number]: WhereAttributeHashValue<any>, [p: symbol]: WhereAttributeHashValue<any>} & {[p: `$${string}.${string}$`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$::${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}::${string}`]: WhereAttributeHashValue<any>}), InstanceUpdateOptions: InstanceUpdateOptions, InitOptions: InitOptions, InferCreationAttributes: InferCreationAttributes, ModelCtor: NonConstructor<Model> & {new(): M}, ColumnReference: Col | {"[Op.col]": string}, ModelSetterOptions: ModelSetterOptions, ModelDefined: NonConstructor<Model> & {new(): Model<S, T>}, ColumnOptions: ColumnOptions, IncludeOptions: IncludeOptions, Paranoid: Paranoid, Transactionable: Transactionable, Poolable: Poolable, FindOrBuildOptions: FindOrBuildOptions, SaveOptions: SaveOptions, SchemaOptions: SchemaOptions, Logging: Logging, InstanceRestoreOptions: InstanceRestoreOptions, WhereValue: string | number | bigint | boolean | Date | Buffer | ({[p: string]: WhereAttributeHashValue<any>, [p: number]: WhereAttributeHashValue<any>, [p: symbol]: WhereAttributeHashValue<any>} & {[p: `$${string}.${string}$`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$::${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}`]: WhereAttributeHashValue<any>, [p: `$${string}.${string}$.${string}::${string}`]: WhereAttributeHashValue<any>}) | Col | Fn | WhereGeometryOptions, CountOptions: CountOptions, FindAttributeOptions: (string | ProjectionAlias)[] | {exclude: string[], include?: (string | ProjectionAlias)[]} | {exclude?: string[], include: (string | ProjectionAlias)[]}, Range: readonly [lower: RangePart<number | T>, higher: RangePart<number | T>] | [], CreationAttributes: M["_creationAttributes"] extends any ? Optional<M["_creationAttributes"], NullishPropertiesOf<M["_creationAttributes"]>> : never, InferAttributes: InferAttributes, AllOperator: AllOperator, NonAttribute: T extends (null | undefined) ? T : (T & {"[NonAttributeBrand]"?: true}), Identifier: number | bigint | string | Buffer, ModelAttributeColumnOptions: ModelAttributeColumnOptions, IncrementDecrementOptionsWithBy: IncrementDecrementOptionsWithBy, GroupOption: string | Fn | Col | (string | Fn | Col)[], AggregateOptions: AggregateOptions, ModelStatic: NonConstructor<Model> & {new(): M}, QueryInterface: QueryInterface, ColumnsDescription: ColumnsDescription, TableNameWithSchema: TableNameWithSchema, QueryInterfaceOptions: QueryInterfaceOptions, QueryOptionsWithWhere: QueryOptionsWithWhere, AddPrimaryKeyConstraintOptions: AddPrimaryKeyConstraintOptions, IndexType: "UNIQUE" | "FULLTEXT" | "SPATIAL", TableName: string | TableNameWithSchema, AddUniqueConstraintOptions: AddUniqueConstraintOptions, QueryOptionsWithForce: QueryOptionsWithForce, ColumnDescription: ColumnDescription, QueryInterfaceCreateTableOptions: QueryInterfaceCreateTableOptions, IndexMethod: "BTREE" | "HASH" | "GIST" | "SPGIST" | "GIN" | "BRIN" | string, AddCheckConstraintOptions: AddCheckConstraintOptions, BaseConstraintOptions: BaseConstraintOptions, AddConstraintOptions: AddUniqueConstraintOptions | AddDefaultConstraintOptions | AddCheckConstraintOptions | AddPrimaryKeyConstraintOptions | AddForeignKeyConstraintOptions, FieldMap: FieldMap, IndexesOptions: IndexesOptions, QueryInterfaceIndexOptions: QueryInterfaceIndexOptions, QueryOptionsWithModel: QueryOptionsWithModel, QueryOptions: QueryOptions, CollateCharsetOptions: CollateCharsetOptions, QueryOptionsWithType: QueryOptionsWithType, QueryInterfaceDropTableOptions: QueryInterfaceDropTableOptions, CreateDatabaseOptions: CreateDatabaseOptions, BindOrReplacements: {[p: string]: unknown} | unknown[], QueryInterfaceDropAllTablesOptions: QueryInterfaceDropAllTablesOptions, FunctionParam: FunctionParam, AddForeignKeyConstraintOptions: AddForeignKeyConstraintOptions, AddDefaultConstraintOptions: AddDefaultConstraintOptions, literal(val: string): Literal, ConnectionOptions: ConnectionOptions, where: {<Op extends keyof WhereOperators>(leftOperand: (WhereLeftOperand | Where), operator: Op, rightOperand: WhereOperators[Op]): Where, <Op extends keyof WhereOperators>(leftOperand: any, operator: string, rightOperand: any): Where, (leftOperand: WhereLeftOperand, rightOperand: WhereAttributeHashValue<any>): Where}, WhereLeftOperand: Fn | Col | {"[Op.col]": string} | Literal | Cast | ModelAttributeColumnOptions<Model>, cast(val: unknown, type: string): Cast, SyncAlterOptions: SyncAlterOptions, AttributeType: Fn | Col | {"[Op.col]": string} | Literal | Cast | ModelAttributeColumnOptions<Model>, or<T extends Array<any>>(...args: T): {"[Op.or]": T}, Config: Config, PoolOptions: PoolOptions, SyncOptions: SyncOptions, json(conditionsOrPath: (string | object), value?: (string | number | boolean)): Json, col(col: string): Col, OperatorsAliases: OperatorsAliases, LogicType: Fn | Col | Literal | OrOperator<any> | AndOperator<any> | WhereOperators<any> | string | symbol, Sequelize: Sequelize, RetryOptions: Options, DefaultSetOptions: DefaultSetOptions, Dialect: "mysql" | "postgres" | "sqlite" | "mariadb" | "mssql" | "db2" | "snowflake" | "oracle", Options: Options, ReplicationOptions: ReplicationOptions, and<T extends Array<any>>(...args: T): {"[Op.and]": T}, QueryOptionsTransactionRequired: QueryOptionsTransactionRequired, fn(fn: string, ...args: unknown[]): Fn, LOCK: LOCK, TransactionOptions: TransactionOptions, Transaction: Transaction}}
 */
const Sequelize = require("sequelize");

/**
 *
 */
const sequelize = new Sequelize(dbConfig.DB, dbConfig.USER, dbConfig.PASSWORD, {
    host: dbConfig.HOST,
    dialect: dbConfig.dialect,

    pool: {
        max: dbConfig.pool.max,
        min: dbConfig.pool.min,
        acquire: dbConfig.pool.acquire,
        idle: dbConfig.pool.idle
    }
});

const db = {};

db.Sequelize = Sequelize;
db.sequelize = sequelize;


//
db.userinfos = require("./userinfo.model.js")(sequelize, Sequelize);

module.exports = db;



/**
 @description WebStorm
 @author Geovin Du,涂聚文,塗聚文  geovindu
 @project vuejsproject
 @package npm install express sequelize pg pg-hstore cors --save
 @file userinfo.controller.js
 @ide webstorm 2023.1
 @database mysql 8.0 sql server 2019 postgresSQL 16
 @dev node 20 vue.js 3.0
 @date Created in 8:33 2024/08/18
 @edate eddit in
 */


const db = require("../models");


const UserInfo = db.userinfos;
const Op = db.Sequelize.Op;

/**
 * 添加记录
 * @param {*} req
 * @param {*} res
 * @returns
 */
exports.usercreate = (req, res) => {
    // Validate request
    if (!req.body.title) {
        res.status(400).send({
            message: "Content can not be empty!"
        });
        return;
    }

    // Create a Tutorial
    const userInfo = {
        userName: req.body.userName,
        userReal:req.body.userReal,
        userPassword: req.body.userPassword,
        userIsOk: req.body.userIsOk ? req.body.userIsOk : false,
        userMail:req.body.userMail,
        userMobile:req.body.userMobile
    };

    // Save Tutorial in the database
    UserInfo.create(userInfo)
        .then(data => {
            res.send(data);
        })
        .catch(err => {
            res.status(500).send({
                message:
                    err.message || "Some error occurred while creating the userinfos."
            });
        });
};

/**
 * 查看所有记录
 * @param {*} req
 * @param {*} res
 */

exports.userfindAll = (req, res) => {
    const userName = req.query.userName;
    var condition = userName ? { userName: { [Op.like]: `%${userName}%` } } : null;

    UserInfo.findAll({ where: condition })
        .then(data => {
            res.send(data);
        })
        .catch(err => {
            res.status(500).send({
                message:
                    err.message || "Some error occurred while retrieving userinfos."
            });
        });
};

/**
 * 查找一条记录
 * @param {*} req
 * @param {*} res
 */
exports.userfindOne = (req, res) => {
    const id = req.params.id;

    UserInfo.findByPk(id)
        .then(data => {
            if (data) {
                res.send(data);
            } else {
                res.status(404).send({
                    message: `Cannot find userinfos with id=${id}.`
                });
            }
        })
        .catch(err => {
            res.status(500).send({
                message: "Error retrieving userinfos with id=" + id
            });
        });
};


/**
 * 更新记录
 * @param {*} req
 * @param {*} res
 */
exports.userupdate = (req, res) => {
    const id = req.params.id;

    UserInfo.update(req.body, {
        where: { id: id }
    })
        .then(num => {
            if (num == 1) {
                res.send({
                    message: "usrinfos was updated successfully."
                });
            } else {
                res.send({
                    message: `Cannot update userinfos with id=${id}. Maybe userinfos was not found or req.body is empty!`
                });
            }
        })
        .catch(err => {
            res.status(500).send({
                message: "Error updating userinfos with id=" + id
            });
        });
};

/**
 * 删除了一条记录
 * @param {*} req
 * @param {*} res
 */
exports.userdeleteid = (req, res) => {
    const id = req.params.id;

    UserInfo.destroy({
        where: { id: id }
    })
        .then(num => {
            if (num == 1) {
                res.send({
                    message: "userinfos was deleted successfully!"
                });
            } else {
                res.send({
                    message: `Cannot delete userinfos with id=${id}. Maybe userinfos was not found!`
                });
            }
        })
        .catch(err => {
            res.status(500).send({
                message: "Could not delete userinfos  with id=" + id
            });
        });
};

/**
 * 删除所有记录
 * @param {*} req
 * @param {*} res
 */
exports.userdeleteAll = (req, res) => {
    UserInfo.destroy({
        where: {},
        truncate: false
    })
        .then(nums => {
            res.send({ message: `${nums} userinfos were deleted successfully!` });
        })
        .catch(err => {
            res.status(500).send({
                message:
                    err.message || "Some error occurred while removing all userinfos."
            });
        });
};




/**
 * 查找有效的会员记录
 * @param {*} req 变量
 * @param {*} res 变量
 */
exports.findAlluserIsOk = (req, res) => {

    UserInfo.findAll({ where: { userIsOk: true } })
        .then(data => {
            res.send(data);
        })
        .catch(err => {
            res.status(500).send({
                message:
                    err.message || "Some error occurred while retrieving userinfos."
            });
        });
};



/**
 @description WebStorm
 @author Geovin Du,涂聚文,塗聚文  geovindu
 @project vuejsproject
 @package npm install express sequelize pg pg-hstore cors --save
 @file turorial.routes.js
 @ide webstorm 2023.1
 @database mysql 8.0 sql server 2019 postgresSQL 16
 @dev node 20 vue.js 3.0
 @date Created in 8:23 2024/08/18
 @edate eddit in
 */

/**
 *
 * @param app
 */
module.exports = app => {
   

    const userinfos=require("../controllers/userinfo.controller")

    var router = require("express").Router();


    //Create a new userinfo
    router.post("/userinfos/", userinfos.usercreate);


 
    //Retrieve all userinfos
    router.get("/userinfos/", userinfos.userfindAll);



    //Retrieve all published userinfos
    router.get("/userinfos/", userinfos.findAlluserIsOk);

  
    //Retrieve a single userinfos with id
    router.get("/userinfos/:id", userinfos.userfindOne);


   
    //Update a userinfos with id
    router.put("/userinfos/:id", userinfos.userupdate);




    //Delete a userinfos with id
    router.delete("/userinfos/:id", userinfos.userdeleteid);

    //Delete all userinfos
    router.delete("/userinfos/", userinfos.userdeleteAll);



    app.use("/api", router);
};


/**
 @description WebStorm
 @author Geovin Du,涂聚文,塗聚文  geovindu
 @project vuejsproject
 @package npm install express sequelize pg pg-hstore cors --save
 @file server.js
 @ide webstorm 2023.1
 @database mysql 8.0 sql server 2019 postgresSQL 16
 @dev node 20 vue.js 3.0 https://sequelize.org/docs/v6/getting-started/
 @date Created in 8:24 2024/08/18
 @edate eddit in
 */

const express = require("express");
// const bodyParser = require("body-parser"); /* deprecated */
const cors = require("cors");

const app = express();

var corsOptions = {
    origin: "http://localhost:8082"
};

app.use(cors(corsOptions));

// parse requests of content-type - application/json
app.use(express.json());  /* bodyParser.json() is deprecated */

// parse requests of content-type - application/x-www-form-urlencoded
app.use(express.urlencoded({ extended: true }));   /* bodyParser.urlencoded() is deprecated */

const db = require("./models/index");

db.sequelize.sync()
    .then(() => {
        console.log("Synced db.");
    })
    .catch((err) => {
        console.log("Failed to sync db: " + err.message);
    });

// // drop the table if it already exists
// db.sequelize.sync({ force: true }).then(() => {
//   console.log("Drop and re-sync db.");
// });

// simple route
app.get("/", (req, res) => {
    res.json({ message: "Welcome to bezkoder application." });
});

require("./routes/turorial.routes")(app);

// set port, listen for requests
const PORT = process.env.PORT || 8081;
app.listen(PORT, () => {
    console.log(`Server is running on port ${PORT}.`);
});

package.json

javascript 复制代码
{
  "name": "vuejsproject",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "@vue/cli-plugin-babel": "^5.0.8",
    "@vue/cli-plugin-eslint": "^5.0.8",
    "@vue/cli-service": "^5.0.8",
    "@vue/compiler-sfc": "^3.4.38",
    "axios": "^1.7.4",
    "babel-eslint": "^10.1.0",
    "bootstrap": "^5.3.3",
    "chalk-animation": "^2.0.3",
    "core-js": "^3.38.0",
    "cors": "^2.8.5",
    "eslint": "^8.57.0",
    "eslint-plugin-vue": "^9.27.0",
    "express": "^4.19.2",
    "mysql2": "^3.11.0",
    "pg": "^8.12.0",
    "pg-hstore": "^2.3.4",
    "popper.js": "^1.16.1",
    "qs": "^6.13.0",
    "sequelize": "^6.37.3",
    "tedious": "^18.3.0",
    "vue": "^3.4.29",
    "vue-router": "^4.4.2"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^5.0.5",
    "vite": "^5.3.1"
  }
}

运行:

javascript 复制代码
node server

自动创建表

vscode:

javascript 复制代码
/*
 * @creater: geovindu
 * @since: 2024-08-18 17:29:10
 * @LastAuthor: geovindu
 * @lastTime: 2024-08-18 20:19:22
 * @文件相对于项目的路径: \jsstudy\vuejs\npostgresql\config\dbConfig.js
 * @package: npm install express sequelize pg pg-hstore cors --save
 * @database:  mysql 8.0 sql server 2019 postgresSQL 16  https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
 * @message2: geovindu
 * @IDE: vscode
 * @Development: node.js 20, vuejs3.0
 * Copyright (c) 2024 by geovindu email:geovindu@163.com, All Rights Reserved.
 */


/**
 * Description placeholder
 *
 * @type {{ HOST: string; USER: string; PASSWORD: string; DB: string; dialect: string; pool: { max: number; min: number; acquire: number; idle: number; }; }}
 */
const dbConfig = {
    HOST: "geovindu",
    USER: "postgres",
    PASSWORD: "geovindu",
    DB: "geovindu",
    dialect: "postgres",
    pool: {
        max: 5,
        min: 0,
        acquire: 30000,
        idle: 10000
    }
};

export default dbConfig;


/*
 * @creater: geovindu
 * @since: 2024-08-18 17:34:27
 * @LastAuthor: geovindu
 * @lastTime: 2024-08-18 17:35:05
 * @文件相对于项目的路径: \jsstudy\vuejs\npostgresql\models\userinfo.model.js
 * @message2: geovindu
 * @IDE: vscode
 * @Development: node.js 20, vuejs3.0
 * @package: npm install express sequelize pg pg-hstore cors --save
 * @database: mysql 8.0 sql server 2019 postgresSQL 16 
 * Copyright (c) 2024 by geovindu email:geovindu@163.com, All Rights Reserved.
 */



/**
 * userInfo 实体
 * @param {*} sequelize
 * @param {*} Sequelize
 * @returns
 */
 
const UserInfo = (sequelize, Sequelize) => {
    const UserInfo = sequelize.define("userInfo", {
      userName: {
        type: Sequelize.STRING
      },
      userPassword: {
        type: Sequelize.STRING
      },
      userIsOk: {
        type: Sequelize.BOOLEAN
      },
      userMail:
      {
        type:Sequelize.STRING
      },
      userMobile:
      {
 
        type:Sequelize.STRING
         
      }
    });
    
    return UserInfo;
  };
  
  export default UserInfo;



/*
 * @creater: geovindu
 * @since: 2024-08-18 17:36:31
 * @LastAuthor: geovindu
 * @lastTime: 2024-08-18 18:07:00
 * @文件相对于项目的路径: \jsstudy\vuejs\npostgresql\models\index.js
 * @message2: geovindu
 * @IDE: vscode
 * @Development: node.js 20, vuejs3.0
 * @package: npm install express sequelize pg pg-hstore cors --save
 * @database: mysql 8.0 sql server 2019 postgresSQL 16 
 * Copyright (c) 2024 by geovindu email:geovindu@163.com, All Rights Reserved.
 */
import dbConfig from "../config/dbConfig.js";
import Sequelize from "sequelize";
import tutorials from "./tutorial.model.js"
import userinfos from "./userinfo.model.js"


/**
 * Description placeholder
 *
 * @type {*}
 */
const sequelize = new Sequelize(dbConfig.DB, dbConfig.USER, dbConfig.PASSWORD, {
  host: dbConfig.HOST,
  dialect: dbConfig.dialect,
  operatorsAliases: false,
  
  pool: {
    max: dbConfig.pool.max,
    min: dbConfig.pool.min,
    acquire: dbConfig.pool.acquire,
    idle: dbConfig.pool.idle
  }
});
  
const db = {};
  
db.Sequelize = Sequelize;
db.sequelize = sequelize;
  


 db.userinfos=userinfos(sequelize,Sequelize); 

export default db;




/**
 * controleers/userinfo.controller.js
 * npm install express sequelize pg pg-hstore cors --save
 */
import db  from "../models/index.js";
  
const UserInfo = db.userinfos;
const Op = db.Sequelize.Op;
  
/**
 *
 * @param {*} req
 * @param {*} res
 * @returns
 */
 const usercreate = (req, res) => {
    // Validate request
    if (!req.body.title) {
      res.status(400).send({
        message: "Content can not be empty!"
      });
      return;
    }
    
    // Create a userinfos
    const userInfo = {
      userName: req.body.userName,
      userPassword: req.body.userPassword,
      userIsOk: req.body.userIsOk ? req.body.userIsOk : false,
      userMail:req.body.userMail,
      userMobile:req.body.userMobile
    };
    
    // Save userinfos in the database
    UserInfo.create(userInfo)
      .then(data => {
        res.send(data);
      })
      .catch(err => {
        res.status(500).send({
          message:
            err.message || "Some error occurred while creating the userinfos."
        });
      });
  };
  
/**
 *
 * @param {*} req
 * @param {*} res
 */
  
const  userfindAll = (req, res) => {
    const userName = req.query.userName;
    var condition = userName ? { userName: { [Op.like]: `%${userName}%` } } : null;
    
    UserInfo.findAll({ where: condition })
      .then(data => {
        res.send(data);
      })
      .catch(err => {
        res.status(500).send({
          message:
            err.message || "Some error occurred while retrieving userinfos."
        });
      });
  };
  
/**
 *
 * @param {*} req
 * @param {*} res
 */
const userfindOne = (req, res) => {
    const id = req.params.id;
    
    UserInfo.findByPk(id)
      .then(data => {
        if (data) {
          res.send(data);
        } else {
          res.status(404).send({
            message: `Cannot find userinfos with id=${id}.`
          });
        }
      })
      .catch(err => {
        res.status(500).send({
          message: "Error retrieving userinfos with id=" + id
        });
      });
  };
  
  
/**
 *
 * @param {*} req
 * @param {*} res
 */
const userupdate = (req, res) => {
    const id = req.params.id;
    
    UserInfo.update(req.body, {
      where: { id: id }
    })
      .then(num => {
        if (num == 1) {
          res.send({
            message: "usrinfos was updated successfully."
          });
        } else {
          res.send({
            message: `Cannot update userinfos with id=${id}. Maybe userinfos was not found or req.body is empty!`
          });
        }
      })
      .catch(err => {
        res.status(500).send({
          message: "Error updating userinfos with id=" + id
        });
      });
  };
  
/**
 *
 * @param {*} req
 * @param {*} res
 */
const userdeleteid = (req, res) => {
    const id = req.params.id;
    
    UserInfo.destroy({
      where: { id: id }
    })
      .then(num => {
        if (num == 1) {
          res.send({
            message: "userinfos was deleted successfully!"
          });
        } else {
          res.send({
            message: `Cannot delete userinfos with id=${id}. Maybe userinfos was not found!`
          });
        }
      })
      .catch(err => {
        res.status(500).send({
          message: "Could not delete userinfos  with id=" + id
        });
      });
  };
  
/**
 *
 * @param {*} req
 * @param {*} res
 */
const userdeleteAll = (req, res) => {
    UserInfo.destroy({
      where: {},
      truncate: false
    })
      .then(nums => {
        res.send({ message: `${nums} userinfos were deleted successfully!` });
      })
      .catch(err => {
        res.status(500).send({
          message:
            err.message || "Some error occurred while removing all userinfos."
        });
      });
  };
  
  
    
  
/**
 *
 * @param {*} req
 * @param {*} res
 */
const findAlluserIsOk = (req, res) => {
     
    UserInfo.findAll({ where: { userIsOk: true } })
      .then(data => {
        res.send(data);
      })
      .catch(err => {
        res.status(500).send({
          message:
            err.message || "Some error occurred while retrieving userinfos."
        });
      });
  };
  
 
  
  // 这个命名问题 tutorials
// 使用 ES6 的默认导出语法,直接导出包含所有函数的对象
 export default
  {
    findAlluserIsOk,
    userdeleteAll,
    userdeleteid,
    userupdate,
    userfindOne,
    userfindAll,
    usercreate
  };
  


/*
 * @creater: geovindu
 * @since: 2024-08-18 18:01:12
 * @LastAuthor: geovindu
 * @lastTime: 2024-08-18 18:01:55
 * @文件相对于项目的路径: \jsstudy\vuejs\npostgresql\routes\tutorial.routes.js
 * @message2: geovindu
 * @IDE: vscode
 * @Development: node.js 20, vuejs3.0
 * @package: npm install express sequelize pg pg-hstore cors --save
 * @database: mysql 8.0 sql server 2019 postgresSQL 16 
 * Copyright (c) 2024 by geovindu email:geovindu@163.com, All Rights Reserved.
 */

import express from "express"

import userinfos from "../controllers/userinfo.controller.js"

/**
 * 
 * @param {*} app 
 */
 const routes= app => {
    //const tutorials = require("../controllers/tutorial.controller.js");
      
    var router = express.Router();         
     //添加
    router.post("/user",userinfos.usercreate) 
     //查询所有
    router.get("/user", userinfos.userfindAll);
    //在线可用的
    router.get("/user/userIsOk", userinfos.findAlluserIsOk);   
    //查找某一条
    router.get("/user/:id", userinfos.userfindOne);    
     //更新
    router.put("/user/:id", userinfos.userupdate);
     //删除ID的一条
    router.put("/user/:id", userinfos.userdeleteid); 
   //删除所有
   router.put("/user", userinfos.userdeleteAll);
    

    app.use('/api',router);
  };
  
  export default routes;

运行:

javascript 复制代码
node --trace-deprecation server
相关推荐
胚芽鞘6814 小时前
关于java项目中maven的理解
java·数据库·maven
甜瓜看代码7 小时前
1.
react.js·node.js·angular.js
伍哥的传说7 小时前
React 实现五子棋人机对战小游戏
前端·javascript·react.js·前端框架·node.js·ecmascript·js
sun0077007 小时前
mysql索引底层原理
数据库·mysql
01传说8 小时前
vue3 配置安装 pnpm 报错 已解决
java·前端·vue.js·前端框架·npm·node.js
workflower10 小时前
MDSE和敏捷开发相互矛盾之处:方法论本质的冲突
数据库·软件工程·敏捷流程·极限编程
Tony小周10 小时前
实现一个点击输入框可以弹出的数字软键盘控件 qt 5.12
开发语言·数据库·qt
lifallen10 小时前
Paimon 原子提交实现
java·大数据·数据结构·数据库·后端·算法
TDengine (老段)11 小时前
TDengine 数据库建模最佳实践
大数据·数据库·物联网·时序数据库·tdengine·涛思数据
Elastic 中国社区官方博客11 小时前
Elasticsearch 字符串包含子字符串:高级查询技巧
大数据·数据库·elasticsearch·搜索引擎·全文检索·lucene