0.2.4 • Published 7 months ago
@rattus-orm/pinia v0.2.4
Pinia data provider and helpers for Rattus ORM
Contents
- PiniaDataProvider;
- Composables:
useRattusContext,useRepository.
Installation
Use your favorite package manager. For example, yarn:
yarn add @rattus-orm/core @rattus-orm/piniaBasic usage
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { installRattusORM } from "@rattus-orm/pinia";
const pinia = createPinia()
const app = createApp({ /* your root component */ })
app
.use(pinia)
.use(installRattusORM())<template>
<p>{{ user.email }}</p>
<button type="button" @click="onClick">Update email</button>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { Model, Uid, Str } from '@rattus-orm/core'
import { useRepository } from '@rattus-orm/pinia'
class User extends Model {
public static entity = 'user'
@Uid()
public id: string
@Str()
public email: string
}
export default defineComponent({
setup() {
const { save, find } = useRepository(User)
save({ id: '1', email: 'test@test.com' })
const onClick = () => {
save({ id: '1', email: 'updated@test.com' })
}
const user = find('1')
return {
user,
onClick,
}
}
})
</script>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
7 months ago
0.2.2
1 year ago
0.2.1
1 year ago
0.2.0
1 year ago
0.1.3
2 years ago
0.1.2
2 years ago
0.1.1
2 years ago
0.0.11
2 years ago
0.1.0
2 years ago
0.0.10
2 years ago
0.0.9
2 years ago
0.0.8
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago