Giter Site home page Giter Site logo

mysql-storm's Introduction

MySQL-StORM

MySQL-StORM is the MySQL module for StORM - a Swift ORM.

It aims to be easy to use, but flexible. Drawing on previous experiences, whether they be good, bad or ugly, of other ORM's, I have tried to build a system that allows you write great code without worrying about the details of how to interact with the database.

Other database wrappers will be available shortly. They will all use the StORM base, and provide as much consistency between datasources as possible.

StORM is built on top of Perfect - the most mature of the Server Side Swift platforms.

What does it do?

  • Abstracts the database layer from your code.
  • Provides a way of adding save, delete, find to your Swift classes
  • Gives you access to more powerful select, insert, update, delete, and raw SQL querying.
  • Maps result sets to your classes

What does it not do?

Right now there are a few things missing, but the basics are there.

On the "TODO" list are:

  • complete joins
  • complete having
  • complete group by
  • upsert
  • documentation
  • complete test coverage

mysql-storm's People

Contributors

iamjono avatar leeceny avatar nawar avatar nmdias avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mysql-storm's Issues

Datetime or Date field

I have multiple Datetime and Date field in my table and I don't know how to declare property in my Class definition.

Support for Date

Hello, how can I use a class with a Date type? If it's not possible, have you planned to add it ? It's one of the most useful types.
Thanks

Something error about syntax

.package(url:"https://github.com/SwiftORM/MySQL-StORM", from: "3.3.0"),

(base) wy:PerfectTemplate wy$ swift build
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQLStmt.swift:503:43: error: use of undeclared type 'my_bool'
let isNullBuffers: UnsafeMutablePointer<my_bool>
^~~~~~~
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQLStmt.swift:214:7: error: binary operator '==' cannot be applied to operands of type 'Int' and 'Bool'
0 == mysql_stmt_bind_param(ptr, paramBinds) else {
~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQLStmt.swift:214:7: note: overloads for '==' exist with these partially matching parameter lists: (Bool, Bool), (Int, Int)
0 == mysql_stmt_bind_param(ptr, paramBinds) else {
^
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQLStmt.swift:357:22: error: cannot assign value of type 'Int' to type 'Bool'
bind.is_unsigned = 1
^
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQLStmt.swift:511:41: error: use of undeclared type 'my_bool'
isNullBuffers = UnsafeMutablePointer<my_bool>.allocate(capacity: numFields)
^~~~~~~
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQLStmt.swift:637:31: error: binary operator '==' cannot be applied to operands of type 'Bool' and 'Int'
guard bind.is_null.pointee == 0 else {
~~~~~~~~~~~~~~~~~~~~ ^ ~
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQLStmt.swift:637:31: note: overloads for '==' exist with these partially matching parameter lists: (Bool, Bool), (Int, Int)
guard bind.is_null.pointee == 0 else {
^
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQLStmt.swift:652:25: error: binary operator '==' cannot be applied to operands of type 'Bool' and 'Int'
if bind.is_unsigned == 1 {
~~~~~~~~~~~~~~~~ ^ ~
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQLStmt.swift:652:25: note: overloads for '==' exist with these partially matching parameter lists: (Bool, Bool), (Int, Int)
if bind.is_unsigned == 1 {
^
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQLStmt.swift:770:18: error: cannot invoke 'initialize' with an argument list of type '(to: Int)'
bind.is_null.initialize(to: 0)
^
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQLStmt.swift:784:26: error: cannot assign value of type 'Int' to type 'Bool'
bind.is_unsigned = 1
^
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQed to operands of type 'Bool' and 'Int'
if bind.is_unsigned == 1 {
~~~~~~~~~~~~~~~~ ^ ~
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQLStmt.swift:832:26: note: overloads for '==' exist with these partially matching parameter lists: (Bool, Bool), (Int, Int)
if bind.is_unsigned == 1 {
^
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQLStmt.swift:503:43: error: use of undeclared type 'my_bool'
let isNullBuffers: UnsafeMutablePointer<my_bool>
^~~~~~~
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQL.swift:103:12: error: binary operator '==' cannot be applied to operands of type 'Int' and 'Bool'
return 1 == mysql_commit(mysqlPtr)
~ ^ ~~~~~~~~~~~~~~~~~~~~~~
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQL.swift:103:12: note: overloads for '==' exist with these partially matching parameter lists: (Bool, Bool), (Int, Int)
return 1 == mysql_commit(mysqlPtr)
^
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQL.swift:108:12: error: binary operator '==' cannot be applied to operands of type 'Int' and 'Bool'
return 1 == mysql_rollback(mysqlPtr)
~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQL.swift:108:12: note: overloads for '==' exist with these partially matching parameter lists: (Bool, Bool), (Int, Int)
return 1 == mysql_rollback(mysqlPtr)
^
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQL.swift:113:12: error: binary operator '==' cannot be applied to operands of type 'Int' and 'Bool'
return 1 == mysql_more_results(mysqlPtr)
~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQL.swift:113:12: note: overloads for '==' exist with these partially matching parameter lists: (Bool, Bool), (Int, Int)
return 1 == mysql_more_results(mysqlPtr)
^
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQL.swift:173:11: error: use of unresolved identifier 'MYSQL_OPT_USE_REMOTE_CONNECTION'
return MYSQL_OPT_USE_REMOTE_CONNECTION
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQL.swift:175:11: error: use of unresolved identifier 'MYSQL_OPT_USE_EMBEDDED_CONNECTION'
return MYSQL_OPT_USE_EMBEDDED_CONNECTION
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQL.swift:177:11: error: use of unresolved identifier 'MYSQL_OPT_GUESS_CONNECTION'
return MYSQL_OPT_GUESS_CONNECTION
^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQL.swift:179:11: error: use of unresolved identifier 'MYSQL_SET_CLIENT_IP'; did you mean 'MYSQL_SET_CHARSET_DIR'?
return MYSQL_SET_CLIENT_IP
^~~~~~~~~~~~~~~~~~~
MYSQL_SET_CHARSET_DIR
mysqlclient.MYSQL_SET_CHARSET_DIR:1:12: note: 'MYSQL_SET_CHARSET_DIR' declared here
public var MYSQL_SET_CHARSET_DIR: mysql_option { get }
^
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQL.swift:181:11: error: use of unresolved identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'?
return MYSQL_SECURE_AUTH
^~~~~~~~~~~~~~~~~
MYSQL_DEFAULT_AUTH
AUTH:1:12: note: 'MYSQL_DEFAULT_AUTH' declared here
public var MYSQL_DEFAULT_AUTH: mysql_option { get }
^
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQL.swift:187:11: error: use of unresolved identifier 'MYSQL_OPT_SSL_VERIFY_SERVER_CERT'; did you mean 'CLIENT_SSL_VERIFY_SERVER_CERT'?
return MYSQL_OPT_SSL_VERIFY_SERVER_CERT
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CLIENT_SSL_VERIFY_SERVER_CERT
mysqlclient.CLIENT_SSL_VERIFY_SERVER_CERT:1:12: note: 'CLIENT_SSL_VERIFY_SERVER_CERT' declared here
public var CLIENT_SSL_VERIFY_SERVER_CERT: UInt { get }
^
/Users/wy/Personal/project/PerfectTemplate/.build/checkouts/Perfect-MySQL/Sources/PerfectMySQL/MySQL.swift:241:13: error: use of unresolved identifier 'my_bool'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.