github.com/gogf/gf/v2@v2.7.4/os/gmetric/gmetric_noop_counter_performer.go (about) 1 // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/gogf/gf. 6 7 package gmetric 8 9 import "context" 10 11 // noopCounterPerformer is an implementer for interface CounterPerformer with no truly operations. 12 type noopCounterPerformer struct{} 13 14 // newNoopCounterPerformer creates and returns a CounterPerformer with no truly operations. 15 func newNoopCounterPerformer() CounterPerformer { 16 return noopCounterPerformer{} 17 } 18 19 // Inc increments the counter by 1. 20 func (noopCounterPerformer) Inc(ctx context.Context, option ...Option) {} 21 22 // Add adds the given value to the counter. It panics if the value is < 0. 23 func (noopCounterPerformer) Add(ctx context.Context, increment float64, option ...Option) {}