Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *gorm.DB
Functions ¶
func ConnectDatabase ¶
func ConnectDatabase() error
Types ¶
type PinDTO ¶
type PinDTO struct {
UUID string `gorm:"primarykey"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
Status Status `gorm:"embedded"`
Cid string // `gorm:"index:cidUserId,unique"`
Name string
UserID uint // `gorm:"index:cidUserId,unique"`
}
func (*PinDTO) FromEntity ¶
type PinsRepository ¶
type PinsRepository interface {
LockByCID(string)
UnlockByCID(string)
// Set adds or updates a Pin
InsertOrGet(ctx context.Context, userID uint, pinStatus models.PinStatus) (models.PinStatus, error)
// Patch patches the fields of a Pin according to the given ID
Patch(ctx context.Context, userID uint, id string, fields map[string]interface{}) error
// Get returns the Pin status for a given ID
FindByID(ctx context.Context, userID uint, id string) (models.PinStatus, error)
// Find returns a list of Pins for the given parameters
Find(ctx context.Context,
userID uint,
cids, statuses []string,
name string,
before, after time.Time,
match string,
limit int,
) (models.PinResults, error)
// Delete removes the Pin according to the given ID
Delete(ctx context.Context, userID uint, id string) error
CIDRefrenceCount(ctx context.Context, cid string) (int64, error)
FindByStatus(ctx context.Context, statuses []string) ([]PinDTO, error)
ProcessByStatus(ctx context.Context, statuses []string, c chan bool) (chan *PinDTO, error)
}
Pins represents an interface to the Pins database
func GetPinsRepository ¶
func GetPinsRepository() PinsRepository
type UsersRepository ¶
type UsersRepository interface {
// Set adds or updates a Pin
Insert(ctx context.Context, token string) error
// Patch patches the fields of a Pin according to the given ID
Patch(ctx context.Context, id string, fields map[string]interface{}) error
// Get returns the Pin status for a given ID
FindByID(ctx context.Context, id string) (User, error)
// Find returns a list of Pins for the given parameters
FindByToken(ctx context.Context, token string) (User, error)
// Delete removes the Pin according to the given ID
Delete(ctx context.Context, id string) error
}
func NewUsersRepository ¶
func NewUsersRepository() UsersRepository
Click to show internal directories.
Click to hide internal directories.