Created
July 27, 2020 19:55
-
-
Save brunto/c09772ae64a8aa9e30259f52f58217b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Daterange | |
def self.adapter | |
Lucky | |
end | |
module Lucky | |
alias ColumnType = UInt8 | |
include Avram::Type | |
def parse(value : UInt8) | |
SuccessfulCast(UInt8).new(value) | |
end | |
def parse(values : Array(UInt8)) | |
SuccessfulCast(Array(UInt8)).new values | |
end | |
def parse(value : String) | |
SuccessfulCast(UInt8).new(UInt8.new(value)) | |
end | |
def parse(values : Array(String)) | |
SuccessfulCast(Array(UInt8)).new values | |
end | |
def to_db(value : UInt8) | |
value.to_s | |
end | |
class Criteria(T, V) < Avram::Criteria(T, V) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead of
SuccessfulCast(UInt8).new(UInt8.new(value))
I could also write the line like this
SuccessfulCast(UInt8).new value.to_u8