简体   繁体   English

如何使用 Vapor 3 在 PostgreSQL 中存储 Swift 类型(日期、字典等)?

[英]How to store Swift types (Date, Dictionary and others) in PostgreSQL with Vapor 3?

I am using Vapor 3, Swift 5.1, PostgreSQL 12 and Postico 1.5.10 for my Backend.我的后端使用 Vapor 3、Swift 5.1、PostgreSQL 12 和 Postico 1.5.10。 Question is: how to store Date (I mean Swift Date()) and Dictionary (example, [String : Int])?问题是:如何存储日期(我的意思是 Swift Date())和字典(例如,[String : Int])?

To work with PostgeSQL, I am using Postico (I am quite newbie in PostgreSQL, that's why), please look at screenshot:为了使用 PostgeSQL,我正在使用 Postico(我是 PostgreSQL 的新手,这就是为什么),请看截图: 在此处输入图片说明

And, I just have seen how to store Arrays, but where I can find other types to store?而且,我刚刚看到了如何存储数组,但是在哪里可以找到其他类型的存储? For example, Enum?例如,枚举?

I will be thankful for any help or advice!我将不胜感激任何帮助或建议!

  • for date timestamp without time zone对于timestamp without time zone日期timestamp without time zone
  • for [String: Any] should be jsonb [String: Any]应该是jsonb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM