Skip to content

Commit

Permalink
feat: vectors RE from DDL
Browse files Browse the repository at this point in the history
  • Loading branch information
chulanovskyi-bs committed Dec 18, 2024
1 parent 93c7f18 commit 9f85064
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions reverse_engineering/helpers/getJsonSchema.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const _ = require('lodash');
const { isVector } = require('../../forward_engineering/ddlProvider/ddlHelpers/typeHelper');

const getJsonSchema = columns => {
const properties = columns.reduce((properties, column) => {
if (column.properties) {
Expand All @@ -10,6 +13,16 @@ const getJsonSchema = columns => {
};
}

if (isVector(column.type)) {
return {
...properties,
[column.name]: {
...column,
items: _.fill(Array(column.dimension), { type: 'number', mode: 'real' }),
},
};
}

return {
...properties,
[column.name]: column,
Expand Down

0 comments on commit 9f85064

Please sign in to comment.