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


TypeScript bookshelf.default方法代碼示例

本文整理匯總了TypeScript中bookshelf.default方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript bookshelf.default方法的具體用法?TypeScript bookshelf.default怎麽用?TypeScript bookshelf.default使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bookshelf的用法示例。


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

示例1: require

import * as bookshelf from "bookshelf";
import * as knex from "knex";
import * as pg from "pg";

pg.defaults.ssl = true;

// Fix for parsing of numeric fields
pg.types.setTypeParser(1700, "text", parseFloat);

import knexfile = require("./knexfile");

const dbConfig = knexfile[process.env.NODE_ENV];

export = bookshelf(knex(dbConfig));
開發者ID:CMUBigLab,項目名稱:cmuNodeFbot,代碼行數:14,代碼來源:bookshelf.ts

示例2: constructor

    constructor(dataBaseInfo: IConnection) {
        // PostgreSQL, MySQL, and SQLite3.
        
        
        // XXX::: Dont know about port
        let knex = Knex({
            client: dataBaseInfo.driver,
            connection: {
                host: dataBaseInfo.host,
                user: dataBaseInfo.username,
                password: dataBaseInfo.password,
                database: dataBaseInfo.database,
                charset: 'utf8'
            }
        });

        knex['_config'] = dataBaseInfo;
        // XXX::: todo for mongo
        // XXX::: todo for elastic
        
        this._connection = Bookshelf(knex);
    }
開發者ID:yogendrap,項目名稱:PlZoo,代碼行數:22,代碼來源:Connection.ts

示例3: tableName

/// <reference path="bookshelf.d.ts" />
/// <reference path="../knex/knex.d.ts" />

import * as Knex from 'knex';
import * as Bookshelf from 'bookshelf';

var knex = Knex({
	client: 'sqlite3',
	connection: {
		filename: ':memory:',
	},
});

// Examples

var bookshelf = Bookshelf(knex);

class User extends bookshelf.Model<User> {
	get tableName() { return 'users'; }
	messages() : Bookshelf.Collection<Posts> {
		return this.hasMany(Posts);
	}
}

class Posts extends bookshelf.Model<Posts> {
	get tableName() { return 'messages'; }
	tags() : Bookshelf.Collection<Tag> {
		return this.belongsToMany(Tag);
	}
}
開發者ID:0815fox,項目名稱:DefinitelyTyped,代碼行數:30,代碼來源:bookshelf-tests.ts

示例4: knex

import * as knex from "knex";
import {database as knexConnection} from "../knex/knexfile"
import * as bookshelf from "bookshelf"

let dbConnection = knex(knexConnection);
let db = bookshelf(dbConnection);

db.plugin('registry');

export {db};
開發者ID:waffle-iron,項目名稱:CRM,代碼行數:10,代碼來源:db.ts

示例5: bookshelf

ďťżimport {knex} from "./knex";
import * as bookshelf from "bookshelf";
export var db = bookshelf(knex);
開發者ID:DominicBisset,項目名稱:BigLeagueServer,代碼行數:3,代碼來源:bookshelf.ts


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