我是生锈和柴油奥姆的新手。我正在尝试在我的查询中执行以下操作:
但我收到错误。
我正在使用 postgres 数据库。
我已在评论中的查询上方添加了确切的错误。
这是我的代码:
模式.rs
table! {
employee (employee_id) {
employee_id -> Int4,
name -> Nullable<Text>,
age -> Nullable<Int4>,
address -> Nullable<Text>,
email -> Nullable<Text>,
dept_id -> Int4,
salary -> Nullable<Numeric>,
created_on -> Nullable<Timestamp>,
created_by -> Nullable<Text>,
modified_on -> Nullable<Timestamp>,
modified_by -> Nullable<Text>,
is_active -> Nullable<Bool>,
}
}
Run Code Online (Sandbox Code Playgroud)
模型.rs
#![allow(unused)]
#![allow(clippy::all)]
use super::schema::employee;
use bigdecimal::BigDecimal;
use chrono::NaiveDateTime;
#[derive(Queryable, Debug, Identifiable)]
#[table_name = "employee"]
#[primary_key(employee_id)]
pub struct Employee {
pub employee_id: i32,
pub name: …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的演示应用程序之一(使用 .net 6)中使用 serilog 来实现日志记录。我正在登录到 sql 数据库。我在 appSettings.json 中将“autoCreateSqlTable”保留为“true”,但 serilog 没有在 sql 中创建表。
应用程序设置.json
{
"ConnectionStrings": {
"DefaultConnection": "Server=Test;Database=TestDb;Trusted_Connection=True;MultipleActiveResultSets=true;"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Warning",
"System": "Warning",
"System.Net.Http.HttpClient": "Warning"
}
}
},
"Using": [ "Serilog.Enrichers.ClientInfo" ],
"Enrich": [ "FromLogContext", "WithMachineName", "WithClientIp", "WithClientAgent" ],
"WriteTo": [
{
"Name": "MSSqlServer",
"Args": {
"connectionString": "Server=Test;Database=TestDb;Trusted_Connection=True;MultipleActiveResultSets=true;",
"sinkOptionsSection": {
"tableName": "LogsTable",
"autoCreateSqlTable": true
},
"restrictedToMinimumLevel": "Information", …Run Code Online (Sandbox Code Playgroud) .net-6.0 ×1
.net-core ×1
c# ×1
rust ×1
rust-cargo ×1
rust-crates ×1
rust-diesel ×1
serilog ×1
sql-server ×1