Documentation
¶
Index ¶
- Constants
- type ActiveChannelObject
- type Base
- type Payment
- type StatsSingleton
- type SyncArray
- func (r *SyncArray) Delete(requestID string)
- func (r *SyncArray) Exists(requestID string) bool
- func (r *SyncArray) Get(requestID string) *ActiveChannelObject
- func (r *SyncArray) HashExists(hash string) bool
- func (r *SyncArray) IndexOf(requestID string) int
- func (r *SyncArray) Len() int
- func (r *SyncArray) Put(value *ActiveChannelObject)
- type User
- type UserType
- type WorkResult
Constants ¶
View Source
const PG_USER_TYPE_NAME = "user_type"
The name of the type as it's stored in postgres
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveChannelObject ¶
type Base ¶
type Base struct {
ID uuid.UUID `json:"_id" gorm:"primaryKey;autoIncrement:false"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Base contains common columns for all tables
func (*Base) AfterUpdate ¶
AfterUpdate will update the Base struct after every update
type Payment ¶
type Payment struct {
Base
BlockHash *string `json:"block_hash" gorm:"uniqueIndex"`
SendId string `json:"send_id" gorm:"uniqueIndex;not null"`
Amount uint `json:"amount"`
SendJson models.SendRequest `json:"send_json" gorm:"type:jsonb;not null"`
PaidTo uuid.UUID `json:"user_id" gorm:"not null"`
}
Store the payment request to users in the database
type StatsSingleton ¶
func GetStatsInstance ¶
func GetStatsInstance() *StatsSingleton
type SyncArray ¶
type SyncArray struct {
// contains filtered or unexported fields
}
SyncArray builds an thread-safe array with some handy methods
func NewSyncArray ¶
func NewSyncArray() *SyncArray
func (*SyncArray) Get ¶
func (r *SyncArray) Get(requestID string) *ActiveChannelObject
Gets a value from the map - synchronized
func (*SyncArray) HashExists ¶
func (*SyncArray) Put ¶
func (r *SyncArray) Put(value *ActiveChannelObject)
Put value into map - synchronized
type User ¶
type User struct {
Base
Type UserType `gorm:"type:user_type;not null"`
Email string `json:"email" gorm:"uniqueIndex;not null"`
Password string `json:"password" gorm:"not null"`
EmailVerified bool `json:"emailVerfied" gorm:"default:false;not null"`
ServiceName *string `json:"serviceName"`
ServiceWebsite *string `json:"serviceWebsite"`
CanRequestWork bool `json:"canRequestWork" gorm:"default:false;not null"`
InvalidResultCount int `json:"invalidResultCount" gorm:"default:0;not null"`
// For reward payments
BanAddress *string `json:"banAddress"`
// The work this user provider
WorkResults []WorkResult `gorm:"foreignKey:ProvidedBy"`
LastProvidedWorkAt *time.Time `json:"lastProvidedWorkAt"`
// The work this user has requested
WorkRequests []WorkResult `gorm:"foreignKey:RequestedBy"`
LastRequestedWorkAt *time.Time `json:"lastRequestedWorkAt"`
// Payments sent to this user
Payments []Payment `gorm:"foreignKey:PaidTo"`
// Banned
Banned bool `json:"banned" gorm:"default:false;not null"`
}
type WorkResult ¶
type WorkResult struct {
Base
Hash string `json:"hash" gorm:"uniqueIndex;not null"`
DifficultyMultiplier int `json:"difficulty_multiplier"`
Result string `json:"result" gorm:"not null"`
Awarded bool `json:"awarded" gorm:"default:false;not null"` // Whether or not this has been awarded
ProvidedBy uuid.UUID `json:"providedBy" gorm:"not null"`
RequestedBy uuid.UUID `json:"requestedBy" gorm:"not null"`
Precache bool `json:"precache" gorm:"default:false;not null"`
}
Click to show internal directories.
Click to hide internal directories.