From 595ecadde35cd0d2ae7fedfa1e4b066c74326ab8 Mon Sep 17 00:00:00 2001 From: Taras Date: Fri, 12 Aug 2022 23:50:25 +0200 Subject: [PATCH] More on test/readme update --- README.md | 86 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index ba9a28d..c285543 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,13 @@ Tiny, Powerful, Beautiful # Motivation -Let's say you want to build a small project that doesn't require a bulky +Let's say you want to build a small project that doesn't require a bulky relational database such as Postgres or MySQL. Instead, you want to use a simple, in-memory database that will cover your needs. -That's where TinyDB comes in. TinyDB is a tiny, simple, +That's where TinyDB comes in. TinyDB is a tiny, simple, and fast in-memory database that you can use to -store and retrieve data. It has all the features of a relational database, +store and retrieve data. It has all the features of a relational database, but it designed to be as lightweight and simple as possible. @@ -40,49 +40,55 @@ installing dependencies. Your entry point is ```@TinyTable``` decorator, where you pass table's name. -No need to remember ton of decorators. Simply start with ```@Column({})```, add a -small bunch of properties, +No need to remember ton of decorators. Simply start with ```@Column({})```, add a +small bunch of properties, and you are ready to go. In the example below you will see the best way to use create user with TinyDB. ```typescript @TinyTable("users") class User { - @Column({ - type: "string", - unique: true, - }) - name!: string - - @Column({ - type: "date", - allowNull: true, - }) - birthday!: string - - @Column({ - type: "boolean", - default: false, - allowNull: true, - }) - isAdmin!: boolean - - @Column({ - allowNull: true, - type: "json", - default: { - theme: 'light', - lang: 'en', - } - }) - settings!: Record - - @Column({ - type: "array", - allowNull: true, - default: [], - }) - friends!: string[] + @Column({ + type: "string", + unique: true, + }) + name!: string + + @Column({ + type: "string", + allowNull: false, + }) + password!: string + + @Column({ + type: "date", + allowNull: true, + }) + birthday!: string + + @Column({ + type: "boolean", + default: false, + allowNull: true, + }) + isAdmin!: boolean + + @Column({ + allowNull: true, + type: "json", + default: { + theme: 'light', + lang: 'en', + } + }) + settings!: Record + + @Column({ + type: "array", + allowNull: true, + default: [], + }) + friends!: string[] } ```