Library
core
classes
Core Src Data Query.lawquery

Lawtext core references / core/src/data/query / LawQuery

Class: LawQuery<TItem>

core/src/data/query.LawQuery

Lawtext query の法令検索を行う Query の派生クラス。ここに列挙されているもの以外のクラスメンバーについては Query を参照してください。

Type parameters

NameType
TItemextends LawQueryItem = LawQueryItem

Hierarchy

  • Query<TItem>

    LawQuery

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new LawQuery<TItem>(population, criteria, options?): LawQuery<TItem>

Type parameters

NameType
TItemextends LawQueryItem = LawQueryItem

Parameters

NameType
populationAsyncIterable<TItem>
criterianull | LawCriteria<TItem>
options?Partial<QueryOptions>

Returns

LawQuery<TItem>

Overrides

Query.constructor

Defined in

core/src/data/query.ts:689 (opens in a new tab)

Properties

criteria

criteria: null | CoreQueryCriteria<TItem>

Inherited from

Query.criteria

Defined in

core/src/data/query.ts:70 (opens in a new tab)


options

options: QueryOptions

Inherited from

Query.options

Defined in

core/src/data/query.ts:71 (opens in a new tab)


population

population: AsyncIterable<TItem>

Inherited from

Query.population

Defined in

core/src/data/query.ts:69 (opens in a new tab)

Methods

[asyncIterator]

[asyncIterator](): AsyncGenerator<TItem, void, undefined>

Returns

AsyncGenerator<TItem, void, undefined>

Inherited from

Query.[asyncIterator]

Defined in

core/src/data/query.ts:105 (opens in a new tab)


assign

assign<T>(func, criteria?, options?): LawQuery<T extends undefined | void ? never : T & TItem>

Apply a function for each filtered item and iterate the merged object with the returned and original object.

フィルタ後の要素ごとに関数を実行し、返り値と元の要素のプロパティをマージしたオブジェクトを列挙します。

Type parameters

Name
T

Parameters

NameTypeDefault valueDescription
func(item: TItem) => T | Promise<T>undefineda function to be called for each filtered item
要素ごとに実行される関数
criterianull | LawCriteria<T extends undefined | void ? never : T & TItem>nullan additional criteria applied after merge / マージ後に適用するフィルタ条件
options?Partial<QueryOptions>undefinedoptions which override the original ones / 上書きするオプション項目

Returns

LawQuery<T extends undefined | void ? never : T & TItem>

  • a new Query that yields merged objects
    マージされたオブジェクトを列挙する新しい Query

Overrides

Query.assign

Defined in

core/src/data/query.ts:746 (opens in a new tab)


assignDocument

assignDocument<TEnsure>(ensure?, options?): LawQuery<TItem & { document: TEnsure extends true ? XMLDocument : null | XMLDocument }>

法令XMLのDOMを取得して追加したオブジェクトを列挙します。

Type parameters

NameType
TEnsureextends boolean = true

Parameters

