Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
load(
"@io_bazel_rules_go//proto:def.bzl",
"go_proto_library",
)
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
proto_library(
name = "model_proto",
srcs = ["titans.proto"],
tags = ["automanaged"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "model_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_grpc"],
importpath = "go-common/app/service/live/resource/model",
proto = ":model_proto",
tags = ["automanaged"],
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
)
go_library(
name = "go_default_library",
srcs = [
"confkv.go",
"model.go",
"resource.go",
"tree.go",
"user_resource.go",
],
embed = [":model_go_proto"],
importpath = "go-common/app/service/live/resource/model",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//library/time:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,17 @@
package model
import "time"
// Confkv def
type Confkv struct {
ID int64 `json:"id" gorm:"column:id"`
Key string `json:"key" form:"key"`
Value string `json:"value" form:"value"`
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
}
// TableName resource
func (c Confkv) TableName() string {
return "confkv"
}

View File

@@ -0,0 +1,93 @@
package model
import "go-common/library/time"
// TableName is used to identify table name in gorm
func (cf *SundryConfig) TableName() string {
return "ap_sundry_config"
}
// TableName is used to identify table name in gorm
func (cf *SundyConfigObject) TableName() string {
return "ap_sundry_config"
}
// InsertMaps is used to insertDb format
type InsertMaps struct {
Team int64 `protobuf:"varint,2,opt,name=team,proto3" json:"team"`
Keyword string `protobuf:"bytes,3,opt,name=keyword,proto3" json:"keyword"`
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name"`
Value string `protobuf:"bytes,5,opt,name=value,proto3" json:"value"`
Status int64 `protobuf:"bytes,5,opt,name=value,proto3" json:"status"`
}
// TableName is used to identify table name in gorm
func (cf *InsertMaps) TableName() string {
return "ap_sundry_config"
}
// SundyConfigObject is used to format select
type SundyConfigObject struct {
Id int64 `json:"id" gorm:"comumn:id"`
Team int64 `json:"team" gorm:"comumn:team"`
Keyword string `json:"index" gorm:"comumn:keyword"`
Name string `json:"name" gorm:"comumn:name"`
Value string `json:"value" gorm:"comumn:value"`
Ctime time.Time `json:"ctime" gorm:"comumn:ctime"`
Mtime time.Time `json:"mtime" gorm:"comumn:mtime"`
Status int64 `json:"status" gorm:"comumn:status"`
}
// TableName is used to identify table name in gorm
func (cf *ServiceConfigObject) TableName() string {
return "ap_services_config"
}
// TableName is used to identify table name in gorm
func (cf *InsertServiceConfig) TableName() string {
return "ap_services_config"
}
// TableName is used to identify table name in gorm
func (cf *UpdateServiceConfig) TableName() string {
return "ap_services_config"
}
// ServiceConfigObject is used to format select
type ServiceConfigObject struct {
Id int64 `json:"id" gorm:"comumn:id"`
TreeName string `protobuf:"bytes,2,opt,name=tree_name,proto3" json:"tree_name"`
TreePath string `protobuf:"bytes,3,opt,name=tree_path,proto3" json:"tree_path"`
TreeId int64 `protobuf:"varint,4,opt,name=tree_id,proto3" json:"tree_id"`
Service string `protobuf:"bytes,5,opt,name=service,proto3" json:"service"`
Keyword string `protobuf:"bytes,6,opt,name=keyword,proto3" json:"keyword"`
Template int64 `protobuf:"varint,7,opt,name=template,proto3" json:"template"`
Value string `protobuf:"bytes,8,opt,name=value,proto3" json:"value"`
Name string `protobuf:"bytes,9,opt,name=name,proto3" json:"name"`
Status int64 `protobuf:"varint,10,opt,name=status,proto3" json:"status"`
Ctime time.Time `protobuf:"bytes,7,opt,name=ctime,proto3" json:"ctime"`
Mtime time.Time `protobuf:"bytes,8,opt,name=mtime,proto3" json:"mtime"`
}
// InsertServiceConfig is used to insertDb format
type InsertServiceConfig struct {
TreeName string `protobuf:"bytes,3,opt,name=tree_name,proto3" json:"tree_name"`
TreePath string `protobuf:"bytes,3,opt,name=tree_path,proto3" json:"tree_path"`
TreeId int64 `protobuf:"bytes,3,opt,name=tree_id,proto3" json:"tree_id"`
Service string `protobuf:"bytes,2,opt,name=service,json=servuce,proto3" `
Keyword string `protobuf:"bytes,3,opt,name=template,proto3" json:"keyword"`
Template int64 `protobuf:"bytes,3,opt,name=template,proto3" json:"template"`
Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value"`
Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name"`
Status int64 `protobuf:"varint,6,opt,name=status,proto3" json:"status"`
}
// UpdateServiceConfig is used to insertDb format
type UpdateServiceConfig struct {
Service string `protobuf:"bytes,3,opt,name=service,proto3" json:"service"`
Keyword string `protobuf:"bytes,3,opt,name=template,proto3" json:"keyword"`
Template int64 `protobuf:"bytes,3,opt,name=template,proto3" json:"template"`
Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value"`
Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name"`
Status int64 `protobuf:"varint,6,opt,name=status,proto3" json:"status"`
}

View File

@@ -0,0 +1,23 @@
package model
import "time"
// Resource def
type Resource struct {
ID int64 `json:"id" gorm:"column:id"`
Platform string `json:"platform" form:"platform"`
Build int64 `json:"build" form:"build"`
LimitType int64 `json:"limit" form:"limit_type"`
StartTime time.Time `json:"start_time" form:"start_time"`
EndTime time.Time `json:"end_time" form:"end_time"`
Type string `json:"type" form:"type"`
Title string `json:"title" form:"title"`
ImageInfo string `json:"image_info" form:"image_info"`
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
}
// TableName resource
func (c Resource) TableName() string {
return "resource"
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
syntax = "proto3";
package model;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
message SundryConfig {
int64 id = 1 [(gogoproto.jsontag) = "id"];
int64 team = 2 [(gogoproto.jsontag) = "team"];
string keyword = 3 [(gogoproto.jsontag) = "keyword"];
string value = 4 [(gogoproto.jsontag) = "value"];
string name = 5 [(gogoproto.jsontag) = "name"];
int64 status = 6 [(gogoproto.jsontag) = "status"];
string ctime = 7 [(gogoproto.jsontag) = "ctime"];
string mtime = 8 [(gogoproto.jsontag) = "mtime"];
}
message ServiceModel {
int64 id = 1 [(gogoproto.jsontag) = "id"];
string tree_name = 2 [(gogoproto.jsontag) = "tree_name"];
string tree_path = 3 [(gogoproto.jsontag) = "tree_path"];
int64 tree_id = 4 [(gogoproto.jsontag) = "tree_id"];
string service = 5 [(gogoproto.jsontag) = "service"];
string keyword = 6 [(gogoproto.jsontag) = "keyword"];
int64 template = 7 [(gogoproto.jsontag) = "template"];
string value = 8 [(gogoproto.jsontag) = "value"];
string name = 9 [(gogoproto.jsontag) = "name"];
int64 status = 10 [(gogoproto.jsontag) = "status"];
string ctime = 11 [(gogoproto.jsontag) = "ctime"];
string mtime = 12 [(gogoproto.jsontag) = "mtime"];
}

View File

@@ -0,0 +1,164 @@
package model
import (
xtime "go-common/library/time"
"time"
)
//App app.
type App struct {
ID int64 `json:"id" gorm:"primary_key"`
Name string `json:"name"`
TreeID int64 `json:"tree_id"`
Env string `json:"env"`
Zone string `json:"zone"`
Token string `json:"token"`
Status int8 `json:"status"`
Ctime xtime.Time `json:"ctime"`
Mtime xtime.Time `json:"mtime"`
}
// TableName app
func (App) TableName() string {
return "app"
}
// Node node.
type Node struct {
Name string `json:"name"`
Path string `json:"path"`
TreeID int64 `json:"tree_id"`
}
// TreeNode TreeNode.
type TreeNode struct {
Alias string `json:"alias"`
CreatedAt string `json:"created_at"`
Name string `json:"name"`
Path string `json:"path"`
Tags interface{} `json:"tags"`
Type int `json:"type"`
}
// Res res.
type Res struct {
Count int `json:"count"`
Data []*TreeNode `json:"data"`
Page int `json:"page"`
Results int `json:"results"`
}
// AppPager app pager
type AppPager struct {
Total int64 `json:"total"`
Pn int64 `json:"pn"`
Ps int64 `json:"ps"`
Items []*App `json:"items"`
}
// Resp tree resp
type Resp struct {
Data map[string]*Tree `json:"data"`
}
// Tree node.
type Tree struct {
Name string `json:"name"`
Type int `json:"type"`
Path string `json:"path"`
Tags *TreeTag `json:"tags"`
Children map[string]*Tree `json:"children"`
}
//TreeTag tree tag.
type TreeTag struct {
Ops string `json:"ops"`
Rds string `json:"rds"`
}
//Env env.
type Env struct {
Name string `json:"name"`
NikeName string `json:"nike_name"`
Token string `json:"token"`
}
//RoleNode roleNode .
type RoleNode struct {
ID int64 `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Type int8 `json:"type"`
Role int8 `json:"role"`
}
//UpdateTokenReq ...
type UpdateTokenReq struct {
AppName string `form:"app_name" validate:"required"`
Env string `form:"env" validate:"required"`
Zone string `form:"zone" validate:"required"`
TreeID int64 `form:"tree_id" validate:"required"`
}
//CreateReq ...
type CreateReq struct {
AppName string `form:"app_name" validate:"required"`
TreeID int64 `form:"tree_id" validate:"required"`
}
//AppListReq ...
type AppListReq struct {
AppName string `form:"app_name"`
Bu string `form:"bu"`
Team string `form:"team"`
Pn int64 `form:"pn" default:"1" validate:"min=1"`
Ps int64 `form:"ps" default:"20" validate:"min=1"`
Status int8 `form:"status"`
}
//EnvsByTeamReq ...
type EnvsByTeamReq struct {
AppName string `form:"app_name"`
Zone string `form:"zone"`
Team string `form:"team"`
}
//EnvsReq ...
type EnvsReq struct {
AppName string `form:"app_name" validate:"required"`
TreeID int64 `form:"tree_id" validate:"required"`
Zone string `form:"zone" validate:"required"`
}
//NodeTreeReq ...
type NodeTreeReq struct {
Node string `form:"node"`
Team string `form:"team"`
}
//ZoneCopyReq ...
type ZoneCopyReq struct {
AppName string `form:"app_name" validate:"required"`
From string `form:"from_zone" validate:"required"`
To string `form:"to_zone" validate:"required"`
TreeID int64 `form:"tree_id" validate:"required"`
}
//CasterEnvsReq ...
type CasterEnvsReq struct {
TreeID int64 `form:"tree_id" validate:"required"`
Zone string `form:"zone" validate:"required"`
Auth string `form:"auth" validate:"required"`
}
//CacheData ...
type CacheData struct {
Data map[int64]*RoleNode `json:"data"`
CTime time.Time `json:"ctime"`
}
//AppStatusReq ...
type AppStatusReq struct {
TreeID int64 `form:"tree_id" validate:"required"`
Status int8 `form:"status" default:"1"`
}

View File

@@ -0,0 +1,22 @@
package model
import "time"
// UserResource def
type UserResource struct {
ID int32 `json:"id" gorm:"id"`
ResType int32 `json:"res_type" form:"res_type"`
CustomID int32 `json:"custom_id" form:"custom_id"`
Title string `json:"title" form:"title"`
URL string `json:"url" form:"url"`
Weight int32 `json:"weight" form:"weight"`
Status int32 `json:"status" form:"status"`
Creator string `json:"creator" form:"creator"`
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
}
// TableName user_resource
func (c UserResource) TableName() string {
return "user_resource"
}