git.zd.zone/hrpc/hrpc@v0.0.12/log/cls/option.go (about)

     1  package cls
     2  
     3  type Options struct {
     4  	endpoint string
     5  	topicID  string
     6  	callback Handle
     7  }
     8  
     9  type Option func(*Options)
    10  
    11  func WithEndpoint(endpoint string) Option {
    12  	return func(o *Options) {
    13  		o.endpoint = endpoint
    14  	}
    15  }
    16  
    17  func WithTopicID(id string) Option {
    18  	return func(o *Options) {
    19  		o.topicID = id
    20  	}
    21  }
    22  
    23  func WithCallBack(fn Handle) Option {
    24  	return func(o *Options) {
    25  		o.callback = fn
    26  	}
    27  }