bookshelf.js

    1熱度

    1回答

    我想從我的m-n關係型mySql表中使用Bookshelf.js獲取屬性。 我有一個表的用戶:ID,名稱 和比賽:ID,將 和數據透視表:USER_ID,tournament_id,teamname 這些是我的模型: var User = Bookshelf.Model.extend({ tableName: 'users', tournaments: function() {

    0熱度

    1回答

    我想在單個交易中包裝多個函數。雖然它沒有拋出任何錯誤,但交易沒有被提交。 下面是樣本片段。 function doSomething(ids){ bookshelf.transaction(function(trx){ if(someCondition){ new Service().save({ 'name': service.name },{transact

    0熱度

    1回答

    我正在爲社交網站創建個人資料系統。我無法使用關係來顯示來自不同表格的用戶的各種信息。這裏是我的兩個BookshelfJS型號: 房: var user = require(__base + '/app/database/models/user/user').model; exports.model = Application.Adapter.Model.extend({ tableN

    0熱度

    1回答

    我閱讀了與through相關的書架文檔,但是我找不到應該如何繼續。我有三個以與Bookshelf不同的約定命名的表。基本上,一個集團有許多用戶通過配置文件。最後一個建立連接。 Table Name: User - id_user - username - password Table Name: Profile - id_user - id_g

    1熱度

    1回答

    我有一個簡單的auth面板與書架和護照,但是當我嘗試登錄時,我得到白色空白頁500.我嘗試所有解決方案,我在網上找到。請幫忙。 配置/ passport.js ... passport.use('local-login', new LocalStrategy({ passReqToCallback : true }, function(req, us

    2熱度

    1回答

    在將Bookshelf和Knex集成到我的堆棧時遇到了一些麻煩。當試圖執行數據庫讀/寫,我得到一個TypeError:knex不是一個函數。 我bookshelf.js: 'use strict' var knex = require('knex')(require('./knexfile')).debug(true); var bookshelf = require('bookshelf')

    0熱度

    1回答

    我很難理解這是如何工作的。我瞭解如何檢查和匹配用戶純文本密碼。但是,使用bcrypt加密,我需要進行數據庫調用來檢查密碼實際上是否已加密? 這裏是我的工作代碼: describe('create (POST /users)', function() { it('succeeds, with encrypted password', function (done) { chai

    0熱度

    1回答

    我使用的Bookshelf.js ORM,我需要能夠按日期和有一些問題進行查詢。 這裏是我使用的一個樣本代碼片段。 this.model.query((q) => { q.where('created_at', '>=', Date.now()); q.orderBy('created_at', 'DESC'); }) .fetch().the

    0熱度

    1回答

    我想用knex.js bookshelf.knex('user').distinct('social_name') .select('social_image_url') .count('status as score').innerJoin('game', function(){ this.on('game.user_id', 'user.id');

    5熱度

    1回答

    我正在爲我的項目使用NodeJS,Express和MySQL,並且希望使用Bookshelf ORM。 Bookshelf使用Knex進行查詢,建模並建議通過Knex設置數據庫連接(http://bookshelfjs.org/#installation)。 我無法與Knex建立成功的數據庫連接。我只想在數據庫連接成功時啓動服務器,但似乎在建立連接後沒有提供任何內容(沒有承諾或屬性)。 這是我一直