github.com/segmentio/kafka-go@v0.4.48-0.20240318174348-3f6244eb34fd/protocol/deletegroups/deletegroups.go (about)

     1  package deletegroups
     2  
     3  import "github.com/segmentio/kafka-go/protocol"
     4  
     5  func init() {
     6  	protocol.Register(&Request{}, &Response{})
     7  }
     8  
     9  type Request struct {
    10  	// We need at least one tagged field to indicate that this is a "flexible" message
    11  	// type.
    12  	_ struct{} `kafka:"min=v2,max=v2,tag"`
    13  
    14  	GroupIDs []string `kafka:"min=v0,max=v2"`
    15  }
    16  
    17  func (r *Request) Group() string {
    18  	// use first group to determine group coordinator
    19  	if len(r.GroupIDs) > 0 {
    20  		return r.GroupIDs[0]
    21  	}
    22  	return ""
    23  }
    24  
    25  func (r *Request) ApiKey() protocol.ApiKey { return protocol.DeleteGroups }
    26  
    27  var (
    28  	_ protocol.GroupMessage = (*Request)(nil)
    29  )
    30  
    31  type Response struct {
    32  	// We need at least one tagged field to indicate that this is a "flexible" message
    33  	// type.
    34  	_ struct{} `kafka:"min=v2,max=v2,tag"`
    35  
    36  	ThrottleTimeMs int32           `kafka:"min=v0,max=v2"`
    37  	Responses      []ResponseGroup `kafka:"min=v0,max=v2"`
    38  }
    39  
    40  func (r *Response) ApiKey() protocol.ApiKey { return protocol.DeleteGroups }
    41  
    42  type ResponseGroup struct {
    43  	GroupID   string `kafka:"min=v0,max=v2"`
    44  	ErrorCode int16  `kafka:"min=v0,max=v2"`
    45  }