Documentation
¶
Index ¶
- Constants
- func Exists(userID uint64, badgeCode string) bool
- func Grant(userID uint64, badgeCode string, source string, reason string, ...) (bool, error)
- func GrantAuto(userID uint64, badgeCode string, reason string, metadata Metadata) (bool, error)
- func GrantManual(userID uint64, badgeCode string, source string, reason string, ...) (bool, error)
- func HasActive(userID uint64, badgeCode string) bool
- func Revoke(userID uint64, badgeCode string) error
- func Save(entity *Entity) error
- type Entity
- type Metadata
Constants ¶
View Source
const ( SourceAuto = "auto" SourceManual = "manual" SourceMigration = "migration" )
Variables ¶
This section is empty.
Functions ¶
func GrantManual ¶
Types ¶
type Entity ¶
type Entity struct {
Id uint64 `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"`
UserId uint64 `` /* 137-byte string literal not displayed */
BadgeCode string `gorm:"column:badge_code;type:varchar(64);not null;default:'';uniqueIndex:idx_user_badge_code;index;" json:"badgeCode"`
Source string `gorm:"column:source;type:varchar(16);not null;default:'auto';" json:"source"`
Reason string `gorm:"column:reason;type:varchar(255);not null;default:'';" json:"reason"`
Metadata Metadata `gorm:"column:metadata;type:json;serializer:json" json:"metadata"`
GrantedBy uint64 `gorm:"column:granted_by;type:bigint unsigned;not null;default:0;" json:"grantedBy"`
GrantedAt time.Time `gorm:"column:granted_at;index:idx_user_badge_granted;" json:"grantedAt"`
RevokedAt *time.Time `gorm:"column:revoked_at;type:datetime;index;" json:"revokedAt"`
CreatedAt time.Time `gorm:"column:created_at;index;autoCreateTime;<-:create;" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime;" json:"updatedAt"`
}
func GetActiveByUserID ¶
func GetActiveByUserIDs ¶
Click to show internal directories.
Click to hide internal directories.