-
Notifications
You must be signed in to change notification settings - Fork 1
/
constellation_get_star_schema.R
67 lines (55 loc) · 1.2 KB
/
constellation_get_star_schema.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# get_star_schema -------------------------------------------------
#' Get star schema
#'
#' Get a star schema of a constellation given its name.
#'
#' @param ct A `constellation` object.
#' @param name A string, name of the star schema.
#'
#' @return A `dimension_table` object.
#'
#' @family incremental refresh functions
#'
#' @examples
#'
#' d <- ct_mrs |>
#' get_star_schema("mrs_age")
#'
#' @export
get_star_schema <- function(ct, name) {
UseMethod("get_star_schema")
}
#' @rdname get_star_schema
#' @export
get_star_schema.constellation <- function(ct, name) {
st <- NULL
if (name %in% names(ct$star)) {
st <- ct$star[[name]]
}
st
}
# get_star_schema_names -------------------------------------------
#' Get star schema names
#'
#' Get the names of the star schemas in a constellation.
#'
#' @param ct A `constellation` object.
#'
#' @return A vector of star schema names.
#'
#' @family incremental refresh functions
#'
#' @examples
#'
#' d <- ct_mrs |>
#' get_star_schema_names()
#'
#' @export
get_star_schema_names <- function(ct) {
UseMethod("get_star_schema_names")
}
#' @rdname get_star_schema_names
#' @export
get_star_schema_names.constellation <- function(ct) {
names(ct$star)
}