Module sktmls.utils.filter

Classes

class FilterUtil

필터 로직관련 클래스 입니다.

Example

filter = filter_client.get_filter(id=10)

filter_util = FilterUtil()
filter_func = filter_util.generate_filter_applier_fn(filter)

data = {"key1": "good1", "key2": 3, "mbr_discount_amt_cum_bakery": "N", "gender": ["M", "F"]} # (필터를 적용할 Key-Value 값, contains의 경우 list값 필요)
filter_func(data)

Methods

def apply(self, data: Dict[str, Any], conditions: List[dict]) ‑> bool

필터 로직 적용 함수

Args

  • data: (dict) 필터를 적용할 Key-Value 값
  • conditions: (list(dict)) 필터 조건 리스트

Returns

bool - True : 필터 로직 통과 - False : 필터 로직 걸림

def generate_filter_applier_fn(self, filter: Filter) ‑> Callable[[dict], bool]

필터 로직을 적용하는 함수를 리턴하는 함수 (filter 디펜던시)

Args

  • filter: (Filter) 필터 객체

Returns

필터 로직 적용 함수