models

package
v0.0.0-...-03b00cc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProjectCredentialTableName    = "project_credential"
	ProjectCredentialIdColumn     = "credential_id"
	ProjectCredentialDomainColumn = "domain"
)
View Source
const (
	ProjectMembershipTableName       = "project_membership"
	ProjectMembershipUsernameColumn  = "username"
	ProjectMembershipProjectIdColumn = "project_id"
	ProjectMembershipRoleColumn      = "role"
)
View Source
const (
	ProjectTableName         = "project"
	ProjectPrefix            = "project-"
	ProjectDescriptionColumn = "description"
	ProjectIdColumn          = "project_id"
	ProjectExtraColumn       = "extra"
)

Variables

View Source
var ProjectColumns = GetColumnsFromStruct(&Project{})
View Source
var ProjectCredentialColumns = GetColumnsFromStruct(&ProjectCredential{})
View Source
var ProjectMembershipColumns = GetColumnsFromStruct(&ProjectMembership{})

Functions

func GetColumnsFromStruct

func GetColumnsFromStruct(s interface{}) []string

func GetColumnsFromStructWithPrefix

func GetColumnsFromStructWithPrefix(prefix string, s interface{}) []string

func WithPrefix

func WithPrefix(prefix, str string) string

Types

type Project

type Project struct {
	ProjectId   string    `json:"project_id" db:"project_id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Creator     string    `json:"creator"`
	CreateTime  time.Time `json:"create_time"`
	Status      string    `json:"status"`
	Visibility  string    `json:"visibility"`
	Extra       string    `json:"extra"`
}

func NewProject

func NewProject(name, description, creator, extra string) *Project

type ProjectCredential

type ProjectCredential struct {
	ProjectId    string    `json:"project_id"`
	CredentialId string    `json:"credential_id"`
	Domain       string    `json:"domain"`
	Creator      string    `json:"creator"`
	CreateTime   time.Time `json:"create_time"`
}

func NewProjectCredential

func NewProjectCredential(projectId, credentialId, domain, creator string) *ProjectCredential

type ProjectMembership

type ProjectMembership struct {
	Username  string `json:"username"`
	ProjectId string `json:"project_id" db:"project_id"`
	Role      string `json:"role"`
	Status    string `json:"status"`
	GrantBy   string `json:"grand_by,omitempty"`
}

func NewProjectMemberShip

func NewProjectMemberShip(username, projectId, role, grantBy string) *ProjectMembership

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL