Skip to content

Commit

Permalink
More on test/readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarasikee committed Aug 12, 2022
1 parent b68a777 commit 595ecad
Showing 1 changed file with 46 additions and 40 deletions.
86 changes: 46 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <b>TinyDB</b> comes in. <b>TinyDB</b> is a tiny, simple,
That's where <b>TinyDB</b> comes in. <b>TinyDB</b> 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.

Expand All @@ -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<string, unknown>

@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<string, unknown>

@Column({
type: "array",
allowNull: true,
default: [],
})
friends!: string[]
}
```

0 comments on commit 595ecad

Please sign in to comment.