Documentation
¶
Overview ¶
models/user.go
Index ¶
- func ToBufModulePB(in *Module) *modulev1.Module
- func ToCommitPB(in *Commit) *modulev1.Commit
- func ToContentPB(in *DownloadResponseContent) *modulev1.DownloadResponse_Content
- func ToModulePB(in *Module) *registrypbv1.Module
- func ToUserRegistryPbV1(in *User) (*v1.User, error)
- type Action
- type CanResponse
- type Commit
- type DigestType
- type DownloadResponse
- type DownloadResponseContent
- type File
- type LoginRequest
- type LoginResponse
- type Module
- type ModuleRef
- type ModuleState
- type ModuleVisibility
- type Object
- type Policy
- type ResourceRefs
- type Role
- type Session
- type SigninRequest
- type SigninResponse
- type Subject
- type UploadRequest
- type UploadRequest_Content
- type User
- type UserState
- type UserType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToBufModulePB ¶
func ToCommitPB ¶
func ToContentPB ¶
func ToContentPB(in *DownloadResponseContent) *modulev1.DownloadResponse_Content
func ToModulePB ¶
func ToModulePB(in *Module) *registrypbv1.Module
Types ¶
type CanResponse ¶
type CanResponse struct {
Allowed bool
}
type Commit ¶
type Commit struct { ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()"` CommitHash string `gorm:"not null;type:varchar(40)"` // TODO should be uniq? CreateTime time.Time `gorm:"not null" json:"create_time"` UpdateTime time.Time `gorm:"not null" json:"update_time"` OwnerID uuid.UUID `gorm:"type:uuid;not null;index"` Owner User `gorm:"foreignKey:OwnerID"` ModuleID uuid.UUID `gorm:"type:uuid;not null;index"` Module Module `gorm:"foreignKey:ModuleID"` DigestType DigestType `gorm:"type:smallint;not null"` DigestValue string `gorm:"type:varchar(128);not null"` // TODO should be uniq? CreatedByUserID uuid.UUID `gorm:"type:uuid;index"` CreatedByUser *User `gorm:"foreignKey:CreatedByUserID"` SourceControlURL string `gorm:"type:text"` }
type DigestType ¶
type DigestType int32
const ( DigestType_UNSPECIFIED DigestType = 0 DigestType_B5 DigestType = 1 )
type DownloadResponse ¶
type DownloadResponse struct {
Contents []*DownloadResponseContent `json:"contents,omitempty"`
}
type DownloadResponseContent ¶
type LoginRequest ¶
type LoginResponse ¶
type LoginResponse struct {
Token string
}
type Module ¶
type Module struct { ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"` CreateTime time.Time `gorm:"not null" json:"create_time"` UpdateTime time.Time `gorm:"not null" json:"update_time"` Name string `gorm:"unique;not null" json:"name"` OwnerID uuid.UUID `gorm:"type:uuid;not null" json:"owner_id"` Owner User `gorm:"foreignKey:OwnerID" json:"owner,omitempty"` Visibility ModuleVisibility `gorm:"not null;default:1" json:"visibility"` State ModuleState `gorm:"not null;default:1" json:"state"` Description string `gorm:"type:text" json:"description"` URL string `gorm:"index:url_unique,unique column:url" json:"url"` DefaultLabelName string `gorm:"default:'main'" json:"default_label_name"` DefaultBranch string `gorm:"default:'main'" json:"default_branch"` Commits []Commit `gorm:"foreignKey:ModuleID" json:"commits,omitempty"` }
func FromModulePB ¶
func FromModulePB(in *registrypbv1.Module) (*Module, error)
type ModuleState ¶
type ModuleState int32
const ( ModuleState_MODULE_STATE_UNSPECIFIED ModuleState = 0 ModuleState_MODULE_STATE_ACTIVE ModuleState = 1 ModuleState_MODULE_STATE_DEPRECATED ModuleState = 2 )
type ModuleVisibility ¶
type ModuleVisibility int32
const ( ModuleVisibility_MODULE_VISIBILITY_UNSPECIFIED ModuleVisibility = 0 ModuleVisibility_MODULE_VISIBILITY_PUBLIC ModuleVisibility = 1 ModuleVisibility_MODULE_VISIBILITY_PRIVATE ModuleVisibility = 2 )
type ResourceRefs ¶
type Session ¶
type Session struct { ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"` CreateTime time.Time `gorm:"not null" json:"create_time"` UpdateTime time.Time `gorm:"not null" json:"update_time"` UserID uuid.UUID `gorm:"type:uuid;not null" json:"user_id"` User User `gorm:"foreignKey:UserID" json:"user,omitempty"` AuthModule string `gorm:"type:varchar(100);not null" json:"auth_module"` ExpiresAt time.Time `grom:"not null" json:"expires_at"` }
type SigninRequest ¶
type SigninResponse ¶
type SigninResponse struct {
User *User
}
type UploadRequest ¶
type UploadRequest struct { Contents []*UploadRequest_Content `json:"contents,omitempty"` DepCommitIds []string `json:"dep_commit_ids,omitempty"` }
type UploadRequest_Content ¶
type User ¶
type User struct { ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"` CreateTime time.Time `gorm:"not null" json:"create_time"` UpdateTime time.Time `gorm:"not null" json:"update_time"` Username string `gorm:"uniqueIndex;not null" json:"username"` Email string `gorm:"uniqueIndex;not null" json:"email"` Password string `gorm:"column:password;type:varchar(255);not null" json:"password" binding:"required"` Type UserType `gorm:"not null;default:0" json:"type"` State UserState `gorm:"not null;default:1" json:"state"` Description string `gorm:"type:text" json:"description"` URL string `gorm:"column:url" json:"url"` }
Click to show internal directories.
Click to hide internal directories.