本文整理汇总了TypeScript中knex.batchInsert函数的典型用法代码示例。如果您正苦于以下问题:TypeScript batchInsert函数的具体用法?TypeScript batchInsert怎么用?TypeScript batchInsert使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了batchInsert函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: knex
return knex("universes").del().then(async (): Promise<any> => {
// Inserts seed entries
return knex.batchInsert("universes", [{
universe: "0x000000000000000000000000000000000000000b",
parentUniverse: null,
reputationToken: "REP_TOKEN",
forked: false,
}, {
universe: "CHILD_UNIVERSE",
parentUniverse: "0x000000000000000000000000000000000000000b",
reputationToken: "REP_TOKEN_CHILD",
payoutId: 7,
forked: false,
}, {
universe: "FIRST_GRAND_CHILD_UNIVERSE",
parentUniverse: "CHILD_UNIVERSE",
reputationToken: "REP_TOKEN_FIRST_GRAND_CHILD",
forked: false,
}, {
universe: "SECOND_GRAND_CHILD_UNIVERSE",
parentUniverse: "CHILD_UNIVERSE",
reputationToken: "REP_TOKEN_SECOND_GRAND_CHILD",
forked: false,
}, {
universe: "0x000000000000000000000000000000000000000d",
parentUniverse: 0x000000000000000000000000000000000000000b,
reputationToken: "REP_TOKEN_d",
forked: false,
}], 1000);
});
示例2: knex
return knex("search_en").del().then(async (): Promise<any> => {
// Inserts seed entries
const seedData = [{
marketId: "0x0000000000000000000000000000000000000015",
shortDescription: "bob and sue are hanging out",
}, {
marketId: "0x0000000000000000000000000000000000000012",
shortDescription: "bob and jimmy are going to the movies",
}, {
marketId: "0x0000000000000000000000000000000000000013",
shortDescription: "little jonny is going to school",
}, {
marketId: "0x0000000000000000000000000000000000000014",
shortDescription: "sue and betty are hanging out",
}, {
marketId: "0x0000000000000000000000000000000000000016",
shortDescription: "sue and tina are hanging out",
}, {
marketId: "0x0000000000000000000000000000000000000017",
shortDescription: "sue and debbie went to dinner",
}, {
marketId: "0x0000000000000000000000000000000000000018",
shortDescription: "sue and jonny went to the store",
}, {
marketId: "0x0000000000000000000000000000000000000019",
shortDescription: "sue went to the store",
}];
return knex.batchInsert("search_en", seedData, seedData.length);
});
示例3: knex
return knex("transfers").del().then(async (): Promise<any> => {
// Inserts seed entries
const seedData = [{
transactionHash: "0x00000000000000000000000000000000000000000000000000000000deadbeef",
logIndex: 0,
sender: "0x0000000000000000000000000000000000000b0b",
recipient: "0x000000000000000000000000000000000000d00d",
token: "0x0100000000000000000000000000000000000000",
value: 10,
blockNumber: 1400000,
}, {
transactionHash: "0x00000000000000000000000000000000000000000000000000000000d3adb33f",
logIndex: 0,
sender: "0x000000000000000000000000000000000000d00d",
recipient: "0x0000000000000000000000000000000000000b0b",
token: "0x0100000000000000000000000000000000000000",
value: 2,
blockNumber: 1400001,
}, {
transactionHash: "0x00000000000000000000000000000000000000000000000000000000deadb33f",
logIndex: 1,
sender: "0x0000000000000000000000000000000000000b0b",
recipient: "0x000000000000000000000000000000000000d00d",
token: "0x7a305d9b681fb164dc5ad628b5992177dc66aec8",
value: 47,
blockNumber: 1400001,
}];
return knex.batchInsert("transfers", seedData, seedData.length);
});
示例4: knex
return knex("categories").del().then(async (): Promise<any> => {
// Inserts seed entries
const seedData = [{
category: "TEST CATEGORY",
nonFinalizedOpenInterest: "0",
openInterest: "0",
universe: "0x000000000000000000000000000000000000000b",
}, {
category: "POLITICS",
nonFinalizedOpenInterest: "3",
openInterest: "12",
universe: "0x000000000000000000000000000000000000000b",
}, {
category: "ETHEREUM",
nonFinalizedOpenInterest: "4.5",
openInterest: "4.5",
universe: "0x000000000000000000000000000000000000000b",
}, {
category: "ethereum",
nonFinalizedOpenInterest: "0",
openInterest: "0",
universe: "0x000000000000000000000000000000000000000b",
}, {
category: "AUGUR",
nonFinalizedOpenInterest: "0",
openInterest: "3",
universe: "0x000000000000000000000000000000000000000b",
}, {
category: "FINANCE",
nonFinalizedOpenInterest: "2.5",
openInterest: "2.6",
universe: "0x000000000000000000000000000000000000000b",
}];
return knex.batchInsert("categories", seedData, seedData.length);
});
示例5: knex
return knex("fee_windows").del().then(async (): Promise<any> => {
// Inserts seed entries
const seedData = [{
feeWindow: "0x1000000000000000000000000000000000000000",
feeWindowId: 456,
universe: "0x000000000000000000000000000000000000000b",
startTime: 1506473473,
endTime: 1506473515,
state: FeeWindowState.PAST,
fees: 0,
feeToken: "FEE_TOKEN_1",
}, {
feeWindow: "0x3000000000000000000000000000000000000000",
feeWindowId: 457,
universe: "0x000000000000000000000000000000000000000b",
startTime: 1506474500,
endTime: 1506480000,
state: FeeWindowState.PAST,
fees: 0,
feeToken: "FEE_TOKEN_3",
}, {
feeWindow: "0x2000000000000000000000000000000000000000",
feeWindowId: 457,
universe: "0x000000000000000000000000000000000000000b",
startTime: 1509065473,
endTime: 1509065473 + 604800,
state: FeeWindowState.CURRENT,
fees: 0,
feeToken: "FEE_TOKEN_2",
}, {
feeWindow: "0x2100000000000000000000000000000000000000",
feeWindowId: 1,
universe: "0x000000000000000000000000000000000000000b",
startTime: 1509670273,
endTime: 1509670273 + 604800,
state: FeeWindowState.FUTURE,
fees: 0,
feeToken: "NEXT_FEE_TOKEN",
}, {
feeWindow: "0x5000000000000000000000000000000000000000",
feeWindowId: 458,
universe: "CHILD_UNIVERSE",
startTime: 1508065473,
endTime: 1509065473,
state: FeeWindowState.CURRENT,
fees: 0,
feeToken: "FEE_TOKEN_CHILD_UNIVERSE_CURRENT",
}, {
feeWindow: "0x4000000000000000000000000000000000000000",
feeWindowId: 459,
universe: "CHILD_UNIVERSE",
startTime: 1509065473,
endTime: 1511657473,
state: FeeWindowState.FUTURE,
fees: 0,
feeToken: "FEE_TOKEN_CHILD_UNIVERSE",
}];
return knex.batchInsert("fee_windows", seedData, seedData.length);
});
示例6: knex
return knex("orders_canceled").del().then(async (): Promise<any> => {
// Inserts seed entries
const seedData = [{
orderId: "0x4200000000000000000000000000000000000000000000000000000000000000",
blockNumber: 1500001,
transactionHash: "0x000000000000000000000000000000000000000000000000000000000000AA05",
logIndex: 0,
}];
return knex.batchInsert("orders_canceled", seedData, seedData.length);
});
示例7: knex
return knex("disputes").del().then(async (): Promise<any> => {
// Inserts seed entries
const seedData = [{
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D00",
logIndex: 0,
blockNumber: 1400051,
reporter: "0x0000000000000000000000000000000000000021",
crowdsourcerId: "0x0000000000000000001000000000000000000001",
amountStaked: "17",
}, {
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D01",
logIndex: 0,
blockNumber: 1400051,
reporter: "0x0000000000000000000000000000000000000022",
crowdsourcerId: "0x0000000000000000001000000000000000000002",
amountStaked: "41",
}, {
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D02",
logIndex: 0,
blockNumber: 1400051,
reporter: "0x0000000000000000000000000000000000000023",
crowdsourcerId: "0x0000000000000000001000000000000000000002",
amountStaked: "222",
}, {
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D03",
logIndex: 0,
blockNumber: 1400052,
reporter: "0x0000000000000000000000000000000000000021",
crowdsourcerId: "0x0000000000000000001000000000000000000003",
amountStaked: "229",
}, {
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D04",
logIndex: 0,
blockNumber: 1400051,
reporter: "0x0000000000000000000000000000000000000024",
crowdsourcerId: "0x0000000000000000001000000000000000000003",
amountStaked: "300",
}, {
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D05",
logIndex: 0,
blockNumber: 1400052,
reporter: "0x0000000000000000000000000000000000000024",
crowdsourcerId: "0x0000000000000000001000000000000000000003",
amountStaked: "450",
}, {
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000D06",
logIndex: 0,
blockNumber: 1500002,
reporter: "0x0000000000000000000000000000000000000b0b",
crowdsourcerId: "0x0000000000000000001000000000000000000004",
amountStaked: "16",
}];
return knex.batchInsert("disputes", seedData, seedData.length);
});
示例8: knex
return knex("initial_reports").del().then(async (): Promise<any> => {
// Inserts seed entries
const seedData = [{
blockNumber: 1400100,
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000E00",
logIndex: 0,
marketId: "0x0000000000000000000000000000000000000011",
reporter: "0x0000000000000000000000000000000000000b0b",
payoutId: 1,
isDesignatedReporter: false,
amountStaked: "102",
initialReporter: "0x0000000000000000000000000000000000abe123",
redeemed: false,
}, {
blockNumber: 1400100,
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000E00",
logIndex: 0,
marketId: "0x0000000000000000000000000000000000000019",
reporter: "0x0000000000000000000000000000000000000b0b",
payoutId: 5,
isDesignatedReporter: true,
amountStaked: "102",
initialReporter: "0x0000000000000000000000000000000000abe111",
redeemed: false,
}, {
blockNumber: 1400100,
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000E00",
logIndex: 0,
marketId: "0x0000000000000000000000000000000000000211",
reporter: "0x0000000000000000000000000000000000000b0b",
payoutId: 5,
isDesignatedReporter: true,
amountStaked: "102",
initialReporter: "0x0000000000000000000000000000000000abe321",
redeemed: false,
}, {
blockNumber: 1400100,
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000E00",
logIndex: 0,
marketId: "0x00000000000000000000000000000000000000f1",
reporter: "0x0000000000000000000000000000000000000b0b",
payoutId: 5,
isDesignatedReporter: true,
amountStaked: "102",
initialReporter: "0x0000000000000000000000000000000000abe222",
redeemed: false,
},
];
return knex.batchInsert("initial_reports", seedData, seedData.length);
});
示例9: knex
return knex("blocks").del().then(async (): Promise<any> => {
// Inserts seed entries
const seedData = [{
blockNumber: 7,
blockHash: "0x7",
timestamp: 10000000,
}, {
blockNumber: 8,
blockHash: "0x8",
timestamp: 10000015,
}, {
blockNumber: 1400000,
blockHash: "0x1400000",
timestamp: 1506473474,
}, {
blockNumber: 1400001,
blockHash: "0x1400001",
timestamp: 1506473500,
}, {
blockNumber: 1400002,
blockHash: "0x1400002",
timestamp: 1506473515,
}, {
blockNumber: 1400051,
blockHash: "0x1400051",
timestamp: 1506474500,
}, {
blockNumber: 1400052,
blockHash: "0x1400052",
timestamp: 1506474515,
}, {
blockNumber: 1400100,
blockHash: "0x1400100",
timestamp: 1506480000,
}, {
blockNumber: 1400101,
blockHash: "0x1400101",
timestamp: 1506480015,
}, {
blockNumber: 1500001,
blockHash: "0x1500001",
timestamp: 1509065474,
}];
return knex.batchInsert("blocks", seedData, seedData.length);
});
示例10: knex
return knex("outcomes").del().then(async (): Promise<any> => {
// Inserts seed entries
const marketOutcomeCounts: {[marketId: string]: {numOutcomes: number, price: string, volume: string }} = {
"0x0000000000000000000000000000000000000001": {numOutcomes: 8, price: "0.125", volume: "100"},
"0x0000000000000000000000000000000000000002": {numOutcomes: 2, price: "0.5", volume: "1000"},
"0x0000000000000000000000000000000000000003": {numOutcomes: 2, price: "0.5", volume: "10"},
"0x0000000000000000000000000000000000000011": {numOutcomes: 8, price: "0.125", volume: "100"},
"0x0000000000000000000000000000000000000012": {numOutcomes: 2, price: "0.125", volume: "100"},
"0x0000000000000000000000000000000000000013": {numOutcomes: 2, price: "0.125", volume: "100"},
"0x0000000000000000000000000000000000000014": {numOutcomes: 5, price: "0.125", volume: "100"},
"0x0000000000000000000000000000000000000015": {numOutcomes: 4, price: "0.125", volume: "100"},
"0x0000000000000000000000000000000000000016": {numOutcomes: 7, price: "0.125", volume: "100"},
"0x0000000000000000000000000000000000000017": {numOutcomes: 7, price: "0.125", volume: "100"},
"0x0000000000000000000000000000000000000018": {numOutcomes: 7, price: "0.125", volume: "100"},
"0x0000000000000000000000000000000000000019": {numOutcomes: 5, price: "0.125", volume: "100"},
"0x0000000000000000000000000000000000000211": {numOutcomes: 2, price: "0.5", volume: "100"},
"0x0000000000000000000000000000000000000442": {numOutcomes: 3, price: "0.1", volume: "100"},
"0x000000000000000000000000000000000000021c": {numOutcomes: 2, price: "0.5", volume: "100"},
};
const seedData: any = [];
Object.keys(marketOutcomeCounts).forEach((marketId) => {
const { numOutcomes, price, volume } = marketOutcomeCounts[marketId];
Array(numOutcomes).fill(0).forEach((_, i) => {
seedData.push({
marketId,
volume,
shareVolume: new BigNumber(volume).multipliedBy(new BigNumber(price)).toString(),
price,
outcome: i,
description: "outcome " + i,
});
});
});
return knex.batchInsert("outcomes", seedData, seedData.length);
});