configs

package
v0.0.0-...-27ec096 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Copyright (c) 2023

@author 贺鹏Kavin 微信公众号:技术岁月 https://github.com/skyhackvip/risk_engine

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

@author 贺鹏Kavin 微信公众号:技术岁月 https://github.com/skyhackvip/risk_engine

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Index

Constants

View Source
const (
	CONSOLE  = "console"
	FILE     = "file"
	DB       = "db"
	PARALLEL = "parallel"
)

keywords for execute

View Source
const (
	GT         = "GT"
	LT         = "LT"
	GE         = "GE"
	LE         = "LE"
	EQ         = "EQ"
	NEQ        = "NEQ"
	BETWEEN    = "BETWEEN"
	LIKE       = "LIKE"
	IN         = "IN"
	CONTAIN    = "CONTAIN"
	BEFORE     = "BEFORE"
	AFTER      = "AFTER"
	KEYEXIST   = "KEYEXIST"
	VALUEEXIST = "VALUEEXIST"
	AND        = "and"
	OR         = "or"
)

all operators

View Source
const (
	START          = "start"
	END            = "end"
	RULESET        = "ruleset"
	ABTEST         = "abtest"
	CONDITIONAL    = "conditional"
	DECISIONTREE   = "tree"
	DECISIONMATRIX = "matrix"
	SCORECARD      = "scorecard"
)

all support node

View Source
const (
	MATRIXX = "matrixX"
	MATRIXY = "matrixY"
)

matrix

View Source
const (
	INT     = "int"
	FLOAT   = "float"
	STRING  = "string"
	BOOL    = "bool"
	DATE    = "date"
	ARRAY   = "array"
	MAP     = "map"
	DEFAULT = "default"
)

all type

View Source
const (
	DATE_FORMAT        = "2006-01-02"
	DATE_FORMAT_DETAIL = "2006-01-02 15:04:05"
)

date type

Variables

View Source
var ArraySupportOperator = map[string]struct{}{
	EQ:      struct{}{},
	NEQ:     struct{}{},
	CONTAIN: struct{}{},
	IN:      struct{}{},
}
View Source
var BoolSupportOperator = map[string]struct{}{
	EQ:  struct{}{},
	NEQ: struct{}{},
}
View Source
var BooleanOperators = map[string]string{
	AND: OperatorMap[AND],
	OR:  OperatorMap[OR],
}
View Source
var CompareOperators = map[string]struct{}{
	EQ:  struct{}{},
	NEQ: struct{}{},
	GT:  struct{}{},
	LT:  struct{}{},
	GE:  struct{}{},
	LE:  struct{}{},
}
View Source
var DateSupportOperator = map[string]struct{}{
	BEFORE:  struct{}{},
	AFTER:   struct{}{},
	EQ:      struct{}{},
	NEQ:     struct{}{},
	BETWEEN: struct{}{},
}
View Source
var DefaultSupportOperator = map[string]struct{}{
	EQ:  struct{}{},
	NEQ: struct{}{},
}
View Source
var EnumSupportOperator = map[string]struct{}{
	EQ:  struct{}{},
	NEQ: struct{}{},
}
View Source
var MapSupportOperator = map[string]struct{}{
	KEYEXIST:   struct{}{},
	VALUEEXIST: struct{}{},
}
View Source
var NumSupportOperator = map[string]struct{}{
	GT:      struct{}{},
	LT:      struct{}{},
	GE:      struct{}{},
	LE:      struct{}{},
	EQ:      struct{}{},
	NEQ:     struct{}{},
	BETWEEN: struct{}{},
	IN:      struct{}{},
}
View Source
var OperatorMap = map[string]string{
	GT:         ">",
	LT:         "<",
	GE:         ">=",
	LE:         "<=",
	EQ:         "==",
	NEQ:        "!=",
	BETWEEN:    "between",
	LIKE:       "like",
	IN:         "in",
	CONTAIN:    "contain",
	BEFORE:     "before",
	AFTER:      "after",
	KEYEXIST:   "keyexist",
	VALUEEXIST: "valueexist",
	AND:        "&&",
	OR:         "||",
}
View Source
var StringSupportOperator = map[string]struct{}{
	EQ:   struct{}{},
	NEQ:  struct{}{},
	LIKE: struct{}{},
	IN:   struct{}{},
}

Functions

This section is empty.

Types

type AppConf

type AppConf struct {
	LogMethod     string `yaml:"LogMethod"` //console,file
	LogPath       string `yaml:"LogPath"`
	DslLoadMethod string `yaml:"DslLoadMethod"` //file,db
	DslLoadPath   string `yaml:"DslLoadPath"`
}

type Conf

type Conf struct {
	Server ServerConf `yaml:"Server"`
	App    AppConf    `yaml:"App"`
}

func LoadConfig

func LoadConfig(path string) (*Conf, error)

type ServerConf

type ServerConf struct {
	Env          string        `yaml:"Env"`
	Port         int           `yaml:"Port"`
	ReadTimeout  time.Duration `yaml:"ReadTimeout"`
	WriteTimeout time.Duration `yaml:"WriteTimeout"`
}

type Strategy

type Strategy struct {
	Name     string `yaml:"name"`
	Priority int    `yaml:"priority"` //越大越优先
	Score    int    `yaml:"score"`    //策略分
}

策略

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL