问题描述
这个问题是关于 Swift Web 框架 Vapor 的.
This question is about the Swift Web Framework, Vapor.
我正在尝试使用 Swift 的包管理器导入 VaporMySQL 框架.
I am trying to import VaporMySQL framework using Swift's Package Manager.
我已经在本地运行了数据库,mySQL 端口是开放的&正在工作,mySQL 数据库正在工作,Vapor 应用程序正在工作 [我已经编写了几个有效的 GET/POST 请求].
I already have the database running locally, the mySQL port is open & working, the mySQL database is working, the Vapor app is working [I have written several GET / POST requests that work].
但我无法导入 VaporMySQL.这可能与我对 Package.swift 缺乏了解有关.
But I can't Import VaporMySQL. This may be related to my lack of knowledge with Package.swift.
let package = Package(
name: "HelloWorld",
dependencies: [
.Package(url: "https://github.com/qutheory/vapor.git", majorVersion: 0, minor: 10),
.Package(url: "https://github.com/qutheory/cmysql.git", majorVersion: 0, minor: 2)
推荐答案
VaporMySQL
包来自 qutheory/vapor-mysql
存储库.
您似乎错误地将 libmysql
包装器包含在您的项目中,该包装器仅为 MySQL 的 C 库提供了一个模块映射.
It looks like you've mistakenly included the libmysql
wrapper into your project which just provides a module map for MySQL's C library.
let package = Package(
name: "HelloWorld",
dependencies: [
.Package(url: "https://github.com/qutheory/vapor.git", majorVersion: x, minor: x),
.Package(url: "https://github.com/qutheory/vapor-mysql.git", majorVersion: x, minor: x)
]
)
您的 Package.swift
文件应如上所示.主要和次要版本号需要根据您要使用的 Swift 和 Vapor 版本来确定.
Your Package.swift
file should look like the above. The major and minor version numbers will need to be determined based on which version of Swift and Vapor you want to use.
这篇关于Vapor MySQL - 未显示为导入值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!