drizzle-seed 0.4.0-08e4e66 → 0.4.0-0ec754e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SeedService.d.cts +1 -0
- package/SeedService.d.mts +1 -0
- package/SeedService.d.ts +1 -0
- package/generators/GeneratorFuncs.d.cts +884 -1
- package/generators/GeneratorFuncs.d.mts +884 -1
- package/generators/GeneratorFuncs.d.ts +884 -1
- package/generators/Generators.d.cts +9 -1
- package/generators/Generators.d.mts +9 -1
- package/generators/Generators.d.ts +9 -1
- package/generators/apiVersion.d.cts +1 -1
- package/generators/apiVersion.d.mts +1 -1
- package/generators/apiVersion.d.ts +1 -1
- package/generators/versioning/v3.d.cts +10 -0
- package/generators/versioning/v3.d.mts +10 -0
- package/generators/versioning/v3.d.ts +10 -0
- package/index.cjs +64 -16
- package/index.cjs.map +1 -1
- package/index.d.cts +6 -6
- package/index.d.mts +6 -6
- package/index.d.ts +6 -6
- package/index.mjs +64 -16
- package/index.mjs.map +1 -1
- package/package.json +108 -107
- package/types/seedService.d.cts +1 -1
- package/types/seedService.d.mts +1 -1
- package/types/seedService.d.ts +1 -1
- package/utils.d.cts +0 -1
- package/utils.d.mts +0 -1
- package/utils.d.ts +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AbstractGenerator } from './Generators.js';
|
|
2
|
-
import { GenerateArray, GenerateBitString, GenerateBoolean, GenerateCity, GenerateCompanyName, GenerateCompositeUniqueKey, GenerateCountry, GenerateDate, GenerateDatetime, GenerateDefault, GenerateEmail, GenerateEnum, GenerateFirstName, GenerateFullName, GenerateGeometry, GenerateInet, GenerateInt, GenerateInterval, GenerateIntPrimaryKey, GenerateJobTitle, GenerateJson, GenerateLastName, GenerateLine, GenerateLoremIpsum, GenerateNumber, GeneratePhoneNumber, GeneratePoint, GeneratePostcode, GenerateSelfRelationsValuesFromArray, GenerateState, GenerateStreetAddress, GenerateString, GenerateTime, GenerateTimestamp, GenerateUniqueBitString, GenerateUniqueCity, GenerateUniqueCompanyName, GenerateUniqueCountry, GenerateUniqueFirstName, GenerateUniqueFullName, GenerateUniqueGeometry, GenerateUniqueInet, GenerateUniqueInt, GenerateUniqueInterval, GenerateUniqueLastName, GenerateUniqueLine, GenerateUniqueNumber, GenerateUniquePoint, GenerateUniquePostcode, GenerateUniqueStreetAddress, GenerateUniqueString, GenerateUniqueVector, GenerateUUID, GenerateValuesFromArray, GenerateVector, GenerateWeightedCount, GenerateYear, HollowGenerator, WeightedRandomGenerator } from './Generators.js';
|
|
2
|
+
import { GenerateArray, GenerateBitString, GenerateBoolean, GenerateCity, GenerateCompanyName, GenerateCompositeUniqueKey, GenerateCountry, GenerateDate, GenerateDatetime, GenerateDefault, GenerateEmail, GenerateEnum, GenerateFirstName, GenerateFullName, GenerateGeometry, GenerateHashFromString, GenerateInet, GenerateInt, GenerateInterval, GenerateIntPrimaryKey, GenerateJobTitle, GenerateJson, GenerateLastName, GenerateLine, GenerateLoremIpsum, GenerateNumber, GeneratePhoneNumber, GeneratePoint, GeneratePostcode, GenerateSelfRelationsValuesFromArray, GenerateState, GenerateStreetAddress, GenerateString, GenerateTime, GenerateTimestamp, GenerateUniqueBitString, GenerateUniqueCity, GenerateUniqueCompanyName, GenerateUniqueCountry, GenerateUniqueFirstName, GenerateUniqueFullName, GenerateUniqueGeometry, GenerateUniqueInet, GenerateUniqueInt, GenerateUniqueInterval, GenerateUniqueLastName, GenerateUniqueLine, GenerateUniqueNumber, GenerateUniquePoint, GenerateUniquePostcode, GenerateUniqueStreetAddress, GenerateUniqueString, GenerateUniqueVector, GenerateUUID, GenerateValuesFromArray, GenerateVector, GenerateWeightedCount, GenerateYear, HollowGenerator, WeightedRandomGenerator } from './Generators.js';
|
|
3
3
|
import { GenerateStringV2, GenerateUniqueIntervalV2, GenerateUniqueStringV2 } from './versioning/v2.js';
|
|
4
|
+
import { GenerateHashFromStringV3 } from './versioning/v3.js';
|
|
4
5
|
export declare const generatorsFuncs: {
|
|
5
6
|
/**
|
|
6
7
|
* generates same given value each time the generator is called.
|
|
@@ -1763,7 +1764,889 @@ export declare const generatorsFuncsV2: {
|
|
|
1763
1764
|
arraySize?: number;
|
|
1764
1765
|
}]) => GenerateVector;
|
|
1765
1766
|
};
|
|
1767
|
+
export declare const generatorsFuncsV3: {
|
|
1768
|
+
/**
|
|
1769
|
+
* generates same given value each time the generator is called.
|
|
1770
|
+
* @param defaultValue - value you want to generate
|
|
1771
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
1772
|
+
*
|
|
1773
|
+
* @example
|
|
1774
|
+
* ```ts
|
|
1775
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
1776
|
+
* posts: {
|
|
1777
|
+
* columns: {
|
|
1778
|
+
* content: funcs.default({ defaultValue: "post content" }),
|
|
1779
|
+
* },
|
|
1780
|
+
* },
|
|
1781
|
+
* }));
|
|
1782
|
+
* ```
|
|
1783
|
+
*/
|
|
1784
|
+
default: (args_0: {
|
|
1785
|
+
defaultValue: unknown;
|
|
1786
|
+
arraySize?: number;
|
|
1787
|
+
}) => GenerateDefault;
|
|
1788
|
+
/**
|
|
1789
|
+
* generates values from given array
|
|
1790
|
+
* @param values - array of values you want to generate. can be array of weighted values.
|
|
1791
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
1792
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
1793
|
+
*
|
|
1794
|
+
* @example
|
|
1795
|
+
* ```ts
|
|
1796
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
1797
|
+
* posts: {
|
|
1798
|
+
* columns: {
|
|
1799
|
+
* title: funcs.valuesFromArray({
|
|
1800
|
+
* values: ["Title1", "Title2", "Title3", "Title4", "Title5"],
|
|
1801
|
+
* isUnique: true
|
|
1802
|
+
* }),
|
|
1803
|
+
* },
|
|
1804
|
+
* },
|
|
1805
|
+
* }));
|
|
1806
|
+
*
|
|
1807
|
+
* ```
|
|
1808
|
+
* weighted values example
|
|
1809
|
+
* @example
|
|
1810
|
+
* ```ts
|
|
1811
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
1812
|
+
* posts: {
|
|
1813
|
+
* columns: {
|
|
1814
|
+
* title: funcs.valuesFromArray({
|
|
1815
|
+
* values: [
|
|
1816
|
+
* { weight: 0.35, values: ["Title1", "Title2"] },
|
|
1817
|
+
* { weight: 0.5, values: ["Title3", "Title4"] },
|
|
1818
|
+
* { weight: 0.15, values: ["Title5"] },
|
|
1819
|
+
* ],
|
|
1820
|
+
* isUnique: false
|
|
1821
|
+
* }),
|
|
1822
|
+
* },
|
|
1823
|
+
* },
|
|
1824
|
+
* }));
|
|
1825
|
+
*
|
|
1826
|
+
* ```
|
|
1827
|
+
*/
|
|
1828
|
+
valuesFromArray: (args_0: import("./Generators.js").GenerateValuesFromArrayT) => GenerateValuesFromArray;
|
|
1829
|
+
/**
|
|
1830
|
+
* generates sequential integers starting with 1.
|
|
1831
|
+
* @example
|
|
1832
|
+
* ```ts
|
|
1833
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
1834
|
+
* posts: {
|
|
1835
|
+
* columns: {
|
|
1836
|
+
* id: funcs.intPrimaryKey(),
|
|
1837
|
+
* },
|
|
1838
|
+
* },
|
|
1839
|
+
* }));
|
|
1840
|
+
*
|
|
1841
|
+
* ```
|
|
1842
|
+
*/
|
|
1843
|
+
intPrimaryKey: (...args: [] | [{}]) => GenerateIntPrimaryKey;
|
|
1844
|
+
/**
|
|
1845
|
+
* generates numbers with floating point in given range.
|
|
1846
|
+
* @param minValue - lower border of range.
|
|
1847
|
+
* @param maxValue - upper border of range.
|
|
1848
|
+
* @param precision - precision of generated number:
|
|
1849
|
+
* precision equals 10 means that values will be accurate to one tenth (1.2, 34.6);
|
|
1850
|
+
* precision equals 100 means that values will be accurate to one hundredth (1.23, 34.67).
|
|
1851
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
1852
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
1853
|
+
*
|
|
1854
|
+
* @example
|
|
1855
|
+
* ```ts
|
|
1856
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
1857
|
+
* products: {
|
|
1858
|
+
* columns: {
|
|
1859
|
+
* unitPrice: funcs.number({ minValue: 10, maxValue: 120, precision: 100, isUnique: false }),
|
|
1860
|
+
* },
|
|
1861
|
+
* },
|
|
1862
|
+
* }));
|
|
1863
|
+
*
|
|
1864
|
+
* ```
|
|
1865
|
+
*/
|
|
1866
|
+
number: (...args: [] | [{
|
|
1867
|
+
minValue?: number;
|
|
1868
|
+
maxValue?: number;
|
|
1869
|
+
precision?: number;
|
|
1870
|
+
isUnique?: boolean;
|
|
1871
|
+
arraySize?: number;
|
|
1872
|
+
}]) => GenerateNumber;
|
|
1873
|
+
/**
|
|
1874
|
+
* generates integers within given range.
|
|
1875
|
+
* @param minValue - lower border of range.
|
|
1876
|
+
* @param maxValue - upper border of range.
|
|
1877
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
1878
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
1879
|
+
*
|
|
1880
|
+
* @example
|
|
1881
|
+
* ```ts
|
|
1882
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
1883
|
+
* products: {
|
|
1884
|
+
* columns: {
|
|
1885
|
+
* unitsInStock: funcs.number({ minValue: 0, maxValue: 100, isUnique: false }),
|
|
1886
|
+
* },
|
|
1887
|
+
* },
|
|
1888
|
+
* }));
|
|
1889
|
+
*
|
|
1890
|
+
* ```
|
|
1891
|
+
*/
|
|
1892
|
+
int: (...args: [] | [{
|
|
1893
|
+
minValue?: number | bigint;
|
|
1894
|
+
maxValue?: number | bigint;
|
|
1895
|
+
isUnique?: boolean;
|
|
1896
|
+
arraySize?: number;
|
|
1897
|
+
}]) => GenerateInt;
|
|
1898
|
+
/**
|
|
1899
|
+
* generates boolean values(true or false)
|
|
1900
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
1901
|
+
*
|
|
1902
|
+
* @example
|
|
1903
|
+
* ```ts
|
|
1904
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
1905
|
+
* users: {
|
|
1906
|
+
* columns: {
|
|
1907
|
+
* isAvailable: funcs.boolean()
|
|
1908
|
+
* },
|
|
1909
|
+
* },
|
|
1910
|
+
* }));
|
|
1911
|
+
*
|
|
1912
|
+
* ```
|
|
1913
|
+
*/
|
|
1914
|
+
boolean: (...args: [] | [{
|
|
1915
|
+
arraySize?: number;
|
|
1916
|
+
}]) => GenerateBoolean;
|
|
1917
|
+
/**
|
|
1918
|
+
* generates date within given range.
|
|
1919
|
+
* @param minDate - lower border of range.
|
|
1920
|
+
* @param maxDate - upper border of range.
|
|
1921
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
1922
|
+
*
|
|
1923
|
+
* @example
|
|
1924
|
+
* ```ts
|
|
1925
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
1926
|
+
* users: {
|
|
1927
|
+
* columns: {
|
|
1928
|
+
* birthDate: funcs.date({ minDate: "1990-01-01", maxDate: "2010-12-31" })
|
|
1929
|
+
* },
|
|
1930
|
+
* },
|
|
1931
|
+
* }));
|
|
1932
|
+
*
|
|
1933
|
+
* ```
|
|
1934
|
+
*/
|
|
1935
|
+
date: (...args: [] | [{
|
|
1936
|
+
minDate?: string | Date;
|
|
1937
|
+
maxDate?: string | Date;
|
|
1938
|
+
arraySize?: number;
|
|
1939
|
+
}]) => GenerateDate;
|
|
1940
|
+
/**
|
|
1941
|
+
* generates time in 24 hours style.
|
|
1942
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
1943
|
+
*
|
|
1944
|
+
* @example
|
|
1945
|
+
* ```ts
|
|
1946
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
1947
|
+
* users: {
|
|
1948
|
+
* columns: {
|
|
1949
|
+
* birthTime: funcs.time()
|
|
1950
|
+
* },
|
|
1951
|
+
* },
|
|
1952
|
+
* }));
|
|
1953
|
+
*
|
|
1954
|
+
* ```
|
|
1955
|
+
*/
|
|
1956
|
+
time: (...args: [] | [{
|
|
1957
|
+
arraySize?: number;
|
|
1958
|
+
}]) => GenerateTime;
|
|
1959
|
+
/**
|
|
1960
|
+
* generates timestamps.
|
|
1961
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
1962
|
+
*
|
|
1963
|
+
* @example
|
|
1964
|
+
* ```ts
|
|
1965
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
1966
|
+
* orders: {
|
|
1967
|
+
* columns: {
|
|
1968
|
+
* shippedDate: funcs.timestamp()
|
|
1969
|
+
* },
|
|
1970
|
+
* },
|
|
1971
|
+
* }));
|
|
1972
|
+
*
|
|
1973
|
+
* ```
|
|
1974
|
+
*/
|
|
1975
|
+
timestamp: (...args: [] | [{
|
|
1976
|
+
arraySize?: number;
|
|
1977
|
+
}]) => GenerateTimestamp;
|
|
1978
|
+
/**
|
|
1979
|
+
* generates datetime objects.
|
|
1980
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
1981
|
+
*
|
|
1982
|
+
* @example
|
|
1983
|
+
* ```ts
|
|
1984
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
1985
|
+
* orders: {
|
|
1986
|
+
* columns: {
|
|
1987
|
+
* shippedDate: funcs.datetime()
|
|
1988
|
+
* },
|
|
1989
|
+
* },
|
|
1990
|
+
* }));
|
|
1991
|
+
*
|
|
1992
|
+
* ```
|
|
1993
|
+
*/
|
|
1994
|
+
datetime: (...args: [] | [{
|
|
1995
|
+
arraySize?: number;
|
|
1996
|
+
}]) => GenerateDatetime;
|
|
1997
|
+
/**
|
|
1998
|
+
* generates years.
|
|
1999
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2000
|
+
*
|
|
2001
|
+
* @example
|
|
2002
|
+
* ```ts
|
|
2003
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2004
|
+
* users: {
|
|
2005
|
+
* columns: {
|
|
2006
|
+
* birthYear: funcs.year()
|
|
2007
|
+
* },
|
|
2008
|
+
* },
|
|
2009
|
+
* }));
|
|
2010
|
+
*
|
|
2011
|
+
* ```
|
|
2012
|
+
*/
|
|
2013
|
+
year: (...args: [] | [{
|
|
2014
|
+
arraySize?: number;
|
|
2015
|
+
}]) => GenerateYear;
|
|
2016
|
+
/**
|
|
2017
|
+
* generates json objects with fixed structure.
|
|
2018
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2019
|
+
*
|
|
2020
|
+
* json structure can equal this:
|
|
2021
|
+
* ```
|
|
2022
|
+
* {
|
|
2023
|
+
* email,
|
|
2024
|
+
* name,
|
|
2025
|
+
* isGraduated,
|
|
2026
|
+
* hasJob,
|
|
2027
|
+
* salary,
|
|
2028
|
+
* startedWorking,
|
|
2029
|
+
* visitedCountries,
|
|
2030
|
+
* }
|
|
2031
|
+
* ```
|
|
2032
|
+
* or this
|
|
2033
|
+
* ```
|
|
2034
|
+
* {
|
|
2035
|
+
* email,
|
|
2036
|
+
* name,
|
|
2037
|
+
* isGraduated,
|
|
2038
|
+
* hasJob,
|
|
2039
|
+
* visitedCountries,
|
|
2040
|
+
* }
|
|
2041
|
+
* ```
|
|
2042
|
+
*
|
|
2043
|
+
* @example
|
|
2044
|
+
* ```ts
|
|
2045
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2046
|
+
* users: {
|
|
2047
|
+
* columns: {
|
|
2048
|
+
* metadata: funcs.json()
|
|
2049
|
+
* },
|
|
2050
|
+
* },
|
|
2051
|
+
* }));
|
|
2052
|
+
* ```
|
|
2053
|
+
*/
|
|
2054
|
+
json: (...args: [] | [{
|
|
2055
|
+
arraySize?: number;
|
|
2056
|
+
}]) => GenerateJson;
|
|
2057
|
+
/**
|
|
2058
|
+
* generates time intervals.
|
|
2059
|
+
*
|
|
2060
|
+
* interval example: "1 years 12 days 5 minutes"
|
|
2061
|
+
*
|
|
2062
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2063
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2064
|
+
* @param fields - range of values you want to see in your intervals.
|
|
2065
|
+
* @example
|
|
2066
|
+
* ```ts
|
|
2067
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2068
|
+
* users: {
|
|
2069
|
+
* columns: {
|
|
2070
|
+
* timeSpentOnWebsite: funcs.interval()
|
|
2071
|
+
* },
|
|
2072
|
+
* },
|
|
2073
|
+
* }));
|
|
2074
|
+
* ```
|
|
2075
|
+
*/
|
|
2076
|
+
interval: (...args: [] | [{
|
|
2077
|
+
fields?: "year" | "month" | "day" | "hour" | "minute" | "second" | "year to month" | "day to hour" | "day to minute" | "day to second" | "hour to minute" | "hour to second" | "minute to second";
|
|
2078
|
+
isUnique?: boolean;
|
|
2079
|
+
arraySize?: number;
|
|
2080
|
+
}]) => GenerateInterval;
|
|
2081
|
+
/**
|
|
2082
|
+
* generates random strings.
|
|
2083
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2084
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2085
|
+
*
|
|
2086
|
+
* @example
|
|
2087
|
+
* ```ts
|
|
2088
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2089
|
+
* users: {
|
|
2090
|
+
* columns: {
|
|
2091
|
+
* hashedPassword: funcs.string({isUnique: false})
|
|
2092
|
+
* },
|
|
2093
|
+
* },
|
|
2094
|
+
* }));
|
|
2095
|
+
* ```
|
|
2096
|
+
*/
|
|
2097
|
+
string: (...args: [] | [{
|
|
2098
|
+
isUnique?: boolean;
|
|
2099
|
+
arraySize?: number;
|
|
2100
|
+
}]) => GenerateString;
|
|
2101
|
+
/**
|
|
2102
|
+
* generates v4 UUID strings if arraySize is not specified, or v4 UUID 1D arrays if it is.
|
|
2103
|
+
*
|
|
2104
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2105
|
+
*
|
|
2106
|
+
* @example
|
|
2107
|
+
* ```ts
|
|
2108
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2109
|
+
* users: {
|
|
2110
|
+
* columns: {
|
|
2111
|
+
* uuid: funcs.uuid({
|
|
2112
|
+
* arraySize: 4
|
|
2113
|
+
* })
|
|
2114
|
+
* },
|
|
2115
|
+
* },
|
|
2116
|
+
* }));
|
|
2117
|
+
* ```
|
|
2118
|
+
*/
|
|
2119
|
+
uuid: (...args: [] | [{
|
|
2120
|
+
arraySize?: number;
|
|
2121
|
+
}]) => GenerateUUID;
|
|
2122
|
+
/**
|
|
2123
|
+
* generates person's first names.
|
|
2124
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2125
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2126
|
+
*
|
|
2127
|
+
* @example
|
|
2128
|
+
* ```ts
|
|
2129
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2130
|
+
* users: {
|
|
2131
|
+
* columns: {
|
|
2132
|
+
* firstName: funcs.firstName({isUnique: true})
|
|
2133
|
+
* },
|
|
2134
|
+
* },
|
|
2135
|
+
* }));
|
|
2136
|
+
* ```
|
|
2137
|
+
*/
|
|
2138
|
+
firstName: (...args: [] | [{
|
|
2139
|
+
isUnique?: boolean;
|
|
2140
|
+
arraySize?: number;
|
|
2141
|
+
}]) => GenerateFirstName;
|
|
2142
|
+
/**
|
|
2143
|
+
* generates person's last names.
|
|
2144
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2145
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2146
|
+
*
|
|
2147
|
+
* @example
|
|
2148
|
+
* ```ts
|
|
2149
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2150
|
+
* users: {
|
|
2151
|
+
* columns: {
|
|
2152
|
+
* lastName: funcs.lastName({isUnique: false})
|
|
2153
|
+
* },
|
|
2154
|
+
* },
|
|
2155
|
+
* }));
|
|
2156
|
+
* ```
|
|
2157
|
+
*/
|
|
2158
|
+
lastName: (...args: [] | [{
|
|
2159
|
+
isUnique?: boolean;
|
|
2160
|
+
arraySize?: number;
|
|
2161
|
+
}]) => GenerateLastName;
|
|
2162
|
+
/**
|
|
2163
|
+
* generates person's full names.
|
|
2164
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2165
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2166
|
+
*
|
|
2167
|
+
* @example
|
|
2168
|
+
* ```ts
|
|
2169
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2170
|
+
* users: {
|
|
2171
|
+
* columns: {
|
|
2172
|
+
* fullName: funcs.fullName({isUnique: true})
|
|
2173
|
+
* },
|
|
2174
|
+
* },
|
|
2175
|
+
* }));
|
|
2176
|
+
* ```
|
|
2177
|
+
*/
|
|
2178
|
+
fullName: (...args: [] | [{
|
|
2179
|
+
isUnique?: boolean;
|
|
2180
|
+
arraySize?: number;
|
|
2181
|
+
}]) => GenerateFullName;
|
|
2182
|
+
/**
|
|
2183
|
+
* generates unique emails.
|
|
2184
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2185
|
+
*
|
|
2186
|
+
* @example
|
|
2187
|
+
* ```ts
|
|
2188
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2189
|
+
* users: {
|
|
2190
|
+
* columns: {
|
|
2191
|
+
* email: funcs.email()
|
|
2192
|
+
* },
|
|
2193
|
+
* },
|
|
2194
|
+
* }));
|
|
2195
|
+
* ```
|
|
2196
|
+
*/
|
|
2197
|
+
email: (...args: [] | [{
|
|
2198
|
+
arraySize?: number;
|
|
2199
|
+
}]) => GenerateEmail;
|
|
2200
|
+
/**
|
|
2201
|
+
* generates unique phone numbers.
|
|
2202
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2203
|
+
*
|
|
2204
|
+
* @param template - phone number template, where all '#' symbols will be substituted with generated digits.
|
|
2205
|
+
* @param prefixes - array of any string you want to be your phone number prefixes.(not compatible with template property)
|
|
2206
|
+
* @param generatedDigitsNumbers - number of digits that will be added at the end of prefixes.(not compatible with template property)
|
|
2207
|
+
* @example
|
|
2208
|
+
* ```ts
|
|
2209
|
+
* //generate phone number using template property
|
|
2210
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2211
|
+
* users: {
|
|
2212
|
+
* columns: {
|
|
2213
|
+
* phoneNumber: funcs.phoneNumber({template: "+(380) ###-####"})
|
|
2214
|
+
* },
|
|
2215
|
+
* },
|
|
2216
|
+
* }));
|
|
2217
|
+
*
|
|
2218
|
+
* //generate phone number using prefixes and generatedDigitsNumbers properties
|
|
2219
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2220
|
+
* users: {
|
|
2221
|
+
* columns: {
|
|
2222
|
+
* phoneNumber: funcs.phoneNumber({prefixes: [ "+380 99", "+380 67" ], generatedDigitsNumbers: 7})
|
|
2223
|
+
* },
|
|
2224
|
+
* },
|
|
2225
|
+
* }));
|
|
2226
|
+
*
|
|
2227
|
+
* //generate phone number using prefixes and generatedDigitsNumbers properties but with different generatedDigitsNumbers for prefixes
|
|
2228
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2229
|
+
* users: {
|
|
2230
|
+
* columns: {
|
|
2231
|
+
* phoneNumber: funcs.phoneNumber({prefixes: [ "+380 99", "+380 67", "+1" ], generatedDigitsNumbers: [7, 7, 10]})
|
|
2232
|
+
* },
|
|
2233
|
+
* },
|
|
2234
|
+
* }));
|
|
2235
|
+
*
|
|
2236
|
+
* ```
|
|
2237
|
+
*/
|
|
2238
|
+
phoneNumber: (...args: [] | [import("./Generators.js").GeneratePhoneNumberT]) => GeneratePhoneNumber;
|
|
2239
|
+
/**
|
|
2240
|
+
* generates country's names.
|
|
2241
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2242
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2243
|
+
*
|
|
2244
|
+
* @example
|
|
2245
|
+
* ```ts
|
|
2246
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2247
|
+
* users: {
|
|
2248
|
+
* columns: {
|
|
2249
|
+
* country: funcs.country({isUnique: false})
|
|
2250
|
+
* },
|
|
2251
|
+
* },
|
|
2252
|
+
* }));
|
|
2253
|
+
* ```
|
|
2254
|
+
*/
|
|
2255
|
+
country: (...args: [] | [{
|
|
2256
|
+
isUnique?: boolean;
|
|
2257
|
+
arraySize?: number;
|
|
2258
|
+
}]) => GenerateCountry;
|
|
2259
|
+
/**
|
|
2260
|
+
* generates city's names.
|
|
2261
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2262
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2263
|
+
*
|
|
2264
|
+
* @example
|
|
2265
|
+
* ```ts
|
|
2266
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2267
|
+
* users: {
|
|
2268
|
+
* columns: {
|
|
2269
|
+
* city: funcs.city({isUnique: false})
|
|
2270
|
+
* },
|
|
2271
|
+
* },
|
|
2272
|
+
* }));
|
|
2273
|
+
* ```
|
|
2274
|
+
*/
|
|
2275
|
+
city: (...args: [] | [{
|
|
2276
|
+
isUnique?: boolean;
|
|
2277
|
+
arraySize?: number;
|
|
2278
|
+
}]) => GenerateCity;
|
|
2279
|
+
/**
|
|
2280
|
+
* generates street address.
|
|
2281
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2282
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2283
|
+
*
|
|
2284
|
+
* @example
|
|
2285
|
+
* ```ts
|
|
2286
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2287
|
+
* users: {
|
|
2288
|
+
* columns: {
|
|
2289
|
+
* streetAddress: funcs.streetAddress({isUnique: true})
|
|
2290
|
+
* },
|
|
2291
|
+
* },
|
|
2292
|
+
* }));
|
|
2293
|
+
* ```
|
|
2294
|
+
*/
|
|
2295
|
+
streetAddress: (...args: [] | [{
|
|
2296
|
+
isUnique?: boolean;
|
|
2297
|
+
arraySize?: number;
|
|
2298
|
+
}]) => GenerateStreetAddress;
|
|
2299
|
+
/**
|
|
2300
|
+
* generates job titles.
|
|
2301
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2302
|
+
*
|
|
2303
|
+
* @example
|
|
2304
|
+
* ```ts
|
|
2305
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2306
|
+
* users: {
|
|
2307
|
+
* columns: {
|
|
2308
|
+
* jobTitle: funcs.jobTitle()
|
|
2309
|
+
* },
|
|
2310
|
+
* },
|
|
2311
|
+
* }));
|
|
2312
|
+
* ```
|
|
2313
|
+
*/
|
|
2314
|
+
jobTitle: (...args: [] | [{
|
|
2315
|
+
arraySize?: number;
|
|
2316
|
+
}]) => GenerateJobTitle;
|
|
2317
|
+
/**
|
|
2318
|
+
* generates postal codes.
|
|
2319
|
+
*
|
|
2320
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2321
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2322
|
+
*
|
|
2323
|
+
* @example
|
|
2324
|
+
* ```ts
|
|
2325
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2326
|
+
* users: {
|
|
2327
|
+
* columns: {
|
|
2328
|
+
* postcode: funcs.postcode({isUnique: true})
|
|
2329
|
+
* },
|
|
2330
|
+
* },
|
|
2331
|
+
* }));
|
|
2332
|
+
* ```
|
|
2333
|
+
*/
|
|
2334
|
+
postcode: (...args: [] | [{
|
|
2335
|
+
isUnique?: boolean;
|
|
2336
|
+
arraySize?: number;
|
|
2337
|
+
}]) => GeneratePostcode;
|
|
2338
|
+
/**
|
|
2339
|
+
* generates states of America.
|
|
2340
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2341
|
+
*
|
|
2342
|
+
* @example
|
|
2343
|
+
* ```ts
|
|
2344
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2345
|
+
* users: {
|
|
2346
|
+
* columns: {
|
|
2347
|
+
* state: funcs.state()
|
|
2348
|
+
* },
|
|
2349
|
+
* },
|
|
2350
|
+
* }));
|
|
2351
|
+
* ```
|
|
2352
|
+
*/
|
|
2353
|
+
state: (...args: [] | [{
|
|
2354
|
+
arraySize?: number;
|
|
2355
|
+
}]) => GenerateState;
|
|
2356
|
+
/**
|
|
2357
|
+
* generates company's names.
|
|
2358
|
+
*
|
|
2359
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2360
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2361
|
+
*
|
|
2362
|
+
* @example
|
|
2363
|
+
* ```ts
|
|
2364
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2365
|
+
* users: {
|
|
2366
|
+
* columns: {
|
|
2367
|
+
* company: funcs.companyName({isUnique: true})
|
|
2368
|
+
* },
|
|
2369
|
+
* },
|
|
2370
|
+
* }));
|
|
2371
|
+
* ```
|
|
2372
|
+
*/
|
|
2373
|
+
companyName: (...args: [] | [{
|
|
2374
|
+
isUnique?: boolean;
|
|
2375
|
+
arraySize?: number;
|
|
2376
|
+
}]) => GenerateCompanyName;
|
|
2377
|
+
/**
|
|
2378
|
+
* generates 'lorem ipsum' text sentences.
|
|
2379
|
+
*
|
|
2380
|
+
* @param sentencesCount - number of sentences you want to generate as one generated value(string).
|
|
2381
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2382
|
+
*
|
|
2383
|
+
* @example
|
|
2384
|
+
* ```ts
|
|
2385
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2386
|
+
* posts: {
|
|
2387
|
+
* columns: {
|
|
2388
|
+
* content: funcs.loremIpsum({sentencesCount: 2})
|
|
2389
|
+
* },
|
|
2390
|
+
* },
|
|
2391
|
+
* }));
|
|
2392
|
+
* ```
|
|
2393
|
+
*/
|
|
2394
|
+
loremIpsum: (...args: [] | [{
|
|
2395
|
+
sentencesCount?: number;
|
|
2396
|
+
arraySize?: number;
|
|
2397
|
+
}]) => GenerateLoremIpsum;
|
|
2398
|
+
/**
|
|
2399
|
+
* generates 2D points within specified ranges for x and y coordinates.
|
|
2400
|
+
*
|
|
2401
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2402
|
+
* @param minXValue - lower bound of range for x coordinate.
|
|
2403
|
+
* @param maxXValue - upper bound of range for x coordinate.
|
|
2404
|
+
* @param minYValue - lower bound of range for y coordinate.
|
|
2405
|
+
* @param maxYValue - upper bound of range for y coordinate.
|
|
2406
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2407
|
+
*
|
|
2408
|
+
* @example
|
|
2409
|
+
* ```ts
|
|
2410
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2411
|
+
* triangles: {
|
|
2412
|
+
* columns: {
|
|
2413
|
+
* pointCoords: funcs.point({
|
|
2414
|
+
* isUnique: true,
|
|
2415
|
+
* minXValue: -5, maxXValue:20,
|
|
2416
|
+
* minYValue: 0, maxYValue: 30
|
|
2417
|
+
* })
|
|
2418
|
+
* },
|
|
2419
|
+
* },
|
|
2420
|
+
* }));
|
|
2421
|
+
* ```
|
|
2422
|
+
*/
|
|
2423
|
+
point: (...args: [] | [{
|
|
2424
|
+
isUnique?: boolean;
|
|
2425
|
+
minXValue?: number;
|
|
2426
|
+
maxXValue?: number;
|
|
2427
|
+
minYValue?: number;
|
|
2428
|
+
maxYValue?: number;
|
|
2429
|
+
arraySize?: number;
|
|
2430
|
+
}]) => GeneratePoint;
|
|
2431
|
+
/**
|
|
2432
|
+
* generates 2D lines within specified ranges for a, b and c parameters of line.
|
|
2433
|
+
*
|
|
2434
|
+
* ```
|
|
2435
|
+
* line equation: a*x + b*y + c = 0
|
|
2436
|
+
* ```
|
|
2437
|
+
*
|
|
2438
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2439
|
+
* @param minAValue - lower bound of range for a parameter.
|
|
2440
|
+
* @param maxAValue - upper bound of range for x parameter.
|
|
2441
|
+
* @param minBValue - lower bound of range for y parameter.
|
|
2442
|
+
* @param maxBValue - upper bound of range for y parameter.
|
|
2443
|
+
* @param minCValue - lower bound of range for y parameter.
|
|
2444
|
+
* @param maxCValue - upper bound of range for y parameter.
|
|
2445
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
2446
|
+
*
|
|
2447
|
+
* @example
|
|
2448
|
+
* ```ts
|
|
2449
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2450
|
+
* lines: {
|
|
2451
|
+
* columns: {
|
|
2452
|
+
* lineParams: funcs.point({
|
|
2453
|
+
* isUnique: true,
|
|
2454
|
+
* minAValue: -5, maxAValue:20,
|
|
2455
|
+
* minBValue: 0, maxBValue: 30,
|
|
2456
|
+
* minCValue: 0, maxCValue: 10
|
|
2457
|
+
* })
|
|
2458
|
+
* },
|
|
2459
|
+
* },
|
|
2460
|
+
* }));
|
|
2461
|
+
* ```
|
|
2462
|
+
*/
|
|
2463
|
+
line: (...args: [] | [{
|
|
2464
|
+
isUnique?: boolean;
|
|
2465
|
+
minAValue?: number;
|
|
2466
|
+
maxAValue?: number;
|
|
2467
|
+
minBValue?: number;
|
|
2468
|
+
maxBValue?: number;
|
|
2469
|
+
minCValue?: number;
|
|
2470
|
+
maxCValue?: number;
|
|
2471
|
+
arraySize?: number;
|
|
2472
|
+
}]) => GenerateLine;
|
|
2473
|
+
/**
|
|
2474
|
+
* gives you the opportunity to call different generators with different probabilities to generate values for one column.
|
|
2475
|
+
* @param params - array of generators with probabilities you would like to call them to generate values.
|
|
2476
|
+
*
|
|
2477
|
+
* @example
|
|
2478
|
+
* ```ts
|
|
2479
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
2480
|
+
* posts: {
|
|
2481
|
+
* columns: {
|
|
2482
|
+
* content: funcs.weightedRandom([
|
|
2483
|
+
* {
|
|
2484
|
+
* weight: 0.6,
|
|
2485
|
+
* value: funcs.loremIpsum({ sentencesCount: 3 }),
|
|
2486
|
+
* },
|
|
2487
|
+
* {
|
|
2488
|
+
* weight: 0.4,
|
|
2489
|
+
* value: funcs.default({ defaultValue: "TODO" }),
|
|
2490
|
+
* },
|
|
2491
|
+
* ]),
|
|
2492
|
+
* },
|
|
2493
|
+
* },
|
|
2494
|
+
* }));
|
|
2495
|
+
* ```
|
|
2496
|
+
*/
|
|
2497
|
+
weightedRandom: (args_0: {
|
|
2498
|
+
weight: number;
|
|
2499
|
+
value: AbstractGenerator<any>;
|
|
2500
|
+
}[]) => WeightedRandomGenerator;
|
|
2501
|
+
/**
|
|
2502
|
+
* generates bit strings based on specified parameters
|
|
2503
|
+
*
|
|
2504
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2505
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
2506
|
+
* @param dimensions - desired length of each bit string (e.g., `dimensions = 3` produces values like `'010'`).
|
|
2507
|
+
*
|
|
2508
|
+
* Defaults to the value of the database column bit-length.
|
|
2509
|
+
*
|
|
2510
|
+
* @example
|
|
2511
|
+
* ```ts
|
|
2512
|
+
* await seed(db, { bitStringTable: schema.bitStringTable }).refine((funcs) => ({
|
|
2513
|
+
* bitStringTable: {
|
|
2514
|
+
* count,
|
|
2515
|
+
* columns: {
|
|
2516
|
+
* bit: funcs.bitString({
|
|
2517
|
+
* dimensions: 12,
|
|
2518
|
+
* isUnique: true
|
|
2519
|
+
* }),
|
|
2520
|
+
* },
|
|
2521
|
+
* },
|
|
2522
|
+
* }));
|
|
2523
|
+
* ```
|
|
2524
|
+
*/
|
|
2525
|
+
bitString: (...args: [] | [{
|
|
2526
|
+
dimensions?: number;
|
|
2527
|
+
isUnique?: boolean;
|
|
2528
|
+
arraySize?: number;
|
|
2529
|
+
}]) => GenerateBitString;
|
|
2530
|
+
/**
|
|
2531
|
+
* generates ip addresses based on specified parameters
|
|
2532
|
+
*
|
|
2533
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2534
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
2535
|
+
* @param ipAddress - type of IP address to generate — either "ipv4" or "ipv6".
|
|
2536
|
+
*
|
|
2537
|
+
* Defaults to `'ipv4'`.
|
|
2538
|
+
* @param includeCidr - determines whether generated IPs include a CIDR suffix.
|
|
2539
|
+
*
|
|
2540
|
+
* Defaults to `true`.
|
|
2541
|
+
*
|
|
2542
|
+
* @example
|
|
2543
|
+
* ```ts
|
|
2544
|
+
* await seed(db, { inetTable: schema.inetTable }).refine((funcs) => ({
|
|
2545
|
+
* inetTable: {
|
|
2546
|
+
* count,
|
|
2547
|
+
* columns: {
|
|
2548
|
+
* inet: funcs.inet({
|
|
2549
|
+
* ipAddress: 'ipv4',
|
|
2550
|
+
* includeCidr: true,
|
|
2551
|
+
* isUnique: true
|
|
2552
|
+
* }),
|
|
2553
|
+
* },
|
|
2554
|
+
* },
|
|
2555
|
+
* }));
|
|
2556
|
+
* ```
|
|
2557
|
+
*/
|
|
2558
|
+
inet: (...args: [] | [{
|
|
2559
|
+
ipAddress?: "ipv4" | "ipv6";
|
|
2560
|
+
includeCidr?: boolean;
|
|
2561
|
+
isUnique?: boolean;
|
|
2562
|
+
arraySize?: number;
|
|
2563
|
+
}]) => GenerateInet;
|
|
2564
|
+
/**
|
|
2565
|
+
* generates PostGIS geometry objects based on the given parameters.
|
|
2566
|
+
*
|
|
2567
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2568
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
2569
|
+
* @param type - geometry type to generate; currently only `'point'` is supported.
|
|
2570
|
+
*
|
|
2571
|
+
* Defaults to `'point'`.
|
|
2572
|
+
* @param srid - Spatial Reference System Identifier: determines what type of point will be generated - either `4326` or `3857`.
|
|
2573
|
+
*
|
|
2574
|
+
* Defaults to `4326`.
|
|
2575
|
+
* @param decimalPlaces - number of decimal places for points when `srid` is `4326` (e.g., `decimalPlaces = 3` produces values like `'point(30.723 46.482)'`).
|
|
2576
|
+
*
|
|
2577
|
+
* Defaults to `6`.
|
|
2578
|
+
*
|
|
2579
|
+
* @example
|
|
2580
|
+
* ```ts
|
|
2581
|
+
* await seed(db, { geometryTable: schema.geometryTable }).refine((funcs) => ({
|
|
2582
|
+
* geometryTable: {
|
|
2583
|
+
* count,
|
|
2584
|
+
* columns: {
|
|
2585
|
+
* geometryPointTuple: funcs.geometry({
|
|
2586
|
+
* type: 'point',
|
|
2587
|
+
* srid: 4326,
|
|
2588
|
+
* decimalPlaces: 5,
|
|
2589
|
+
* isUnique: true
|
|
2590
|
+
* })
|
|
2591
|
+
* },
|
|
2592
|
+
* },
|
|
2593
|
+
* }));
|
|
2594
|
+
* ```
|
|
2595
|
+
*/
|
|
2596
|
+
geometry: (...args: [] | [{
|
|
2597
|
+
type?: "point";
|
|
2598
|
+
srid?: 4326 | 3857;
|
|
2599
|
+
decimalPlaces?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
2600
|
+
isUnique?: boolean;
|
|
2601
|
+
arraySize?: number;
|
|
2602
|
+
}]) => GenerateGeometry;
|
|
2603
|
+
/**
|
|
2604
|
+
* generates vectors based on the provided parameters.
|
|
2605
|
+
*
|
|
2606
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2607
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
2608
|
+
* @param decimalPlaces - number of decimal places for each vector element (e.g., `decimalPlaces = 3` produces values like `1.123`).
|
|
2609
|
+
*
|
|
2610
|
+
* Defaults to `2`.
|
|
2611
|
+
* @param dimensions - number of elements in each generated vector (e.g., `dimensions = 3` produces values like `[1,2,3]`).
|
|
2612
|
+
*
|
|
2613
|
+
* Defaults to the value of the database column’s dimensions.
|
|
2614
|
+
* @param minValue - minimum allowed value for each vector element.
|
|
2615
|
+
*
|
|
2616
|
+
* Defaults to `-1000`.
|
|
2617
|
+
* @param maxValue - maximum allowed value for each vector element.
|
|
2618
|
+
*
|
|
2619
|
+
* Defaults to `1000`.
|
|
2620
|
+
*
|
|
2621
|
+
* @example
|
|
2622
|
+
* ```ts
|
|
2623
|
+
* await seed(db, { vectorTable: schema.vectorTable }).refine((funcs) => ({
|
|
2624
|
+
* vectorTable: {
|
|
2625
|
+
* count,
|
|
2626
|
+
* columns: {
|
|
2627
|
+
* vector: funcs.vector({
|
|
2628
|
+
* decimalPlaces: 5,
|
|
2629
|
+
* dimensions: 12,
|
|
2630
|
+
* minValue: -100,
|
|
2631
|
+
* maxValue: 100,
|
|
2632
|
+
* isUnique: true
|
|
2633
|
+
* }),
|
|
2634
|
+
* },
|
|
2635
|
+
* },
|
|
2636
|
+
* }));
|
|
2637
|
+
* ```
|
|
2638
|
+
*/
|
|
2639
|
+
vector: (...args: [] | [{
|
|
2640
|
+
dimensions?: number;
|
|
2641
|
+
minValue?: number;
|
|
2642
|
+
maxValue?: number;
|
|
2643
|
+
decimalPlaces?: number;
|
|
2644
|
+
isUnique?: boolean;
|
|
2645
|
+
arraySize?: number;
|
|
2646
|
+
}]) => GenerateVector;
|
|
2647
|
+
};
|
|
1766
2648
|
export declare const generatorsMap: {
|
|
2649
|
+
readonly GenerateHashFromString: readonly [typeof GenerateHashFromString, typeof GenerateHashFromStringV3];
|
|
1767
2650
|
readonly HollowGenerator: readonly [typeof HollowGenerator];
|
|
1768
2651
|
readonly GenerateDefault: readonly [typeof GenerateDefault];
|
|
1769
2652
|
readonly GenerateValuesFromArray: readonly [typeof GenerateValuesFromArray];
|