Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
4f993520
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4f993520
编写于
5月 26, 2017
作者:
R
Rafael França
提交者:
GitHub
5月 26, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #29240 from tjschuck/ar_batches_doc_updates
Doc updates for ActiveRecord::Batches
上级
de3b130c
1fb48e4d
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
12 addition
and
12 deletion
+12
-12
activerecord/lib/active_record/relation/batches.rb
activerecord/lib/active_record/relation/batches.rb
+12
-12
未找到文件。
activerecord/lib/active_record/relation/batches.rb
浏览文件 @
4f993520
...
@@ -30,14 +30,14 @@ module Batches
...
@@ -30,14 +30,14 @@ module Batches
# end
# end
#
#
# ==== Options
# ==== Options
# * <tt>:batch_size</tt> - Specifies the size of the batch. Default to 1000.
# * <tt>:batch_size</tt> - Specifies the size of the batch. Default
s
to 1000.
# * <tt>:start</tt> - Specifies the primary key value to start from, inclusive of the value.
# * <tt>:start</tt> - Specifies the primary key value to start from, inclusive of the value.
# * <tt>:finish</tt> - Specifies the primary key value to end at, inclusive of the value.
# * <tt>:finish</tt> - Specifies the primary key value to end at, inclusive of the value.
# * <tt>:error_on_ignore</tt> - Overrides the application config to specify if an error should be raised when
# * <tt>:error_on_ignore</tt> - Overrides the application config to specify if an error should be raised when
# an order is present in the relation.
# an order is present in the relation.
#
#
# Limits are honored, and if present there is no requirement for the batch
# Limits are honored, and if present there is no requirement for the batch
# size
, it can be less than, equal
, or greater than the limit.
# size
: it can be less than, equal to
, or greater than the limit.
#
#
# The options +start+ and +finish+ are especially useful if you want
# The options +start+ and +finish+ are especially useful if you want
# multiple workers dealing with the same processing queue. You can make
# multiple workers dealing with the same processing queue. You can make
...
@@ -89,14 +89,14 @@ def find_each(start: nil, finish: nil, batch_size: 1000, error_on_ignore: nil)
...
@@ -89,14 +89,14 @@ def find_each(start: nil, finish: nil, batch_size: 1000, error_on_ignore: nil)
# To be yielded each record one by one, use #find_each instead.
# To be yielded each record one by one, use #find_each instead.
#
#
# ==== Options
# ==== Options
# * <tt>:batch_size</tt> - Specifies the size of the batch. Default to 1000.
# * <tt>:batch_size</tt> - Specifies the size of the batch. Default
s
to 1000.
# * <tt>:start</tt> - Specifies the primary key value to start from, inclusive of the value.
# * <tt>:start</tt> - Specifies the primary key value to start from, inclusive of the value.
# * <tt>:finish</tt> - Specifies the primary key value to end at, inclusive of the value.
# * <tt>:finish</tt> - Specifies the primary key value to end at, inclusive of the value.
# * <tt>:error_on_ignore</tt> - Overrides the application config to specify if an error should be raised when
# * <tt>:error_on_ignore</tt> - Overrides the application config to specify if an error should be raised when
# an order is present in the relation.
# an order is present in the relation.
#
#
# Limits are honored, and if present there is no requirement for the batch
# Limits are honored, and if present there is no requirement for the batch
# size
, it can be less than, equal
, or greater than the limit.
# size
: it can be less than, equal to
, or greater than the limit.
#
#
# The options +start+ and +finish+ are especially useful if you want
# The options +start+ and +finish+ are especially useful if you want
# multiple workers dealing with the same processing queue. You can make
# multiple workers dealing with the same processing queue. You can make
...
@@ -140,9 +140,9 @@ def find_in_batches(start: nil, finish: nil, batch_size: 1000, error_on_ignore:
...
@@ -140,9 +140,9 @@ def find_in_batches(start: nil, finish: nil, batch_size: 1000, error_on_ignore:
# If you do not provide a block to #in_batches, it will return a
# If you do not provide a block to #in_batches, it will return a
# BatchEnumerator which is enumerable.
# BatchEnumerator which is enumerable.
#
#
# Person.in_batches.with_index do |relation, batch_index|
# Person.in_batches.
each_
with_index do |relation, batch_index|
# puts "Processing relation ##{batch_index}"
# puts "Processing relation ##{batch_index}"
# relation.
each { |relation| relation.delete_all }
# relation.
delete_all
# end
# end
#
#
# Examples of calling methods on the returned BatchEnumerator object:
# Examples of calling methods on the returned BatchEnumerator object:
...
@@ -152,8 +152,8 @@ def find_in_batches(start: nil, finish: nil, batch_size: 1000, error_on_ignore:
...
@@ -152,8 +152,8 @@ def find_in_batches(start: nil, finish: nil, batch_size: 1000, error_on_ignore:
# Person.in_batches.each_record(&:party_all_night!)
# Person.in_batches.each_record(&:party_all_night!)
#
#
# ==== Options
# ==== Options
# * <tt>:of</tt> - Specifies the size of the batch. Default to 1000.
# * <tt>:of</tt> - Specifies the size of the batch. Default
s
to 1000.
# * <tt>:load</tt> - Specifies if the relation should be loaded. Default to false.
# * <tt>:load</tt> - Specifies if the relation should be loaded. Default
s
to false.
# * <tt>:start</tt> - Specifies the primary key value to start from, inclusive of the value.
# * <tt>:start</tt> - Specifies the primary key value to start from, inclusive of the value.
# * <tt>:finish</tt> - Specifies the primary key value to end at, inclusive of the value.
# * <tt>:finish</tt> - Specifies the primary key value to end at, inclusive of the value.
# * <tt>:error_on_ignore</tt> - Overrides the application config to specify if an error should be raised when
# * <tt>:error_on_ignore</tt> - Overrides the application config to specify if an error should be raised when
...
@@ -186,7 +186,7 @@ def find_in_batches(start: nil, finish: nil, batch_size: 1000, error_on_ignore:
...
@@ -186,7 +186,7 @@ def find_in_batches(start: nil, finish: nil, batch_size: 1000, error_on_ignore:
#
#
# NOTE: It's not possible to set the order. That is automatically set to
# NOTE: It's not possible to set the order. That is automatically set to
# ascending on the primary key ("id ASC") to make the batch ordering
# ascending on the primary key ("id ASC") to make the batch ordering
# consistent. Therefore the primary key must be orderable, e.g an integer
# consistent. Therefore the primary key must be orderable, e.g
.
an integer
# or a string.
# or a string.
#
#
# NOTE: By its nature, batch processing is subject to race conditions if
# NOTE: By its nature, batch processing is subject to race conditions if
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录