From 267a813e666e62f644df5930c19b378ab765b654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 4 Jul 2022 11:58:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E5=88=92=E8=BF=87=E6=BB=A4=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- filter.go | 30 ++++++++++++++++++++++++++++++ go.mod | 5 ++++- go.sum | 2 ++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 filter.go diff --git a/filter.go b/filter.go new file mode 100644 index 0000000..8f709a8 --- /dev/null +++ b/filter.go @@ -0,0 +1,30 @@ +// Package util ... +// +// Description : util ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2022-07-04 11:45 +package util + +// NewFilter 过滤器实例 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 11:54 2022/7/4 +func NewFilter(sourceData []byte, filterRule map[string]string) *filter { + return &filter{ + sourceData: sourceData, + filterRule: filterRule, + } +} + +// filter 数据过滤 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 11:58 2022/7/4 +type filter struct { + sourceData []byte + filterRule map[string]string +} diff --git a/go.mod b/go.mod index 5019803..09aa9bd 100644 --- a/go.mod +++ b/go.mod @@ -8,4 +8,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 ) -require github.com/go-ini/ini v1.66.6 // indirect +require ( + github.com/Jeffail/gabs v1.4.0 // indirect + github.com/go-ini/ini v1.66.6 // indirect +) diff --git a/go.sum b/go.sum index bfc81d1..3126559 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +github.com/Jeffail/gabs v1.4.0 h1://5fYRRTq1edjfIrQGvdkcd22pkYUrHZ5YC/H2GJVAo= +github.com/Jeffail/gabs v1.4.0/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/go-ini/ini v1.66.6 h1:h6k2Bb0HWS/BXXHCXj4QHjxPmlIU4NK+7MuLp9SD+4k= github.com/go-ini/ini v1.66.6/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=