GithubHelp home page GithubHelp logo

gopkg's Introduction

gopkg

license PRs Welcome

(English Documents Available)

Overview

gopkg 是蓝鲸go公共库

目录

Getting started

根据依赖的库, 使用go get进行依赖

$ go get github.com/TencentBlueKing/gopkg/{pkg_name}

详细文档 Go Doc / Go Walker

Roadmap

Support

BlueKing Community

  • BK-CI:蓝鲸持续集成平台是一个开源的持续集成和持续交付系统,可以轻松将你的研发流程呈现到你面前。
  • BK-BCS:蓝鲸容器管理平台是以容器技术为基础,为微服务业务提供编排管理的基础服务平台。
  • BK-BCS-SaaS:蓝鲸容器管理平台SaaS基于原生Kubernetes和Mesos自研的两种模式,提供给用户高度可扩展、灵活易用的容器产品服务。
  • BK-PaaS:蓝鲸PaaS平台是一个开放式的开发平台,让开发者可以方便快捷地创建、开发、部署和管理SaaS应用。
  • BK-SOPS:标准运维(SOPS)是通过可视化的图形界面进行任务流程编排和执行的系统,是蓝鲸体系中一款轻量级的调度编排类SaaS产品。
  • BK-CMDB:蓝鲸配置平台是一个面向资产及应用的企业级配置管理平台。

Contributing

如果你有好的意见或建议,欢迎给我们提 Issues 或 Pull Requests,为蓝鲸开源社区贡献力量。

License

基于 MIT 协议, 详细请参考LICENSE

gopkg's People

Contributors

mrlyc avatar narasux avatar wklken avatar yetlau111 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gopkg's Issues

arrayx

  • index
  • inArray
  • reverse
  • random(类似python的操作)

规划

目标

复用优秀的模块, 避免出现代码拷贝及定制, 广义上通用的库
避免项目中的代码拷贝行为

一定是实际可用, 并且可以复用的pkg

避免出现:

  • 放入interface声明却没有具体实现(待讨论)
  • pkg是某个特定产品共用的
  • pkg并不通用
  • pkg代码中有定制逻辑

一定不能出现:

  • 代码拷贝的某些库的
  • 代码拷贝某些库的internal模块(因为引用不到)
  • 代码非原创有证书问题

某些产品特定逻辑, 后续考虑

  1. 通过 xxx-kit维护
  2. 在本项目通过类似 contrib/xxxx维护(暂不考虑)

目录规划

gopkg
    |- stringx      字符串处理通用, 例如stringToBytes/GetMD5/Truncate/Random (add bytex?)
    |- bytex ???
    |- errorx        error wrap的通用封装模块
    |- timex
    |- collection/set      string_set.go/int64_set.go等
    |- middleware         web middleware
            |- std               no framework releated
            |- gin
            |- chi
    |- sd/consul            服务发现相关
            |- etcd

注意:

  • 慎用 util/utils/helpers等目录, 未来变成垃圾桶的概率太高(暂时禁用)

其他待定:

  • log or logger, 目前不是很好统一, 差异性较大 (zap/logrus with hooks)
  • database, sqlx/gorm等等

Redis

  • 封装 go-redis
  • 支持standalone / sentinel 配置
  • 暴露pool/timeout等各类可配置参数

bytex candidate

// TruncateBytes truncate []byte to specific length
func TruncateBytes(content []byte, length int) []byte {
	if len(content) > length {
		return content[:length]
	}
	return content
}

// TruncateBytesToString ...
func TruncateBytesToString(content []byte, length int) string {
	s := TruncateBytes(content, length)
	return string(s)
}

stringx candidate

// TruncateBytes truncate []byte to specific length
func TruncateBytes(content []byte, length int) []byte {
	if len(content) > length {
		return content[:length]
	}
	return content
}

// TruncateBytesToString ...
func TruncateBytesToString(content []byte, length int) string {
	s := TruncateBytes(content, length)
	return string(s)
}

type check

// IsValueTypeArray return true if interface is array or slice
func IsValueTypeArray(v interface{}) bool {
	if v == nil {
		return false
	}
	kind := reflect.TypeOf(v).Kind()
	return kind == reflect.Array || kind == reflect.Slice
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.