简体   繁体   中英

Vapor MySQL - not showing as an Import value

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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