data

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderAscending  = "asc"
	OrderDescending = "desc"
)
View Source
const (
	ModuleName = "mail"
)

Variables

This section is empty.

Functions

func GetOffsetLinksForPGParams

func GetOffsetLinksForPGParams(r *http.Request, p pgdb.OffsetPageParams) *resources.Links

Types

type Link struct {
	Id   int64  `db:"id" structs:"-"`
	Link string `db:"link" structs:"link"`
}
type Links interface {
	New() Links

	Insert(link Link) error
	Delete() error
	Get() (*Link, error)
	Select() ([]Link, error)

	FilterByLinks(links ...string) Links
}

type ModulePayload

type ModulePayload struct {
	RequestId string `json:"request_id"`
	UserId    string `json:"user_id"`
	Action    string `json:"action"`

	//other fields that are required for module
	Link      string   `json:"link"`
	Links     []string `json:"links"`
	Email     string   `json:"username"`
	Phone     string   `json:"phone"`
	FirstName string   `json:"first_name"`
	LastName  string   `json:"last_name"`
}

type ModuleRequest

type ModuleRequest struct {
	ID            string    `db:"id" structs:"id"`
	UserID        int64     `db:"user_id" structs:"user_id"`
	Module        string    `db:"module" structs:"module"`
	Payload       string    `db:"payload" structs:"payload"`
	CreatedAt     time.Time `db:"created_at" structs:"created_at"`
	RequestStatus string    `db:"request_status" structs:"request_status"`
	Error         string    `db:"error" structs:"error"`
}

type OrderType

type OrderType string

OrderType - represents sorting order of the query

const (
	// OrderAsc - ascending order
	OrderAsc OrderType = "asc"
	// OrderDesc - descending order
	OrderDesc OrderType = "desc"
)

func (OrderType) Invert

func (o OrderType) Invert() OrderType

Invert - inverts order by

type Permission

type Permission struct {
	RequestId string    `json:"request_id" db:"request_id" structs:"request_id"`
	MailId    string    `json:"mail_id" db:"mail_id" structs:"mail_id"`
	Link      string    `json:"link" db:"link" structs:"link"`
	CreatedAt time.Time `json:"created_at" db:"created_at" structs:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at" structs:"-"`
	*User     `structs:",omitempty"`
}

type Permissions

type Permissions interface {
	New() Permissions

	Upsert(permission Permission) error
	Delete() error
	Select() ([]Permission, error)
	Get() (*Permission, error)

	FilterByMailIds(mailIds ...string) Permissions
	FilterByGreaterTime(time time.Time) Permissions
	FilterByLowerTime(time time.Time) Permissions
	FilterByLinks(links ...string) Permissions

	WithUsers() Permissions
	FilterByUserIds(userIds ...int64) Permissions

	Count() Permissions
	CountWithUsers() Permissions
	GetTotalCount() (int64, error)

	Page(pageParams pgdb.OffsetPageParams) Permissions
}

type Response

type Response struct {
	ID        string          `json:"id" db:"id" structs:"id"`
	Status    string          `json:"status" db:"status" structs:"status"`
	Error     string          `json:"error" db:"error" structs:"error"`
	Payload   json.RawMessage `json:"payload" db:"payload" structs:"payload"`
	CreatedAt string          `json:"created_at" db:"created_at" structs:"-"`
}

type Responses

type Responses interface {
	New() Responses

	Get() (*Response, error)
	Select() ([]Response, error)
	Insert(response Response) error
	Delete() error

	FilterByIds(ids ...string) Responses
}

type UnverifiedPayload

type UnverifiedPayload struct {
	Action string           `json:"action"`
	Users  []UnverifiedUser `json:"users"`
}

type UnverifiedUser

type UnverifiedUser struct {
	CreatedAt time.Time `json:"created_at"`
	Module    string    `json:"module"`
	Submodule string    `json:"submodule"`
	ModuleId  string    `json:"module_id"`
	Email     *string   `json:"email,omitempty"`
	Name      *string   `json:"name,omitempty"`
	Phone     *string   `json:"phone,omitempty"`
	Username  *string   `json:"username,omitempty"`
}

type User

type User struct {
	Id        *int64    `json:"-" db:"id" structs:"id,omitempty"`
	Email     string    `json:"email" db:"email" structs:"email"`
	Name      string    `json:"name" db:"name" structs:"name"`
	MailId    string    `json:"mail_id" db:"mail_id" structs:"mail_id"`
	CreatedAt time.Time `json:"created_at" db:"created_at" structs:"-"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at" structs:"-"`
	Submodule *string   `json:"-" db:"-" structs:"-"`
}

type Users

type Users interface {
	New() Users

	Upsert(user User) error
	Delete() error
	Select() ([]User, error)
	Get() (*User, error)

	FilterById(id *int64) Users
	FilterByMailIds(emailIds ...string) Users
	FilterByLowerTime(time time.Time) Users
	SearchBy(search string) Users

	Count() Users
	GetTotalCount() (int64, error)

	Page(pageParams pgdb.OffsetPageParams) Users
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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