Lawtext core references / core/src/data/query / LawQuery
Class: LawQuery<TItem>
Defined in: core/src/data/query.ts:685 (opens in a new tab)
Lawtext query の法令検索を行う Query の派生クラス。ここに列挙されているもの以外のクラスメンバーについては Query を参照してください。
Extends
Query<TItem>
Type Parameters
• TItem extends LawQueryItem = LawQueryItem
Constructors
new LawQuery()
new LawQuery<
TItem>(population,criteria,options?):LawQuery<TItem>
Defined in: core/src/data/query.ts:689 (opens in a new tab)
Parameters
population
AsyncIterable<TItem>
criteria
null | LawCriteria<TItem>
options?
Partial<QueryOptions>
Returns
LawQuery<TItem>
Overrides
Properties
criteria
criteria:
null|CoreQueryCriteria<TItem>
Defined in: core/src/data/query.ts:70 (opens in a new tab)
Inherited from
options
options:
QueryOptions
Defined in: core/src/data/query.ts:71 (opens in a new tab)
Inherited from
population
population:
AsyncIterable<TItem>
Defined in: core/src/data/query.ts:69 (opens in a new tab)
Inherited from
Methods
[asyncIterator]()
[asyncIterator]():
AsyncGenerator<TItem,void,undefined>
Defined in: core/src/data/query.ts:105 (opens in a new tab)
Returns
AsyncGenerator<TItem, void, undefined>
Inherited from
assign()
assign<
T>(func,criteria,options?):LawQuery<Textendsundefined|void?never:T&TItem>
Defined in: core/src/data/query.ts:746 (opens in a new tab)
Apply a function for each filtered item and iterate the merged object with the returned and original object.
フィルタ後の要素ごとに関数を実行し、返り値と元の要素のプロパティをマージしたオブジェクトを列挙します。
Type Parameters
• T
Parameters
func
(item) => T | Promise<T>
a function to be called for each filtered item
要素ごとに実行される関数
criteria
an additional criteria applied after merge / マージ後に適用するフィルタ条件
null | LawCriteria<T extends undefined | void ? never : T & TItem>
options?
Partial<QueryOptions>
options which override the original ones / 上書きするオプション項目
Returns
LawQuery<T extends undefined | void ? never : T & TItem>
- a new
Querythat yields merged objects
マージされたオブジェクトを列挙する新しいQuery
Overrides
assignDocument()
assignDocument<
TEnsure>(ensure,options?):LawQuery<TItem&object>
Defined in: core/src/data/query.ts:764 (opens in a new tab)
法令XMLのDOMを取得して追加したオブジェクトを列挙します。
Type Parameters
• TEnsure extends boolean = true
Parameters
ensure
TEnsure = ...
法令XMLが取得できたもののみを列挙するかどうか(デフォルト: true)
options?
Partial<QueryOptions>
上書きするオプション項目
Returns
LawQuery<TItem & object>
- 法令XMLのDOMを
documentプロパティとして追加したオブジェクトを列挙する新しいQuery
filter()
filter(
criteria):this
Defined in: core/src/data/query.ts:739 (opens in a new tab)
Apply an additional filter.
フィルタを追加します。
Parameters
criteria
an additional criteria / 追加するフィルタ条件
null | LawCriteria<TItem>
Returns
this
- a new
Querythat appliescriteriato the filtered items of the originalQuery
フィルタ後の項目を検索元とし、criteriaを検索条件とする新しいQuery
Overrides
forEach()
forEach(
func):Promise<void>
Defined in: core/src/data/query.ts:376 (opens in a new tab)
Invoke func for each filtered item. Running this function will invoke the whole iteration process of the Query.
列挙された要素ごとに func を実行します。この関数を実行すると Query の列挙を最後まで実行します。
Parameters
func
(item) => unknown
a function to be called for each item
要素ごとに実行される関数
Returns
Promise<void>
Inherited from
limit()
limit(
max,options?):this
Defined in: core/src/data/query.ts:296 (opens in a new tab)
Yield until it reaches the maximum count.
出力の最大件数を設定します。
Parameters
max
number
the maximum count
最大件数
options?
Partial<QueryOptions>
options which override the original ones / 上書きするオプション項目
Returns
this
- a new
Querythat yields until it reaches the maximum count.
最大件数に達するまで列挙を続ける新しいQuery
Inherited from
map()
map<
T,TRet>(func,criteria,options?):Query<Awaited<TRet>>
Defined in: core/src/data/query.ts:127 (opens in a new tab)
Apply a function for each filtered item.
フィルタ後の要素ごとに関数を実行します。
Type Parameters
• T
• TRet = T extends undefined | void ? never : T
Parameters
func
(item) => T | Promise<T>
a function to be called for each filtered item
要素ごとに実行される関数
criteria
an additional criteria applied after filtering / 関数実行後に適用するフィルタ条件
null | QueryCriteria<TRet>
options?
Partial<QueryOptions>
options which override the original ones / 上書きするオプション項目
Returns
Query<Awaited<TRet>>
- a new
Querythat yields items returned byfunc
funcの返り値を列挙する新しいQuery
Inherited from
mapWorkers()
mapWorkers<
T,TRet>(workersPool,criteria,options?):Query<Awaited<TRet>>
Defined in: core/src/data/query.ts:149 (opens in a new tab)
Type Parameters
• T
• TRet = T extends undefined | void ? never : T
Parameters
workersPool
WorkersPool<TItem, TRet>
criteria
null | QueryCriteria<TRet>
options?
Partial<QueryOptions>
Returns
Query<Awaited<TRet>>
Inherited from
new()
protectednew(population,criteria,overrideOptions?):this
Defined in: core/src/data/query.ts:711 (opens in a new tab)
Parameters
population
AsyncIterable<TItem>
criteria
null | LawCriteria<TItem>
overrideOptions?
Partial<QueryOptions>
Returns
this
Overrides
pick()
pick<
K>(...keys):Query<Awaited<Pick<TItem,K>>>
Defined in: core/src/data/query.ts:337 (opens in a new tab)
Pick properties of each item.
特定のプロパティ以外のプロパティを削除したオブジェクトを列挙します。
Type Parameters
• K extends string | number | symbol
Parameters
keys
...K[]
the keys of properties to be picked
抜き出すプロパティのキー
Returns
Query<Awaited<Pick<TItem, K>>>
- a new
Querythat yields the objects with the picked properties
プロパティを抜き出した新しいオブジェクトの内容を列挙する新しいQuery
Inherited from
property()
property<
K>(key):Query<Awaited<TItem[K]>>
Defined in: core/src/data/query.ts:325 (opens in a new tab)
Yield a property of each item.
特定のプロパティの内容を一つ抜き出して列挙します。
Type Parameters
• K extends string | number | symbol
Parameters
key
K
the key of a property to be picked
抜き出すプロパティのキー
Returns
Query<Awaited<TItem[K]>>
- a new
Querythat yields the picked property
抜き出したプロパティの内容を列挙する新しいQuery
Inherited from
skip()
skip(
count,options?):this
Defined in: core/src/data/query.ts:265 (opens in a new tab)
Skip specified count.
指定した件数スキップします。
Parameters
count
number
count to skip
スキップする件数
options?
Partial<QueryOptions>
options which override the original ones / 上書きするオプション項目
Returns
this
- a new
Querythat yields after skipping specified count.
指定した件数のスキップ後列挙を続ける新しいQuery
Inherited from
toArray()
toArray(
options):Promise<TItem[]>
Defined in: core/src/data/query.ts:358 (opens in a new tab)
Generate an array from the Query. Running this function will invoke the whole iteration process of the Query.
Query から配列を生成します。この関数を実行すると Query の列挙を最後まで実行します。
Parameters
options
options.preserveCache <boolean>: whether to suggest the Query to preserve the cached data for each item, which normally will be cleared after yield (default: false)Queryにキャッシュされたデータを削除せずそのまま残すかどうかを指示します。
preserveCache
boolean
Returns
Promise<TItem[]>
- a
Promisethat resolves a generated array
生成された配列を返すPromise
Inherited from
while()
while(
func,yieldLast,options?):this
Defined in: core/src/data/query.ts:232 (opens in a new tab)
Yield while func returns true.
func が true を返す間、列挙を続けます。
Parameters
func
(item) => boolean | Promise<boolean>
a function to be called for each filtered item. Returning false terminates the iteration.
要素ごとに実行される関数。falseを返すと列挙を停止します。
yieldLast
boolean = false
whether to return the item that caused func returned false funcがfalseを返す要因となった要素を出力するかどうか
options?
Partial<QueryOptions>
options which override the original ones / 上書きするオプション項目
Returns
this
- a new
Querythat yields whilefuncreturnstruefuncがtrueを返す間列挙を続ける新しいQuery
Inherited from
fromFetchInfo()
staticfromFetchInfo(loader,criteria,options?):LawQuery
Defined in: core/src/data/query.ts:719 (opens in a new tab)
Parameters
loader
criteria
null | LawCriteria<LawQueryItem>
options?
Partial<QueryOptions>