Vapor MySQL - not showing as an Import value

心不动则不痛 提交于 2019-12-12 17:53:17

问题


This question is about the Swift Web Framework, Vapor.

I am trying to import VaporMySQL framework using Swift's Package Manager.

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].

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)

回答1:


The VaporMySQL package comes from the qutheory/vapor-mysql repository.

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)
    ]
)

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.



来源:https://stackoverflow.com/questions/38544089/vapor-mysql-not-showing-as-an-import-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!