NameTypeDescription
ensureTEnsure法令XMLが取得できたもののみを列挙するかどうか(デフォルト: true
options?Partial<QueryOptions>上書きするオプション項目

Returns

LawQuery<TItem & { document: TEnsure extends true ? XMLDocument : null | XMLDocument }>

  • 法令XMLのDOMを document プロパティとして追加したオブジェクトを列挙する新しい Query

Defined in

core/src/data/query.ts:764 (opens in a new tab)


filter

filter(criteria): LawQuery<TItem>

Apply an additional filter.

フィルタを追加します。

Parameters

NameTypeDescription
criterianull | LawCriteria<TItem>an additional criteria / 追加するフィルタ条件

Returns

LawQuery<TItem>

  • a new Query that applies criteria to the filtered items of the original Query
    フィルタ後の項目を検索元とし、criteria を検索条件とする新しい Query

Overrides

Query.filter

Defined in

core/src/data/query.ts:739 (opens in a new tab)


forEach

forEach(func): Promise<void>

Invoke func for each filtered item. Running this function will invoke the whole iteration process of the Query.

列挙された要素ごとに func を実行します。この関数を実行すると Query の列挙を最後まで実行します。

Parameters

NameTypeDescription
func(item: TItem) => unknowna function to be called for each item
要素ごとに実行される関数

Returns

Promise<void>

Inherited from

Query.forEach

Defined in

core/src/data/query.ts:376 (opens in a new tab)


limit

limit(max, options?): LawQuery<TItem>

Yield until it reaches the maximum count.

出力の最大件数を設定します。

Parameters

NameTypeDescription
maxnumberthe maximum count
最大件数
options?Partial<QueryOptions>options which override the original ones / 上書きするオプション項目

Returns

LawQuery<TItem>

  • a new Query that yields until it reaches the maximum count.
    最大件数に達するまで列挙を続ける新しい Query

Inherited from

Query.limit

Defined in

core/src/data/query.ts:296 (opens in a new tab)


map

map<T, TRet>(func, criteria?, options?): Query<Awaited<TRet>>

Apply a function for each filtered item.

フィルタ後の要素ごとに関数を実行します。

Type parameters

NameType
TT
TRetT extends undefined | void ? never : T

Parameters

NameTypeDefault valueDescription
func(item: TItem) => T | Promise<T>undefineda function to be called for each filtered item
要素ごとに実行される関数
criterianull | QueryCriteria<TRet>nullan additional criteria applied after filtering / 関数実行後に適用するフィルタ条件
options?Partial<QueryOptions>undefinedoptions which override the original ones / 上書きするオプション項目

Returns

Query<Awaited<TRet>>

  • a new Query that yields items returned by func
    func の返り値を列挙する新しい Query

Inherited from

Query.map

Defined in

core/src/data/query.ts:127 (opens in a new tab)


mapWorkers

mapWorkers<T, TRet>(workersPool, criteria?, options?): Query<Awaited<TRet>>

Type parameters

NameType
TT
TRetT extends undefined | void ? never : T

Parameters

NameTypeDefault value
workersPoolWorkersPool<TItem, TRet>undefined
criterianull | QueryCriteria<TRet>null
options?Partial<QueryOptions>undefined

Returns

Query<Awaited<TRet>>

Inherited from

Query.mapWorkers

Defined in

core/src/data/query.ts:149 (opens in a new tab)


new

new(population, criteria, overrideOptions?): LawQuery<TItem>

Parameters

NameType
populationAsyncIterable<TItem>
criterianull | LawCriteria<TItem>
overrideOptions?Partial<QueryOptions>

Returns

LawQuery<TItem>

Overrides

Query.new

Defined in

core/src/data/query.ts:711 (opens in a new tab)


pick

pick<K>(...keys): Query<Awaited<Pick<TItem, K>>>

Pick properties of each item.

特定のプロパティ以外のプロパティを削除したオブジェクトを列挙します。

Type parameters

NameType
Kextends string | number | symbol

Parameters

NameTypeDescription
...keysK[]the keys of properties to be picked
抜き出すプロパティのキー

Returns

Query<Awaited<Pick<TItem, K>>>

  • a new Query that yields the objects with the picked properties
    プロパティを抜き出した新しいオブジェクトの内容を列挙する新しい Query

Inherited from

Query.pick

Defined in

core/src/data/query.ts:337 (opens in a new tab)


property

property<K>(key): Query<Awaited<TItem[K]>>

Yield a property of each item.

特定のプロパティの内容を一つ抜き出して列挙します。

Type parameters

NameType
Kextends string | number | symbol

Parameters

NameTypeDescription
keyKthe key of a property to be picked
抜き出すプロパティのキー

Returns

Query<Awaited<TItem[K]>>

  • a new Query that yields the picked property
    抜き出したプロパティの内容を列挙する新しい Query

Inherited from

Query.property

Defined in

core/src/data/query.ts:325 (opens in a new tab)


skip

skip(count, options?): LawQuery<TItem>

Skip specified count.

指定した件数スキップします。

Parameters

NameTypeDescription
countnumbercount to skip
スキップする件数
options?Partial<QueryOptions>options which override the original ones / 上書きするオプション項目

Returns

LawQuery<TItem>

  • a new Query that yields after skipping specified count.
    指定した件数のスキップ後列挙を続ける新しい Query

Inherited from

Query.skip

Defined in

core/src/data/query.ts:265 (opens in a new tab)


toArray

toArray(options?): Promise<TItem[]>

Generate an array from the Query. Running this function will invoke the whole iteration process of the Query.

Query から配列を生成します。この関数を実行すると Query の列挙を最後まで実行します。

Parameters

NameTypeDescription
optionsObjectoptions.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にキャッシュされたデータを削除せずそのまま残すかどうかを指示します。
options.preserveCacheboolean-

Returns

Promise<TItem[]>

  • a Promise that resolves a generated array
    生成された配列を返す Promise

Inherited from

Query.toArray

Defined in

core/src/data/query.ts:358 (opens in a new tab)


while

while(func, yieldLast?, options?): LawQuery<TItem>

Yield while func returns true.

functrue を返す間、列挙を続けます。

Parameters

NameTypeDefault valueDescription
func(item: TItem) => boolean | Promise<boolean>undefineda function to be called for each filtered item. Returning false terminates the iteration.
要素ごとに実行される関数。falseを返すと列挙を停止します。
yieldLastbooleanfalsewhether to return the item that caused func returned false
funcfalseを返す要因となった要素を出力するかどうか
options?Partial<QueryOptions>undefinedoptions which override the original ones / 上書きするオプション項目

Returns

LawQuery<TItem>

  • a new Query that yields while func returns true
    functrue を返す間列挙を続ける新しい Query

Inherited from

Query.while

Defined in

core/src/data/query.ts:232 (opens in a new tab)


fromFetchInfo

fromFetchInfo(loader, criteria, options?): LawQuery<LawQueryItem>

Parameters

NameType
loaderLoader
criterianull | LawCriteria<LawQueryItem>
options?Partial<QueryOptions>

Returns

LawQuery<LawQueryItem>

Defined in

core/src/data/query.ts:719 (opens in a new tab)