model

package
v0.0.0-...-379c407 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultStartDate = time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC)
	DefaultEndDate   = time.Date(2100, 1, 1, 0, 0, 0, 0, time.UTC)
)

Functions

This section is empty.

Types

type Country

type Country struct {
	Code   string `gorm:"primaryKey;type:char(2)"`
	Name   string `gorm:"type:varchar(128)"`
	Alpha3 string `gorm:"type:char(3);uniqueIndex:uniq_country_alpha3,sort:asc"`
}

func (Country) TableName

func (Country) TableName() string

type Enrollment

type Enrollment struct {
	OrgID     uint      `gorm:"primaryKey;uniqueIndex:uniq_org_enrollment;"`
	UUID      string    `gorm:"primaryKey;uniqueIndex:uniq_org_enrollment;"`
	StartDate time.Time `gorm:"uniqueIndex:uniq_org_enrollment;"`
	EndDate   time.Time `gorm:"uniqueIndex:uniq_org_enrollment;"`
	Invalid   bool      `gorm:"default:0"`
	Source    ProfileSource
}

func (Enrollment) TableName

func (Enrollment) TableName() string

type GhaActor

type GhaActor struct {
	ID          uint   `gorm:"primaryKey"`
	Login       string `gorm:"primaryKey;type:varchar(120)"`
	Name        string `gorm:"type:varchar(120)"`
	CountryID   string `gorm:"type:varchar(2)"`
	CountryName string `gorm:"type:text"`
	Sex         string `gorm:"type:varchar(1)"`
	SexProb     string `gorm:"type:double"`
	Age         int    `gorm:"type:age"`
	Tz          string `gorm:"type:varchar(40)"`
	TzOffset    int    `gorm:"type:int"`

	Names  []GhaActorName  `gorm:"foreignKey:actor_id"`
	Emails []GhaActorEmail `gorm:"foreignKey:actor_id"`
}

func (GhaActor) TableName

func (GhaActor) TableName() string

type GhaActorEmail

type GhaActorEmail struct {
	ActorID int    `gorm:"primaryKey"`
	Email   string `gorm:"primaryKey"`
	Origin  int
}

func (GhaActorEmail) TableName

func (GhaActorEmail) TableName() string

type GhaActorName

type GhaActorName struct {
	ActorID int    `gorm:"primaryKey"`
	Name    string `gorm:"primaryKey"`
	Origin  int
}

func (GhaActorName) TableName

func (GhaActorName) TableName() string

type GitHubUser

type GitHubUser struct {
	gorm.Model

	Login     string  `gorm:"type:varchar(128);not null"`
	Email     string  `gorm:"type:varchar(255);not null"`
	Name      *string `gorm:"type:varchar(128);"`
	Location  *string `gorm:"type:varchar(255);"`
	Company   *string `gorm:"type:varchar(255);"`
	Blog      *string `gorm:"type:varchar(255);"`
	Bio       *string `gorm:"type:varchar(512);"`
	Following int     `gorm:"type:int;default:0"`
	Followers int     `gorm:"type:int;default:0"`
	AvatarURL *string `gorm:"type:varchar(255);"`
	UUID      string  `gorm:"type:varchar(128);"`

	Emails []GitHubUserEmail `gorm:"foreignKey:github_user_id"`
	Logins []GitHubUserLogin `gorm:"foreignKey:github_user_id"`
	Names  []GitHubUserName  `gorm:"foreignKey:github_user_id"`
}

func (GitHubUser) TableName

func (GitHubUser) TableName() string

type GitHubUserEmail

type GitHubUserEmail struct {
	gorm.Model

	GitHubUserID uint   `gorm:"column:github_user_id;not null;uniqueIndex:uniq_github_user_email"`
	Email        string `gorm:"type:varchar(255);not null;uniqueIndex:uniq_github_user_email"`
}

func (GitHubUserEmail) TableName

func (GitHubUserEmail) TableName() string

type GitHubUserLogin

