import { convert, column, columnPrimaryKey } from "@piying/orm/typeorm";
import * as v from 'valibot';
export const Account = v.pipe(
v.object({
id: v.pipe(v.string(), columnPrimaryKey({ generated: "uuid" })),
createdAt: v.pipe(v.date(), column({ createDate: true })),
updateAt: v.pipe(v.date(), column({ updateDate: true })),
username: v.pipe(v.string(), v.title("用户名"), column({ length: 50 })),
}),
);
const instance = convert(
{
Account,
},
{
dataSourceOptions: {
type: "better-sqlite3",
database: path.join(process.cwd(), ".tmp", "data.sqlite"),
synchronize: false,
logging: true,
},
},
);
await instance.dataSource.initialize();
result.object.Account;
-
Notifications
You must be signed in to change notification settings - Fork 0
License
piying-org/piying-orm
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|