Skip to content

Commit

Permalink
Switch to composition of modules than an inheritance structure
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmcgarvey committed Sep 14, 2020
1 parent a0ff6cd commit bfd71ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/avram/base_query_template.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Avram::BaseQueryTemplate
end

def_clone
include Avram::Queryable({{ type }})
include Avram::PrimaryKeyQueryable({{ type }})

def database : Avram::Database.class
Expand Down
4 changes: 1 addition & 3 deletions src/avram/primary_key_queryable.cr
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
require "./errors"
require "./queryable"

module Avram::PrimaryKeyQueryable(T)
abstract def id
abstract def id(id_val)
abstract def query

macro included
include Avram::Queryable(T)

def self.find(id)
new.find(id)
end
Expand Down

0 comments on commit bfd71ed

Please # to comment.