mirror of
https://github.com/ash-project/ash.git
synced 2024-09-19 13:03:02 +12:00
simplify language
This commit is contained in:
parent
3e53310cc7
commit
f9111a5f5c
1 changed files with 10 additions and 9 deletions
|
@ -49,12 +49,13 @@ defmodule Ash.Resource do
|
|||
In general an entity will refer to a single data concept and use a `Data Layer`, which allow them to be persisted and manipulated via Ash.
|
||||
|
||||
| Data Layer | Use Case |
|
||||
| --- | ----------- |
|
||||
| Postgres | Database tables (think "Posts" or "Authors" or "Tweets") |
|
||||
| Postgres | Database views (think of a SQL statistic for a dashboard such as Tweets Per Hour by Country) |
|
||||
| :--- | :--- |
|
||||
| Postgres | Database tables ("Posts" or "Authors" or "Tweets") |
|
||||
| Postgres | Database views (SQL statistic such as Tweets Per Hour by Country) |
|
||||
| ETS | _________???________ |
|
||||
| File | Imagine a large json file of thousands of cities with metadata |
|
||||
| External | Other APIs such as 3rd party services or for systems where a Phoenix API is merely a "front end" of the _real_ backend... |
|
||||
| External | 3rd Party APIs such as Stripe |
|
||||
| External | Other systems where a Phoenix API is merely a "front end" of the _real_ backend... |
|
||||
|
||||
There will, however, be entities that are _not_ backed by data. These could be for concepts such as User Registration or _________???________.
|
||||
|
||||
|
@ -63,10 +64,10 @@ defmodule Ash.Resource do
|
|||
Once a resource is declared, it will expose a public, standardized API that can be consumed in many different forms.
|
||||
|
||||
| Consumer | Use Case |
|
||||
| --- | ----------- |
|
||||
| Business Logic | Work with your data anywhere on custom server side code such as from Phoenix Contexts |
|
||||
| Web Request Layer | Full JSON:API and GraphQL web layer compliance via AshJsonApi and AshGraphQl |
|
||||
| Front End Apps | UIs (think Single Page Apps) can take a autogenerated schema file based on your resources and know exactly how to interact with full compliance with your web layer API |
|
||||
| :--- | :--- |
|
||||
| Business Logic | Server side code such as from Phoenix Contexts |
|
||||
| Web Layer | Full JSON:API and GraphQL web layer compliance via AshJsonApi and AshGraphQl |
|
||||
| Front Ends | UIs can use a schema file to know exactly how to interact web layer API |
|
||||
|
||||
In your typical application using Ash, resources would be located in the `lib/resources` directory. The file name should be the single underscored name of the data that backs the resource with a `.ex` extension (ie: `lib/resoruces/post.ex`).
|
||||
|
||||
|
@ -74,7 +75,7 @@ defmodule Ash.Resource do
|
|||
documentation for the rest. The options for `use Ash.Resource` are described below.
|
||||
|
||||
For example, here is a resource definition using Postgres:
|
||||
```
|
||||
```elixir
|
||||
defmodule AshKetchum.Pokemon do
|
||||
use Ash.Resource, name: "pokemon", type: "pokemon"
|
||||
use AshPostgres, repo: AshKetchum.Repo
|
||||
|
|
Loading…
Reference in a new issue