Skip to content

Add support for array and multiset#489

Merged
snuyanzin merged 1 commit intodatafaker-net:mainfrom
snuyanzin:array
Oct 24, 2022
Merged

Add support for array and multiset#489
snuyanzin merged 1 commit intodatafaker-net:mainfrom
snuyanzin:array

Conversation

@snuyanzin
Copy link
Collaborator

@snuyanzin snuyanzin commented Oct 24, 2022

Some databases support ARRAY and MULTISET
this PR adds support for it.
So if there is a field in Schema with value of array or list then it will be transformed into sql ARRAY
like

Schema.of(field("bytes", () -> new byte[]{1, 0}));

With help of this Schema there could be generated sql like

INSERT INTO "MyTable" ("bytes") VALUES (ARRAY[1, 0]);

In a similar way for MULTISET, a filed should be a set like

Schema.of(field("names_multiset", () -> Collections.singleton(faker.name().firstName())));

it could generate a sql like

INSERT INTO "MyTable" ("names_multiset") VALUES (MULTISET['Carlena']);

@snuyanzin snuyanzin merged commit 3a786fd into datafaker-net:main Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant