0.2.4 • Published 8 months ago

@rattus-orm/svelte v0.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Svelte bindings for Rattus ORM

Contents

  1. <RattusProvier /> component;
  2. Hooks: useRattusContext, useRepository.

Installation

Use your favorite package manager. For example, yarn:

yarn add @rattus-orm/core @rattus-orm/svelte

Basic usage

<script>
  import { RattusProvider } from '@rattus-orm/svelte'
</script>

<RattusProvider>
  <!-- your components -->
</RattusProvider>
export class User extends Model {
    public static entity = 'user'
    
    @Uid()
    public id: string
    
    @Str()
    public email: string
}
<script>
  import { useRepository } from "@rattus-orm/svelte";
  import { User } from "./models/User";
  
  const userRepo = useRepository(User)
  const user = userRepo.find('1')

  setTimeout(() => {
    userRepo.save({ id: '1', email: 'test@test.com' })
  }, 1000)

</script>

<div>
  {#if $user}
    id: {$user.id}<br/>
    email: {$user.email}
  {/if}
</div>

Documentation

For detailed docs please read documentation website.

Contributing

Contributions are welcome! Please read our Contributing Guide for details on our code of conduct, and the process for submitting pull requests.

0.2.3

10 months ago

0.2.4

8 months ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago