class

Specimen::BaseQuery

Inherits Avram::PrimaryKeyQueryable < Avram::Queryable < Enumerable < Reference < Object

所属する採集行

Constructors

all

Class methods

any?

Returns true if at least one of the collection's members is truthy.

[nil, true, 99].any? # => true
[nil, false].any?    # => false
([] of Int32).any?   # => false
  • #present? does not consider truthiness of elements.
  • #any?(&) and #any(pattern) allow custom conditions.

NOTE: #any? usually has the same semantics as #present?. They only differ if the element type can be falsey (i.e. T <= Nil || T <= Pointer || T <= Bool). It's typically advised to prefer #present? unless these specific truthiness semantics are required.

find(id) : T
first

Returns the first element in the collection. Raises Enumerable::EmptyError if the collection is empty.

([1, 2, 3]).first   # => 1
([] of Int32).first # raises Enumerable::EmptyError
first?

Returns the first element in the collection. When the collection is empty, returns nil.

([1, 2, 3]).first?   # => 1
([] of Int32).first? # => nil
last
last?
new_with_existing_query(query : Avram::QueryBuilder)
none?

Returns true if all of the elements of the collection are falsey.

[nil, false].none?       # => true
[nil, false, true].none? # => false

It's the opposite of all?.

preload_collect_point_info(record : Specimen, force : Bool = false) : Specimen
preload_collect_point_info(record : Specimen, force : Bool = false, &) : Specimen
preload_collect_point_info(record : Specimen, preload_query : CollectPoint::BaseQuery, force : Bool = false) : Specimen
preload_collect_point_info(records : Enumerable(Specimen), force : Bool = false) : Array(Specimen)
preload_collect_point_info(records : Enumerable(Specimen), force : Bool = false, &) : Array(Specimen)
preload_collect_point_info(records : Enumerable(Specimen), preload_query : CollectPoint::BaseQuery, force : Bool = false) : Array(Specimen)
preload_collection_settings_info(record : Specimen, force : Bool = false) : Specimen
preload_collection_settings_info(record : Specimen, force : Bool = false, &) : Specimen
preload_collection_settings_info(record : Specimen, preload_query : CollectionSetting::BaseQuery, force : Bool = false) : Specimen
preload_collection_settings_info(records : Enumerable(Specimen), force : Bool = false) : Array(Specimen)
preload_collection_settings_info(records : Enumerable(Specimen), force : Bool = false, &) : Array(Specimen)
preload_collection_settings_info(records : Enumerable(Specimen), preload_query : CollectionSetting::BaseQuery, force : Bool = false) : Array(Specimen)
preload_custom_taxon_info(record : Specimen, force : Bool = false) : Specimen
preload_custom_taxon_info(record : Specimen, force : Bool = false, &) : Specimen
preload_custom_taxon_info(record : Specimen, preload_query : Taxon::BaseQuery, force : Bool = false) : Specimen
preload_custom_taxon_info(records : Enumerable(Specimen), force : Bool = false) : Array(Specimen)
preload_custom_taxon_info(records : Enumerable(Specimen), force : Bool = false, &) : Array(Specimen)
preload_custom_taxon_info(records : Enumerable(Specimen), preload_query : Taxon::BaseQuery, force : Bool = false) : Array(Specimen)
preload_default_taxon_info(record : Specimen, force : Bool = false) : Specimen
preload_default_taxon_info(record : Specimen, force : Bool = false, &) : Specimen
preload_default_taxon_info(record : Specimen, preload_query : Taxon::BaseQuery, force : Bool = false) : Specimen
preload_default_taxon_info(records : Enumerable(Specimen), force : Bool = false) : Array(Specimen)
preload_default_taxon_info(records : Enumerable(Specimen), force : Bool = false, &) : Array(Specimen)
preload_default_taxon_info(records : Enumerable(Specimen), preload_query : Taxon::BaseQuery, force : Bool = false) : Array(Specimen)
preload_tour(record : Specimen, force : Bool = false) : Specimen
preload_tour(record : Specimen, force : Bool = false, &) : Specimen
preload_tour(record : Specimen, preload_query : Tour::BaseQuery, force : Bool = false) : Specimen
preload_tour(records : Enumerable(Specimen), force : Bool = false) : Array(Specimen)
preload_tour(records : Enumerable(Specimen), force : Bool = false, &) : Array(Specimen)
preload_tour(records : Enumerable(Specimen), preload_query : Tour::BaseQuery, force : Bool = false) : Array(Specimen)
truncate(*, cascade : Bool = false, restart_identity : Bool = false)

Removes all data from a table using the TRUNCATE postgres SQL command.

You should run this command with cascade: true if your table columns are referenced by other foreign key constraints. Use delete instead if you don't want to accidentally delete rows referenced elsewhere.

To delete all data referenced by foreign keys as well, set cascade to true.

Instance methods

allow_kojin_shuzo(value)
allow_kojin_shuzo
clone

Returns a copy of self with all instance variables cloned.

