github.com/artisanhe/tools@v1.0.1-0.20210607022958-19a8fef2eb04/catgo/cat-go/message/null.go (about)

     1  package message
     2  
     3  import (
     4  	"bytes"
     5  	"time"
     6  )
     7  
     8  type NullMessage struct {
     9  }
    10  
    11  type NullTransaction struct {
    12  	NullMessage
    13  }
    14  
    15  var nullMessage = &NullMessage{}
    16  
    17  func (m *NullMessage) Complete() {
    18  }
    19  
    20  func (m *NullMessage) GetType() string {
    21  	return ""
    22  }
    23  
    24  func (m *NullMessage) GetName() string {
    25  	return ""
    26  }
    27  
    28  func (m *NullMessage) GetStatus() string {
    29  	return ""
    30  }
    31  
    32  func (m *NullMessage) GetData() *bytes.Buffer {
    33  	return nil
    34  }
    35  
    36  func (m *NullMessage) GetTime() time.Time {
    37  	return time.Now()
    38  }
    39  
    40  func (m *NullMessage) SetTime(time time.Time) {
    41  }
    42  
    43  func (m *NullMessage) SetTimestamp(timestampMs int64) {
    44  }
    45  
    46  func (m *NullMessage) AddData(k string, v ...string) {
    47  }
    48  
    49  func (m *NullMessage) SetData(v string) {
    50  }
    51  
    52  func (m *NullMessage) SetStatus(status string) {
    53  }
    54  
    55  func (t *NullTransaction) GetChildren() []Messager {
    56  	return []Messager{}
    57  }
    58  
    59  func (t *NullTransaction) GetDuration() time.Duration {
    60  	return 0
    61  }
    62  
    63  func (t *NullTransaction) SetDuration(duration time.Duration) {
    64  }
    65  
    66  func (t *NullTransaction) SetDurationStart(duration time.Time) {
    67  }
    68  
    69  func (t *NullTransaction) NewEvent(mtype, name string) Messager {
    70  	return nullMessage
    71  }
    72  
    73  func (t *NullTransaction) LogEvent(mtype, name string, args ...string) {
    74  	return
    75  }