dflourusso / expo-sqlite-orm

Expo SQLite ORM
132 stars 34 forks source link

Question: Does the lib handle json stringify internally ? #63

Closed angelxmoreno closed 11 months ago

angelxmoreno commented 11 months ago

I have the following:

import { ImageResponse } from '@App/types/Movie';
import { ColumnMapping, columnTypes } from 'expo-sqlite-orm';

export type MovieEntity = {
    id: number;
    title: string;
    posters: ImageResponse[];
};

export const movieColumMapping: ColumnMapping<MovieEntity> = {
    id: { type: columnTypes.INTEGER },
    title: { type: columnTypes.TEXT },
    posters: { type: columnTypes.JSON, default: () => '[]' },
};

I am curious to know if when I call save I need to do JSON.stringify() on data.posters or does the lib do this internally?

dflourusso commented 11 months ago

Hello, It will be done internally