collect_point_info_id(value)
collect_point_info_id
collecter(value)
collecter
collection_code(value)
collection_code
collection_settings_info_id(value)
collection_settings_info_id
custom_taxon_info_id(value)
custom_taxon_info_id
date_identified(value)
date_identified
date_last_modified(value)
date_last_modified
day(value)
day
default_taxon_info_id(value)
default_taxon_info_id
disposition(value)
disposition
establishment_means(value)
establishment_means
find(id) : T
full_join_collect_point_info
full_join_collection_settings_info
full_join_custom_taxon_info
full_join_default_taxon_info
full_join_tour
id(value)
id
identified_by(value)
identified_by
image1(value)
image1
image2(value)
image2
image3(value)
image3
image4(value)
image4
image5(value)
image5
inner_join_collect_point_info
inner_join_collection_settings_info
inner_join_custom_taxon_info
inner_join_default_taxon_info
inner_join_tour
join_collect_point_info
join_collection_settings_info
join_custom_taxon_info
join_default_taxon_info
join_tour
left_join_collect_point_info
left_join_collection_settings_info
left_join_custom_taxon_info
left_join_default_taxon_info
left_join_tour
lifestage(value)
lifestage
month(value)
month
note(value)
note
preload_collect_point_info(preload_query : CollectPoint::BaseQuery) : self
preload_collect_point_info
preload_collect_point_info
preload_collection_settings_info(preload_query : CollectionSetting::BaseQuery) : self
preload_collection_settings_info
preload_collection_settings_info
preload_custom_taxon_info(preload_query : Taxon::BaseQuery) : self
preload_custom_taxon_info
preload_custom_taxon_info
preload_default_taxon_info(preload_query : Taxon::BaseQuery) : self
preload_default_taxon_info
preload_default_taxon_info
preload_tour(preload_query : Tour::BaseQuery) : self
preload_tour
preload_tour
preparation_type(value)
preparation_type
published_kojin_shuzo(value)
published_kojin_shuzo
right_join_collect_point_info
right_join_collection_settings_info
right_join_custom_taxon_info
right_join_default_taxon_info
right_join_tour
rights(value)
rights
sampling_effort(value)
sampling_effort
sampling_protocol(value)
sampling_protocol
sex(value)
sex
tour_id(value)
tour_id
update(id : UUID | Avram::Nothing = IGNORE, date_last_modified : Time | Avram::Nothing = IGNORE, user_id : Int32 | Avram::Nothing | Nil = IGNORE, collection_code : Int32 | Avram::Nothing = IGNORE, identified_by : String | Avram::Nothing = IGNORE, date_identified : Time | Avram::Nothing = IGNORE, collecter : String | Avram::Nothing = IGNORE, year : Int32 | Avram::Nothing = IGNORE, month : Int32 | Avram::Nothing = IGNORE, day : Int32 | Avram::Nothing = IGNORE, sex : String | Avram::Nothing = IGNORE, preparation_type : String | Avram::Nothing = IGNORE, disposition : String | Avram::Nothing = IGNORE, sampling_protocol : String | Avram::Nothing = IGNORE, sampling_effort : String | Avram::Nothing = IGNORE, lifestage : String | Avram::Nothing = IGNORE, establishment_means : String | Avram::Nothing = IGNORE, rights : String | Avram::Nothing = IGNORE, custom_taxon_info_id : Taxon::PrimaryKeyType | Avram::Nothing | Nil = IGNORE, default_taxon_info_id : Taxon::PrimaryKeyType | Avram::Nothing | Nil = IGNORE, collect_point_info_id : CollectPoint::PrimaryKeyType | Avram::Nothing | Nil = IGNORE, collection_settings_info_id : CollectionSetting::PrimaryKeyType | Avram::Nothing | Nil = IGNORE, tour_id : Tour::PrimaryKeyType | Avram::Nothing | Nil = IGNORE, note : String | Avram::Nothing = IGNORE, allow_kojin_shuzo : Bool | Avram::Nothing = IGNORE, published_kojin_shuzo : Bool | Avram::Nothing = IGNORE, image1 : String | Avram::Nothing | Nil = IGNORE, image2 : String | Avram::Nothing | Nil = IGNORE, image3 : String | Avram::Nothing | Nil = IGNORE, image4 : String | Avram::Nothing | Nil = IGNORE, image5 : String | Avram::Nothing | Nil = IGNORE) : Int64

Update the records using the query's where clauses, or all records if no wheres are added.

Returns the number of records updated as Int64.

# Update all comments with the word "spam" as spam
CommentQuery.new.body.ilike("spam").update(spam: true)
user_id(value)
user_id
where_collect_point_info(assoc_query : CollectPoint::BaseQuery, auto_inner_join : Bool = true)
where_collection_settings_info(assoc_query : CollectionSetting::BaseQuery, auto_inner_join : Bool = true)
where_custom_taxon_info(assoc_query : Taxon::BaseQuery, auto_inner_join : Bool = true)
where_default_taxon_info(assoc_query : Taxon::BaseQuery, auto_inner_join : Bool = true)
where_tour(assoc_query : Tour::BaseQuery, auto_inner_join : Bool = true)
year(value)
year

Macros

generate_criteria_method(name, type)