Skip to content

add Enum demo  #3

Description

@iOSleep
enum CompassPoint: Int {
    case none
    case north
    case south
    case east
    case west
}

extension CompassPoint : Bindable, ConstructableFromSQLiteValue {
    init(sqliteValue: SQLiteORM.SQLiteValue) {
        self = CompassPoint(rawValue: sqliteValue.integer) ?? .none
    }
    
    func bind(to binder: Binder) -> Int32 {
        return binder.bindInt(value: self.rawValue)
    }
    
    public static func sqliteTypeName() -> String {
        return "INTEGER"
    }
    
}

🤔

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions