glitr/service

Types

pub type RouteService(base_type, upsert_type) {
  RouteService(
    root_path: List(String),
    base: Option(
      #(
        fn(base_type) -> json.Json,
        fn(dynamic.Dynamic) ->
          Result(base_type, List(dynamic.DecodeError)),
      ),
    ),
    upsert: Option(
      #(
        fn(upsert_type) -> json.Json,
        fn(dynamic.Dynamic) ->
          Result(upsert_type, List(dynamic.DecodeError)),
      ),
    ),
  )
}

Constructors

  • RouteService(
      root_path: List(String),
      base: Option(
        #(
          fn(base_type) -> json.Json,
          fn(dynamic.Dynamic) ->
            Result(base_type, List(dynamic.DecodeError)),
        ),
      ),
      upsert: Option(
        #(
          fn(upsert_type) -> json.Json,
          fn(dynamic.Dynamic) ->
            Result(upsert_type, List(dynamic.DecodeError)),
        ),
      ),
    )

Functions

pub fn create_route(
  service: RouteService(a, b),
) -> Result(Route(Nil, Nil, b, a), GlitrError)
pub fn delete_route(
  service: RouteService(a, b),
) -> Result(Route(String, Nil, Nil, String), GlitrError)
pub fn get_all_route(
  service: RouteService(a, b),
) -> Result(Route(Nil, Nil, Nil, List(a)), GlitrError)
pub fn get_route(
  service: RouteService(a, b),
) -> Result(Route(String, Nil, Nil, a), GlitrError)
pub fn new() -> RouteService(a, b)
pub fn update_route(
  service: RouteService(a, b),
) -> Result(Route(String, Nil, b, a), GlitrError)
pub fn with_base_type(
  service: RouteService(a, b),
  base_encoder: fn(c) -> Json,
  base_decoder: fn(Dynamic) -> Result(c, List(DecodeError)),
) -> RouteService(c, b)
pub fn with_root_path(
  service: RouteService(a, b),
  root_path: List(String),
) -> RouteService(a, b)
pub fn with_upsert_type(
  service: RouteService(a, b),
  upsert_encoder: fn(c) -> Json,
  upsert_decoder: fn(Dynamic) -> Result(c, List(DecodeError)),
) -> RouteService(a, c)
Search Document