Class: ClickHouse::Models::AuditEvent

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/click_house/models/audit_event.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#group, #initialize, #limit, #offset, #order, #select, #where

Constructor Details

This class inherits a constructor from ClickHouse::Models::BaseModel

Class Method Details

.by_author_id(author_id) ⇒ Object



38
39
40
# File 'lib/click_house/models/audit_event.rb', line 38

def self.by_author_id(author_id)
  new.by_author_id(author_id)
end

.by_author_username(username) ⇒ Object



46
47
48
# File 'lib/click_house/models/audit_event.rb', line 46

def self.by_author_username(username)
  new.by_author_username(username)
end

.by_entity_id(entity_id) ⇒ Object



34
35
36
# File 'lib/click_house/models/audit_event.rb', line 34

def self.by_entity_id(entity_id)
  new.by_entity_id(entity_id)
end

.by_entity_type(entity_type) ⇒ Object



30
31
32
# File 'lib/click_house/models/audit_event.rb', line 30

def self.by_entity_type(entity_type)
  new.by_entity_type(entity_type)
end

.by_entity_username(username) ⇒ Object



42
43
44
# File 'lib/click_house/models/audit_event.rb', line 42

def self.by_entity_username(username)
  new.by_entity_username(username)
end

.find_user_id(username) ⇒ Object



50
51
52
# File 'lib/click_house/models/audit_event.rb', line 50

def self.find_user_id(username)
  ::User.find_by_username(username)&.id
end

.table_nameObject



6
7
8
# File 'lib/click_house/models/audit_event.rb', line 6

def self.table_name
  'audit_events'
end

Instance Method Details

#by_author_id(author_id) ⇒ Object



18
19
20
# File 'lib/click_house/models/audit_event.rb', line 18

def by_author_id(author_id)
  where(author_id: author_id)
end

#by_author_username(username) ⇒ Object



26
27
28
# File 'lib/click_house/models/audit_event.rb', line 26

def by_author_username(username)
  where(author_id: self.class.find_user_id(username))
end

#by_entity_id(entity_id) ⇒ Object



14
15
16
# File 'lib/click_house/models/audit_event.rb', line 14

def by_entity_id(entity_id)
  where(entity_id: entity_id)
end

#by_entity_type(entity_type) ⇒ Object



10
11
12
# File 'lib/click_house/models/audit_event.rb', line 10

def by_entity_type(entity_type)
  where(entity_type: entity_type)
end

#by_entity_username(username) ⇒ Object



22
23
24
# File 'lib/click_house/models/audit_event.rb', line 22

def by_entity_username(username)
  where(entity_id: self.class.find_user_id(username))
end