Skip to content

add Enum demo  #3

Open
Open
@iOSleep

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"
    }
    
}

🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions