Developer Tip 2: Code Converter

If your own project needs data model code, you can convert the table and column information defined in the schema directly into a data model class or entity code in the programming language you want, and bring it into your project. It supports 10 languages, including TypeScript, Python, and Java, and you can save the converted code to a file and apply it directly to your project.


Opening the Code converter

Click the Editor tab at the top of the schema screen, then select CODE Converter on the left.

Code converter

Selecting a programming language

Select the programming language to use. Once selected, code converted into that language is shown on the right.

Checking the conversion result

Check the converted code. Below are conversion examples for TypeScript and Nest.js.

TypeScript interface:

export interface UserProfile {
    userId: number;
    email: string;
    preferences?: any;
    isActive: boolean;
    createdAt: Date;
}

Nest.js entity:

@Entity({
  name: 'user_profile',
  schema: 'public',
})
export class UserProfile {
  @Index()
  @PrimaryGeneratedColumn({
    comment: 'Unique user ID',
    name: 'user_id',
    unsigned: true,
  })
  userId: number;

  @Index()
  @Column({ name: 'email', type: 'varchar', length: 255, unique: true })
  email: string;
}

Saving the code file

Use the Copy button at the top right of the code area to copy the code, or the Save button to save it as a file with the extension matching your selected language.

Supported programming languages

LanguageConversion format
PythonData modeling class
KotlinData model class
JavaJava classes and models
SwiftSwift data model
TypeScriptTypeScript interface
Nest.jsNest.js entity
C#C# classes and entities
GoGo struct
RustRust struct
PHPPHP classes and data models

Good to know

  • The converted code is generated based on the current state of the schema. You need to convert again after changing the schema for the changes to be reflected.
  • Naming conventions (camelCase, snake_case, etc.) are automatically applied per language.