Module

x/casualdb/mod.ts

Simple JSON "database" for Deno with type-safety! ⚡️
Latest
class CollectionOperator
extends BaseOperator<Op[]>
import { CollectionOperator } from "https://deno.land/x/casualdb@v0.1.4/mod.ts";

Constructors

new
CollectionOperator(data: Op[])

Methods

findAll(predicate: Predicate<Op>): CollectionOperator<Op>
findAllAndRemove<T = Op>(predicate: Predicate<Partial<T>>): CollectionOperator<Op>
findAllAndUpdate<T = Op>(predicate: Predicate<Partial<T>>, updateMethod: (value: Op) => Op): CollectionOperator<Op>
findById(id: string | number)
findByIdAndRemove(id: string | number)
findByIdAndUpdate(id: string | number, updateMethod: (value: Op) => Op)
findOne(predicate: Predicate<Op>)

Find & return one element from the collection

page(page: number, pageSize: number): CollectionOperator<Op>
pick<U extends keyof Op>(keys: Array<U>)
push(data: Op)
size(): number

Get the size (length) of the collection.

sort(compare: SortArg<Op>)