package lock_free import "time" type Option func(*options) type options struct { autoAck bool expireAutoFail time.Duration } func loadOptions(opt ...Option) options { opts := options{ autoAck: true, expireAutoFail: 10 * time.Second, } for _, o := range opt { o(&opts) } return opts } // WithAutoAck 设置自动确认 func WithAutoAck(autoAck bool) Option { return func(o *options) { o.autoAck = autoAck } } // WithExpireAutoFail 设置手动确认截止时间 func WithExpireAutoFail(expireAutoFail time.Duration) Option { return func(o *options) { o.expireAutoFail = expireAutoFail } }