aboutsummaryrefslogtreecommitdiff
path: root/src/guff/models/role.cr
blob: 9faf6b2151e3d28fb9ba53d963ae4c0ead18a9f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class Guff::RoleModel < Guff::Model
  SQL = TemplateCache.new({
    get_roles: "
      SELECT role_id,
             role_name,
             role_desc

        FROM roles

       -- FIXME
       ORDER BY role_id
    ",
  })

  def initialize(models : Models)
    super(models, SQL)
  end

  def get_roles
    r = [] of Hash(String, SQLite3::Value)

    all(:get_roles, nil, nil) do |row|
      r << row
    end

    r
  end
end