當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Sequelize.authenticate函數代碼示例

本文整理匯總了TypeScript中Sequelize.authenticate函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript authenticate函數的具體用法?TypeScript authenticate怎麽用?TypeScript authenticate使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了authenticate函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

        this.app.listen(3000, function(){
            console.log("Demo Express server listening on port %d in %s mode", 3000);
            var config = require('../../config/'+ process.env.NODE_ENV+'.json');
            var seq=new Sequelize(config.db, config.username, config.password,config.options);
            var compteService:CompteService = new CompteService(seq);

            var initCompte=new Compte();
            initCompte.numero="numero de compte";
            initCompte.pointable=true;
            initCompte.lettrable=true;

            var onCompteGet=function (newCompte:Compte) {
                console.log("compte getted ", newCompte.numero);
            };

            var onCompteCreated=function (newCompte:Compte) {
                console.log("compte created", newCompte.numero);
                compteService.getCompteByNumero(newCompte.numero).then(onCompteGet)
            };
            var onTableCreated = function () {
                compteService.addCompte(initCompte).then(onCompteCreated,onFail);
            };

            var onConnexion = function () {
                console.log("connection ok");
                compteService.build().then(onTableCreated,onFail);
            };
            var onFail = function () {
                console.log("connection ko");
            };
            seq.authenticate().then(onConnexion,onFail);

        });
開發者ID:christopheGaon,項目名稱:test1,代碼行數:33,代碼來源:server.ts

示例2: setTimeout

const connectWithRetry = () => {
  return sequelize.authenticate()
    .then(() => {
      logger.info('Connection has been established successfully.');
    })
    .catch((err) => {
      logger.info('Failed to connect to database on startup - retrying in 5 sec', (err));
      setTimeout(connectWithRetry, 5000);
    });
};
開發者ID:endlessdev,項目名稱:PortalRank,代碼行數:10,代碼來源:index.ts

示例3: continueAfterAuthentication

            type: Sequelize.INTEGER,
            primaryKey: true,
            autoIncrement: true
        },
        userId: {
            type: Sequelize.INTEGER,
            references: User,
            referencesKey: "userId"
        },
        taskName: Sequelize.STRING
    },
    {
        timestamps: false
    });

sequelize
    .authenticate()
    .complete(function(err)
    {
        if (err)
        {
            console.log("Error authenticating with database: " + err);
        }
        else
        {
            console.log("Connection established.");
            continueAfterAuthentication();
        }
    });

function continueAfterAuthentication()
{
開發者ID:samuelneff,項目名稱:sequelize-learning,代碼行數:32,代碼來源:app.ts

示例4: Compte



var initCompte=new Compte();
initCompte.numero="numero de compte";
initCompte.pointable=true;
initCompte.lettrable=true;

var onCompteGet=function (newCompte:Compte) {
    console.log("compte getted ", newCompte.numero);
};

var onCompteCreated=function (newCompte:Compte) {
    console.log("compte created", newCompte.numero);
    compteService.getCompteByNumero(newCompte.numero).then(onCompteGet)
};
var onTableCreated = function () {
    compteService.addCompte(initCompte).then(onCompteCreated,onFail);
};

var onConnexion = function () {
    console.log("connection ok");
    compteService.build().then(onTableCreated,onFail);
};
var onFail = function () {
    console.log("connection ko");
};
seq.authenticate().then(onConnexion,onFail);



開發者ID:christopheGaon,項目名稱:test1,代碼行數:25,代碼來源:test.ts


注:本文中的Sequelize.authenticate函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。