type GitHubUserLogin struct {
	gorm.Model

	GitHubUserID uint   `gorm:"column:github_user_id;not null;uniqueIndex:uniq_github_user_login"`
	Login        string `gorm:"type:varchar(128);not null;uniqueIndex:uniq_github_user_login"`
}

func (GitHubUserLogin) TableName

func (GitHubUserLogin) TableName() string

type GitHubUserName

type GitHubUserName struct {
	gorm.Model

	GitHubUserID uint   `gorm:"column:github_user_id;not null;uniqueIndex:uniq_github_user_name"`
	Name         string `gorm:"type:varchar(128);not null;uniqueIndex:uniq_github_user_name"`
}

func (GitHubUserName) TableName

func (GitHubUserName) TableName() string

type OrgDomain

type OrgDomain struct {
	gorm.Model

	Name  string `yaml:"name" gorm:"type:varchar(255);not null;uniqueIndex:uniq_org_org_domain_name"`
	IsTop bool   `yaml:"is_top"`

	// Common indicates whether the domain name is a public email domain name, such as `gmail.com`.
	Common bool
	OrgID  uint `gorm:"uniqueIndex:uniq_org_org_domain_name"`
}

func (OrgDomain) TableName

func (OrgDomain) TableName() string

type OrgPattern

type OrgPattern struct {
	gorm.Model

	Pattern string `gorm:"type:varchar(512);not null;uniqueIndex:uniq_org_pattern"`
	OrgID   uint   `gorm:"uniqueIndex:uniq_org_pattern"`
}

func (OrgPattern) TableName

func (OrgPattern) TableName() string

type Organization

type Organization struct {
	gorm.Model

	Name      string           `gorm:"type:varchar(255);not null"`
	Fullname  string           `gorm:"type:varchar(255);"`
	Type      OrganizationType `gorm:"type:varchar(32);default:'company';not null"`
	Website   string           `gorm:"type:varchar(255);"`
	IsPartner bool             `gorm:"default: 0"`

	// Invalid - enrollment associated with invalid org will not be displayed and exported,
	// it can be used to prevent invalid organizations from being added repeatedly.
	Invalid bool `gorm:"default:0"`

	// Notice: An organization may have multiple domain names, the email domain can be used to
	// infer that the contributor belongs to an organization.
	Domains  []OrgDomain  `gorm:"foreignKey:org_id"`
	Patterns []OrgPattern `gorm:"foreignKey:org_id"`
}

func (Organization) TableName

func (Organization) TableName() string

type OrganizationType

type OrganizationType string
const (
	OrgTypeCompany    OrganizationType = "company"
	OrgTypeEducation  OrganizationType = "education"
	OrgTypeOpenSource OrganizationType = "open_source"
	OrgTypeIndividual OrganizationType = "individual"
)

type ProfileSource

type ProfileSource string
const (
	// GitHubProfileSource get the profile of a GitHub user through the GitHub API.
	GitHubProfileSource ProfileSource = "github_profile"
	// EmailDomainSource means information is inferred from the domain name part in the email.
	EmailDomainSource ProfileSource = "email_domain"
	// GitHubJSONSource means information is imported from GitHub user json file, which provided by cncf/gitdm.
	GitHubJSONSource ProfileSource = "github_json"
	// LarkContactSource means determine whether is an employee of the specified company according to whether GitHub login is in the Lark contact.
	LarkContactSource ProfileSource = "lark_contact"
	// ManualSource means information is provided through manual verification.
	ManualSource ProfileSource = "manual"
	// UserManualSource means information is provided through manual verification by user.
	UserManualSource ProfileSource = "user_manual"
)

type Project

type Project struct {
	gorm.Model

	DisplayName string `gorm:"type:varchar(128);not null;"`
	Name        string `gorm:"type:varchar(128);uniqueIndex;not null;"`

	Teams []Team `gorm:"foreignKey:project_id"`
}

func (Project) TableName

func (Project) TableName() string

type Repository

type Repository struct {
	gorm.Model

	Name      string
	Owner     string
	ProjectID uint
}

