如何解决为什么我会收到“在编译 FIRST 时检测到未定义的绑定”?
我有一个有 3 条路线的应用:注册、登录和仪表板;仪表板是受保护的路线。
在我的仪表板路由中,我正在创建一个将检索用户信息的发布请求。
在我的服务文件中:
//Return a user by ID
const getUserById = (id) =>
knex('users').select('user_name').where({ user_id: id }).first();
在我的控制器文件中:
async function create(req,res,next) {
try {
const user = await service.getUserById(req.user);
res.json(user);
} catch (err) {
console.error(err.message);
}
}
我收到此错误:
Undefined binding(s) detected when compiling FirsT. Undefined column(s): [user_id] query: select "user_name" from "users" where "user_id" = ? limit ?
我的表 users
有 4 列:user_id、user_name、user_email 和 user_password。
解决方法
从代码来看,using System;
namespace RayTracerChallange
{
public class Toople
{
public float x,y,z,w;
public Toople(float X,float Y,float Z,float W)
{
x = X;
y = Y;
z = Z;
w = W;
}
public Toople Add(Toople Toop)
{
return new Toople(this.x + Toop.x,this.y + Toop.y,this.z + Toop.z,this.w + Toop.w);
}
public class Point : Toople
{
Point(float X,float Z) : base(X,Y,Z,1)
{
this.x = X;
this.y = Y;
this.z = Z;
}
}
public class Vector : Toople
{
Vector(float X,0)
{
this.x = X;
this.y = Y;
this.z = Z;
}
}
必须是未定义的。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。