Initial commit

This commit is contained in:
Donny
2019-04-22 20:46:32 +08:00
commit 49ab8aadd1
25441 changed files with 4055000 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["errors.go"],
importpath = "go-common/app/admin/main/macross/model/errors",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = ["//library/ecode: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,28 @@
package errors
import (
"fmt"
"go-common/library/ecode"
)
// DependError for show like "model(%s) code(%s) error"
type DependError struct {
errInfo string
Err error
}
// New new a video error.
func New(errInfo string, m error) error {
return &DependError{errInfo, m}
}
// Ecode return ecode.
func (e *DependError) Ecode() error {
return e.Err
}
// Error implement error interface.
func (e *DependError) Error() string {
m := ecode.String(e.Err.Error()).Message()
return fmt.Sprintf(m, e.errInfo)
}

View File

@@ -0,0 +1,28 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["mail.go"],
importpath = "go-common/app/admin/main/macross/model/mail",
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
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,35 @@
package mail
import "mime/multipart"
// Type for mail
type Type uint8
// Mail types
const (
TypeTextPlain Type = iota
TypeTextHTML
)
// Attach def.
type Attach struct {
Name string
File multipart.File
ShouldUnzip bool
}
// Mail def.
type Mail struct {
ToAddresses []*Address `json:"to_addresses"`
CcAddresses []*Address `json:"cc_addresses"`
BccAddresses []*Address `json:"bcc_addresses"`
Subject string `json:"subject"`
Body string `json:"body"`
Type Type `json:"type"`
}
// Address def.
type Address struct {
Address string `json:"address"`
Name string `json:"name"`
}

View File

@@ -0,0 +1,32 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"manager.go",
"model.go",
],
importpath = "go-common/app/admin/main/macross/model/manager",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = ["//library/time: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,56 @@
package manager
import "go-common/library/time"
// User for manager.
type User struct {
UserID int64 `json:"user_id"`
System string `json:"-"`
UserName string `json:"user_name"`
RoleID int64 `json:"role_id"`
RoleName string `json:"role_name"`
CTime time.Time `json:"-"`
MTime time.Time `json:"-"`
}
// Role for manager.
type Role struct {
RoleID int64 `json:"role_id"`
System string `json:"-"`
RoleName string `json:"role_name"`
Auths map[string]*Auth `json:"auths"`
Models map[string]*Model `json:"models"`
CTime time.Time `json:"-"`
MTime time.Time `json:"-"`
}
// Auth for manager.
type Auth struct {
AuthID int64 `json:"auth_id"`
System string `json:"-"`
AuthName string `json:"auth_name"`
AuthFlag string `json:"auth_flag"`
CTime time.Time `json:"-"`
MTime time.Time `json:"-"`
}
// Users User sorted.
type Users []*User
func (u Users) Len() int { return len(u) }
func (u Users) Less(i, j int) bool { return int64(u[i].UserID) < int64(u[j].UserID) }
func (u Users) Swap(i, j int) { u[i], u[j] = u[j], u[i] }
// Roles Role sorted.
type Roles []*Role
func (r Roles) Len() int { return len(r) }
func (r Roles) Less(i, j int) bool { return int64(r[i].RoleID) < int64(r[j].RoleID) }
func (r Roles) Swap(i, j int) { r[i], r[j] = r[j], r[i] }
// Auths Auth sorted.
type Auths []*Auth
func (a Auths) Len() int { return len(a) }
func (a Auths) Less(i, j int) bool { return int64(a[i].AuthID) < int64(a[j].AuthID) }
func (a Auths) Swap(i, j int) { a[i], a[j] = a[j], a[i] }

View File

@@ -0,0 +1,23 @@
package manager
import "go-common/library/time"
// Model for manager.
type Model struct {
ModelID int64 `json:"model_id"`
System string `json:"-"`
ModelName string `json:"model_name"`
ModelFlag string `json:"model_flag"`
HasDependence bool `json:"has_dependence"`
GitURL string `json:"git_url"`
Count int64 `json:"count"`
CTime time.Time `json:"-"`
MTime time.Time `json:"-"`
}
// Models model sorted.
type Models []*Model
func (a Models) Len() int { return len(a) }
func (a Models) Less(i, j int) bool { return int64(a[i].ModelID) < int64(a[j].ModelID) }
func (a Models) Swap(i, j int) { a[i], a[j] = a[j], a[i] }

View File

@@ -0,0 +1,26 @@
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["package.go"],
importpath = "go-common/app/admin/main/macross/model/package",
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
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,10 @@
package upload
// PkgInfo which will be uploaded.
type PkgInfo struct {
SaveDir string
FileName string
ClientType string
Channel string
ApkName string
}

View File

@@ -0,0 +1,28 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["publish.go"],
importpath = "go-common/app/admin/main/macross/model/publish",
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
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,20 @@
package publish
// Dashboard for dashboard.
type Dashboard struct {
Name string `json:"name"`
Label string `json:"label"`
Commit string `json:"commit"`
OutURL string `json:"out_url"`
CoverageURL string `json:"coverage_url"`
TextSizeArm64 int64 `json:"text_size_arm64"`
ResSize int64 `json:"res_size"`
Logs []*Log `json:"logs"`
Extra string `json:"extra"`
}
// Log from Dashboard.
type Log struct {
Level string `json:"level"`
Msg string `json:"msg"`
}