当前位置: 首页>>代码示例>>Golang>>正文


Golang uuid.UUID类代码示例

本文整理汇总了Golang中github.com/google/uuid.UUID的典型用法代码示例。如果您正苦于以下问题:Golang UUID类的具体用法?Golang UUID怎么用?Golang UUID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了UUID类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: addContextAssociation

func (s *SlackLink) addContextAssociation(context uuid.UUID, channelID string) {
	s.contextChannelsLock.Lock()
	s.contextChannels[context.String()] = channelID
	s.contextChannelsLock.Unlock()
	s.contextBuffersLock.Lock()
	s.contextBuffers[context.String()] = bytes.NewBuffer(nil)
	s.contextBuffersLock.Unlock()
}
开发者ID:FoxelBox,项目名称:FoxBukkitSlackLink,代码行数:8,代码来源:slacklink.go

示例2: removeContextAssociation

func (s *SlackLink) removeContextAssociation(context uuid.UUID) {
	s.contextChannelsLock.Lock()
	delete(s.contextChannels, context.String())
	s.contextChannelsLock.Unlock()
	s.contextBuffersLock.Lock()
	delete(s.contextBuffers, context.String())
	s.contextBuffersLock.Unlock()
	s.removeSpecialAcknowledgementContext(context)
}
开发者ID:FoxelBox,项目名称:FoxBukkitSlackLink,代码行数:9,代码来源:slacklink.go

示例3: getSpecialAcknowledgement

func (s *SlackLink) getSpecialAcknowledgement(context uuid.UUID) (*slack.ItemRef, string, bool) {
	s.specialAcknowledgementContextsLock.Lock()
	defer s.specialAcknowledgementContextsLock.Unlock()
	entry, ok := s.specialAcknowledgementContexts[context.String()]
	if !ok {
		return nil, "", false
	}

	return entry.Ref, entry.MustContain, true
}
开发者ID:FoxelBox,项目名称:FoxBukkitSlackLink,代码行数:10,代码来源:slacklink.go

示例4: getContextBuffer

func (s *SlackLink) getContextBuffer(context uuid.UUID) *bytes.Buffer {
	s.contextBuffersLock.Lock()
	defer s.contextBuffersLock.Unlock()
	buf, ok := s.contextBuffers[context.String()]
	if !ok {
		buf = new(bytes.Buffer)
		s.contextBuffers[context.String()] = buf
	}

	return buf
}
开发者ID:FoxelBox,项目名称:FoxBukkitSlackLink,代码行数:11,代码来源:slacklink.go

示例5: addSpecialAcknowledgementContext

func (s *SlackLink) addSpecialAcknowledgementContext(context uuid.UUID, ref *slack.ItemRef, mustContain string) {
	s.specialAcknowledgementContextsLock.Lock()
	defer s.specialAcknowledgementContextsLock.Unlock()
	s.specialAcknowledgementContexts[context.String()] = struct {
		MustContain string
		Ref         *slack.ItemRef
	}{
		MustContain: mustContain,
		Ref:         ref,
	}
}
开发者ID:FoxelBox,项目名称:FoxBukkitSlackLink,代码行数:11,代码来源:slacklink.go

示例6: getMinecraftPlayer

func (s *SlackLink) getMinecraftPlayer(id uuid.UUID) *MinecraftPlayer {
	name, err := s.redis.HGet("playerUUIDToName", id.String()).Result()
	if err == redis.Nil {
		return &MinecraftPlayer{
			UUID: id,
		}
	} else if err != nil {
		log.Printf("error in getMinecraftPlayer: %v", err)
		return nil
	}

	return &MinecraftPlayer{
		UUID: id,
		Name: name,
	}
}
开发者ID:FoxelBox,项目名称:FoxBukkitSlackLink,代码行数:16,代码来源:link.go

示例7: removeSpecialAcknowledgementContext

func (s *SlackLink) removeSpecialAcknowledgementContext(context uuid.UUID) {
	s.specialAcknowledgementContextsLock.Lock()
	defer s.specialAcknowledgementContextsLock.Unlock()
	delete(s.specialAcknowledgementContexts, context.String())
}
开发者ID:FoxelBox,项目名称:FoxBukkitSlackLink,代码行数:5,代码来源:slacklink.go


注:本文中的github.com/google/uuid.UUID类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。