forked from plandem/xlsx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
no_errors.go
36 lines (30 loc) · 836 Bytes
/
no_errors.go
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
// Copyright (c) 2017 Andrey Gayvoronsky <plandem@gmail.com>
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package rule
import (
"github.com/miscoler/xlsx/format/styles"
"github.com/miscoler/xlsx/internal/ml"
"github.com/miscoler/xlsx/internal/ml/primitives"
)
type noErrorsRule struct {
baseRule
}
//NoErrors is helper object to set specific options for rule
var NoErrors noErrorsRule
func (x noErrorsRule) initIfRequired(r *Info) {
if !r.initialized {
r.initialized = true
r.validator = NoErrors
r.rule = &ml.ConditionalRule{
Type: primitives.ConditionTypeNotContainsErrors,
Formula: []ml.Formula{`NOT(ISERROR(:cell:))`},
}
}
}
func (x noErrorsRule) Styles(s *styles.Info) Option {
return func(r *Info) {
x.initIfRequired(r)
r.style = s
}
}