mirror of
https://github.com/leon-ai/leon.git
synced 2024-11-28 04:04:58 +03:00
refactor(bridge/nodejs): rename insert
to create
This commit is contained in:
parent
8e55c481d4
commit
af2a124165
@ -27,11 +27,11 @@ export class Memory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert record to memory
|
||||
* Create record
|
||||
* @param record
|
||||
* @example insertOne({ id: 0, title: 'hello world' })
|
||||
* @example create({ id: 0, title: 'hello world' })
|
||||
*/
|
||||
public async insertOne<T>(record: T): Promise<T> {
|
||||
public async create<T>(record: T): Promise<T> {
|
||||
this.memory.data[this.name].push(record)
|
||||
|
||||
await this.memory.write()
|
||||
@ -40,11 +40,11 @@ export class Memory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert records to memory
|
||||
* Create records
|
||||
* @param records
|
||||
* @example insertMany([{ id: 0, title: 'hello world' }, { id: 1, title: 'hello world' }])
|
||||
* @example createMany([{ id: 0, title: 'hello world' }, { id: 1, title: 'hello world' }])
|
||||
*/
|
||||
public async insertMany<T>(records: T[]): Promise<T[]> {
|
||||
public async createMany<T>(records: T[]): Promise<T[]> {
|
||||
this.memory.data[this.name].push(...records)
|
||||
|
||||
await this.memory.write()
|
||||
|
@ -10,7 +10,7 @@ export const run: ActionFunction = async function () {
|
||||
const posts = await new Memory('posts').load()
|
||||
// const sections = await new Memory('sections').load()
|
||||
|
||||
await posts.insertOne({
|
||||
await posts.create({
|
||||
id: 0,
|
||||
title: 'hello world',
|
||||
content: 'hello world',
|
||||
@ -20,7 +20,7 @@ export const run: ActionFunction = async function () {
|
||||
createdAt: Date.now()
|
||||
})
|
||||
|
||||
await posts.insertMany([
|
||||
await posts.createMany([
|
||||
{
|
||||
id: 1,
|
||||
title: 'hello world',
|
||||
|
Loading…
Reference in New Issue
Block a user