小编Gle*_*ngh的帖子

Rust 柴油 orm 查询

我是生锈和柴油奥姆的新手。我正在尝试在我的查询中执行以下操作:

  • 数数
  • 选择
  • 命令
  • 限制

但我收到错误。
我正在使用 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)

rust rust-crates rust-cargo rust-diesel

7
推荐指数
1
解决办法
6282
查看次数

.NET 6 Serilog 不创建日志表

我正在尝试在我的演示应用程序之一(使用 .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)

c# sql-server serilog .net-core .net-6.0

5
推荐指数
1
解决办法
4355
查看次数