Skip to content

revise add_value_object #14

@harell

Description

@harell

test case

GIVEN a domain (showroom), a value object name (car) and a data.frame (mtcars)

WHEN add_value_object(path = "./R, domain = "showroom", name = "car", fields = "mtcars") is called

THE a new file is created ./R/showroom-value-objects
AND a value object template for car is created with mtcars columns as input arguments and expected types.

value object template

#' @title Car Value Object
#' @param mpg ('numeric') ?
#' @param hp ('numeric') ?
#' @return (`Car`) Car Value Object
#' @export
#' @family, 
#' ... 
#' examples Car()
Car <- function(
  mpg = NA_real,
  hp = NA_real,
  cyl = NA_real
) return(
   tibble::tibble(mpg = as.numeric(mpg))
   |> tibble::add_column(hp = as.numeric(hp))
   |> tibble::add_column(cyl = as.numeric(cyl))
   |> dplyr::distinct()
   |> tidyr::drop_na()
)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions