MCPcopy
hub / github.com/kysely-org/kysely / insertDefaultJSONDataSet

Function insertDefaultJSONDataSet

test/node/src/test-setup.ts:670–716  ·  view source on GitHub ↗
(
  ctx: JSONTestContext,
)

Source from the content-addressed store, hash-verified

668}
669
670export async function insertDefaultJSONDataSet(
671 ctx: JSONTestContext,
672): Promise<void> {
673 await insertDefaultDataSet(ctx as any)
674
675 const people = await ctx.db
676 .selectFrom('person')
677 .select(['id', 'first_name', 'last_name'])
678 .execute()
679
680 await ctx.db
681 .insertInto('person_metadata')
682 .values(
683 people
684 .filter((person) => person.first_name && person.last_name)
685 .map((person, index) => ({
686 person_id: person.id,
687 website: JSON.stringify({
688 url: `https://www.${person.first_name!.toLowerCase()}${person.last_name!.toLowerCase()}.com`,
689 }),
690 nicknames: JSON.stringify([
691 `${person.first_name![0]}.${person.last_name![0]}.`,
692 `${person.first_name} the Great`,
693 `${person.last_name} the Magnificent`,
694 ]),
695 profile: JSON.stringify({
696 tags: ['awesome'],
697 auth: {
698 roles: ['contributor', 'moderator'],
699 last_login: {
700 device: 'android',
701 },
702 login_count: 12 + index,
703 is_verified: true,
704 },
705 avatar: null,
706 }),
707 experience: JSON.stringify([
708 {
709 establishment: 'The University of Life',
710 },
711 ]),
712 schedule: JSON.stringify([[[{ name: 'Gym', time: '12:15' }]]]),
713 })),
714 )
715 .execute()
716}
717
718export async function clearJSONDatabase(ctx: JSONTestContext): Promise<void> {
719 await ctx.db.deleteFrom('person_metadata').execute()

Callers 2

Calls 6

insertDefaultDataSetFunction · 0.85
valuesMethod · 0.80
executeMethod · 0.65
selectMethod · 0.65
selectFromMethod · 0.65
insertIntoMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…