How to create columns dynamically based on the codable object in sqlite

Hi. I have to develop a common SQLite related Create, Read, Update, Delete Operation function which is accessed throughout the project. I have used an open source SQLite.swift library to create and connect with the DB. But with that library I could only work with the DB by creating a separate Entity Class for each API call or Model. But the requirement is that I have to create a common function that is able to create and add column dynamically based on the response or model or codable object that gets passed into the function. Please recommend if there is any framework or resources is available for my requirement.

Hello @shankarmadeshvaran,

This forum is about Swift, the programming language. Questions about external libraries should go on Stack Overflow, or their dedicated support channel.

That being said, your sentence below is inaccurate:

But with that library I could only work with the DB by creating a separate Entity Class for each API call or Model.

Maybe the SQLite.swift tutorial you have been reading wants you to create Entity classes. But SQLite.swift itself does not. Please refer to its genuine documentation, so that you can make progress on your task.

For any further question, please continue on Stack Overflow or the support forum of your choice, thank you!

1 Like