View Source AppGen (app_gen v0.1.1)

AppGen

This tool generates various parts of our elixir applications to simplify our workflows.

generators

Generators

  • [x] Absinthe API & Tests
  • [x] Ecto Schema
  • [x] Ecto Context, Factories & Tests
  • [x] State Diff and Regeneration
  • [ ] Typespecs for all files
  • [ ] Phoenix Application++ (prometheus/sentry)
  • [ ] State Transitions
  • [ ] Logic Nodes
  • [ ] Logic Gateways

installation

Installation

Available in Hex, the package can be installed by adding app_gen to your list of dependencies in mix.exs:

def deps do
  [
    {:app_gen, "~> 0.1.0"}
  ]
end

The docs can be found at https://hexdocs.pm/app_gen.

example

Example

Checkout app_gen.exs for an example

available-mix-commands

Available Mix Commands

mix app_gen          # Lists help for app_gen commands
mix app_gen.api      # Utilizes all the config files and generates a GraphQL API
mix app_gen.context  # Creates a ecto context with functions from EctoShorts as well as tests
mix app_gen.resource # Used to create app_gen.exs files or to add new CRUD resources in
mix app_gen.schema   # Creates a ecto schema that has a factory
mix app_gen.phx.new  # Create a new phx project, replaces `mix phx.new`

Link to this section Summary

Link to this section Types

@type arg_opts() :: [
  required: [atom()],
  blacklist: [atom()],
  blacklist_non_required?: boolean(),
  relation_inputs: [atom()]
]
Link to this type

crud_from_schema_opts()

View Source
@type crud_from_schema_opts() :: [
  only: [AbsintheGenerator.CrudResource.crud_type()],
  except: [AbsintheGenerator.CrudResource.crud_type()],
  input_args: [
    create: arg_opts(),
    find: arg_opts(),
    all: arg_opts(),
    update: arg_opts(),
    delete: arg_opts(),
    find_and_update_or_create: arg_opts()
  ]
]
@type middleware_opts() :: [
  subscription: [module()],
  query: [module()],
  mutation: [module()],
  all: [module()]
]

Link to this section Functions

Link to this function

crud_from_schema(ecto_schema, opts \\ [])

View Source
Link to this function

post_middleware(middleware_opts)

View Source
Link to this function

pre_middleware(middleware_opts)

View Source
Link to this function

remove_relations(ecto_schema, relation_key)

View Source
Link to this function

repo_contexts(repo, contexts)

View Source