Databases with SearchLight.jl

SearchLight.jl is the complete ORM solution in Genie Framework, supporting Postgres, MySQL and SQLite (ODBC and JDBC support coming soon). SearchLight offers a complete range of features, that go beyond query generation, including database schema versioning through migrations, model validators, data serializers, model relationships, transactions support and much more. SearchLight greatly simplifies the task of working with databases through its portable, concise and readable Julia API.

Base.@kwdef mutable struct User <: AbstractModel
    id::DbId = DbId()
    username::String = ""
    password::String = ""
end

Validation.validator(::Type{User}) = ModelValidator([
    ValidationRule(:username, UsersValidator.not_empty),
    ValidationRule(:username, UsersValidator.unique),
    ValidationRule(:password, UsersValidator.not_empty)
])

function register()
    User(username  = params(:username),
         password  = params(:password) |> hash_password,
         name      = params(:name),
         email     = params(:email)
    ) |> save!
end

Genie