Documentation ¶
Overview ¶
* Kafka操作封装 * @author yorkershi * @created 2020-2-28
Index ¶
- type Cache
- func (this *Cache) Clean()
- func (this *Cache) Get(key string) interface{}
- func (this *Cache) GetInt(key string) int64
- func (this *Cache) GetMap(key string) map[string]string
- func (this *Cache) GetMapInterface(key string) map[string]interface{}
- func (this *Cache) GetMapInterfaceList(key string) []map[string]interface{}
- func (this *Cache) GetString(key string) string
- func (this *Cache) GetStringList(key string) []string
- func (this *Cache) Set(key string, value interface{}, expiration time.Duration)
- func (this *Cache) SetInt(key string, value int64, expiration time.Duration)
- func (this *Cache) SetMap(key string, value map[string]string, expiration time.Duration)
- func (this *Cache) SetMapInterface(key string, value map[string]interface{}, expiration time.Duration)
- func (this *Cache) SetMapInterfaceList(key string, value []map[string]interface{}, expiration time.Duration)
- func (this *Cache) SetString(key, value string, expiration time.Duration)
- func (this *Cache) SetStringList(key string, value []string, expiration time.Duration)
- type Kafka
- func (this *Kafka) Close()
- func (this *Kafka) LookupPartitions() ([]kafka.Partition, error)
- func (this *Kafka) ReadMessage() ([]byte, error)
- func (this *Kafka) ReadMessages() ([][]byte, error)
- func (this *Kafka) SetReadOffset(offset int64) error
- func (this *Kafka) SetReadOffsetByTime(tm time.Time) error
- func (this *Kafka) WriteMessage(msg []byte) (int, error)
- func (this *Kafka) WriteMessages(msglist [][]byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { }
func (*Cache) GetMapInterface ¶
func (*Cache) GetMapInterfaceList ¶
func (*Cache) GetStringList ¶
func (*Cache) SetMapInterface ¶
func (this *Cache) SetMapInterface(key string, value map[string]interface{}, expiration time.Duration)
设置一个map[string]interface{}内型到cache中
func (*Cache) SetMapInterfaceList ¶
func (this *Cache) SetMapInterfaceList(key string, value []map[string]interface{}, expiration time.Duration)
设置一个[]map[string]interface{}内型到cache中
type Kafka ¶
type Kafka struct { Conn *kafka.Conn // contains filtered or unexported fields }
func (*Kafka) LookupPartitions ¶
获取topic对象的所有分区信息, 拿到分区的总数量和下标位置后,可以再次实现化特别分区的Kafka对象进行操作
func (*Kafka) SetReadOffsetByTime ¶
设置从某个时间开始的偏移量
func (*Kafka) WriteMessage ¶
将一条消息写入到kafka中
Click to show internal directories.
Click to hide internal directories.