func (Repository) TableName

func (Repository) TableName() string

type Team

type Team struct {
	gorm.Model

	Name         string `gorm:"uniqueIndex"`
	Description  string
	ProjectID    uint             `gorm:"project_id"`
	Members      []UniqueIdentity `gorm:"many2many:team_members;foreignKey:ID;joinForeignKey:team_id;References:UUID;JoinReferences:uuid"`
	Repositories []Repository     `gorm:"many2many:team_repositories;foreignKey:ID;joinForeignKey:team_id;References:ID;JoinReferences:repo_id"`
	Project      Project          `gorm:"foreignKey:project_id"`
}

func (Team) TableName

func (Team) TableName() string

type TeamLevel

type TeamLevel string
const (
	TeamMaintainer TeamLevel = "maintainer"
	TeamCommitter  TeamLevel = "committer"
	TeamReviewer   TeamLevel = "reviewer"
)

type TeamMember

type TeamMember struct {
	TeamID uint   `gorm:"primaryKey;"`
	UUID   string `gorm:"primaryKey;type:varchar(128)"`
	Level  TeamLevel

	DupGitHubID    uint   `gorm:"column:dup_github_id;"`
	DupGitHubLogin string `gorm:"column:dup_github_login;type:varchar(128);not null"`
	DupEmail       string `gorm:"type:varchar(255);"`

	Team           Team           `gorm:"foreignKey:team_id"`
	UniqueIdentity UniqueIdentity `gorm:"foreignKey:uuid"`

	JoinDate       time.Time
	LastUpdateDate time.Time
}

func (TeamMember) TableName

func (TeamMember) TableName() string

type TeamMemberChangeLog

type TeamMemberChangeLog struct {
	gorm.Model

	TeamID         uint   `gorm:"uniqueIndex:uniq_team_member_change_log;"`
	UUID           string `gorm:"type:varchar(128);uniqueIndex:uniq_team_member_change_log;"`
	CommitSHA      string `gorm:"uniqueIndex:uniq_team_member_change_log;"`
	DupGitHubID    uint   `gorm:"column:dup_github_id;"`
	DupGitHubLogin string `gorm:"column:dup_github_login;type:varchar(128);not null"`

	CommitMessage string
	LevelFrom     *TeamLevel
	LevelTo       *TeamLevel
	ChangedAt     time.Time
}

type UniqueIdentity

type UniqueIdentity struct {
	UUID           string        `gorm:"primaryKey;type:varchar(128);"`
	Name           string        `gorm:"type:varchar(128)"`
	NameSource     ProfileSource `gorm:"type:varchar(32)"`
	Email          string        `gorm:"type:varchar(128)"`
	EmailSource    ProfileSource `gorm:"type:varchar(32)"`
	Gender         string        `gorm:"type:varchar(10)"`
	GenderAcc      float64       `gorm:"type:float"`
	GenderSource   ProfileSource `gorm:"type:varchar(32)"`
	Location       string        `gorm:"type:varchar(255)"`
	LocationSource ProfileSource `gorm:"type:varchar(32)"`
	Country        Country       `gorm:"foreignKey:country_code"`
	CountryCode    *string       `gorm:"type:char(2)"`
	CountrySource  ProfileSource `gorm:"type:varchar(32)"`
	IsBot          bool          `gorm:"default:0"`

	// One person can have multiple GitHub accounts.
	GitHubUsers []GitHubUser `gorm:"foreignKey:uuid"`

	// One person can belong to multiple organizations.
	Organizations []Organization `gorm:"many2many:enrollments;foreignKey:UUID;joinForeignKey:uuid;References:ID;JoinReferences:org_id"`

	// One person can participate in multiple projects.
	Projects []Project `gorm:"many2many:project_participants;foreignKey:UUID;joinForeignKey:uuid;References:ID;JoinReferences:project_id"`
}

func (UniqueIdentity) TableName

func (UniqueIdentity) TableName() string

Jump to

Keyboard shortcuts

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