repositories

package
v0.0.0-...-81acb82 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminUserConditions

type AdminUserConditions struct {
	ID    string
	Email string

	LikeEmail string
	IDs       []uint
	Emails    []string
	*options.FindOptions
	*Paginate
}

func (*AdminUserConditions) ConvertConditionMongoDB

func (c *AdminUserConditions) ConvertConditionMongoDB() *MongoConditions

func (*AdminUserConditions) ConvertConditionMySQL

func (c *AdminUserConditions) ConvertConditionMySQL() []qm.QueryMod

type AdminUserEntity

type AdminUserEntity struct {
	ID                       string             `bson:"-"`
	OID                      primitive.ObjectID `bson:"_id"`
	Email                    string             `bson:"email,omitempty"`
	AuthType                 string             `bson:"authType"`
	Password                 *string            `bson:"password,omitempty"`
	Salt                     *string            `bson:"salt,omitempty"`
	GoogleOAuth2AccessToken  *string            `bson:"googleOAuth2AccessToken,omitempty"`
	GoogleOAuth2ExpiryDate   *uint64            `bson:"googleOAuth2ExpiryDate,omitempty"`
	GoogleOAuth2IdToken      *string            `bson:"googleOAuth2IdToken,omitempty"`
	GoogleOAuth2RefreshToken *string            `bson:"googleOAuth2RefreshToken,omitempty"`
	GoogleOAuth2TokenType    *string            `bson:"googleOAuth2TokenType,omitempty"`
	CreatedAt                time.Time          `bson:"-"`
	UpdatedAt                time.Time          `bson:"-"`
	CreatedAtInt             int                `bson:"createdAt,omitempty"`
	UpdatedAtInt             int                `bson:"updatedAt,omitempty"`

	RoleIDs []string `bson:"-"`
}

func (*AdminUserEntity) Bind

func (admin *AdminUserEntity) Bind(b interface{}) error

func (*AdminUserEntity) ToBSONSet

func (admin *AdminUserEntity) ToBSONSet() bson.D

type AdminUsers

type AdminUsers []*AdminUserEntity

type AuditLogConditions

type AuditLogConditions struct {
	*AuditLogEntity
	*options.FindOptions
	*Paginate
}

func (*AuditLogConditions) ConvertConditionMongoDB

func (c *AuditLogConditions) ConvertConditionMongoDB() *MongoConditions

func (*AuditLogConditions) ConvertConditionMySQL

func (c *AuditLogConditions) ConvertConditionMySQL() []qm.QueryMod

type AuditLogEntity

type AuditLogEntity struct {
	ID            string             `bson:"-"`
	OID           primitive.ObjectID `bson:"_id"`
	RequestMethod *string            `bson:"requestMethod,omitempty"`
	RequestUri    *string            `bson:"requestUri,omitempty"`
	SourceIp      *string            `bson:"sourceIp,omitempty"`
	UserID        *string            `bson:"userId,omitempty"`
	RequestBody   *string            `bson:"requestBody,omitempty"`
	StatusCode    *int               `bson:"statusCode,omitempty"`
	CreatedAt     time.Time          `bson:"-"`
	CreatedAtInt  int                `bson:"createdAt"`
	UpdatedAt     time.Time          `bson:"-"`
	UpdatedAtInt  int                `bson:"updatedAt"`
}

func (*AuditLogEntity) Bind

func (audit *AuditLogEntity) Bind(b interface{}) error

type Conditions

type Conditions interface {
	ConvertConditionMySQL() []qm.QueryMod
	ConvertConditionMongoDB() *MongoConditions
	ConvertPager() *Pager
}

func NewAuditLogConditions

func NewAuditLogConditions(audit *AuditLogEntity, size, page int, sort []string) Conditions

type Entity

type Entity interface {
	Bind(interface{}) error
}

type EntitySlice

type EntitySlice []Entity

type MongoConditions

type MongoConditions struct {
	Filter      interface{}
	FindOptions *options.FindOptions
}

type Order

type Order int
const (
	Asc Order = -1 + iota*2
	Desc
)

func (Order) String

func (o Order) String() string

type Pager

type Pager struct {
	Limit  int
	Offset int
	Sort   Sorts
}

func (*Pager) PaginateMongo

func (p *Pager) PaginateMongo() *options.FindOptions

func (*Pager) PaginateMySQL

func (p *Pager) PaginateMySQL() []qm.QueryMod

type Paginate

type Paginate struct {
	Size int
	Page int
	Sort []string
}

func (*Paginate) ConvertPager

func (pg *Paginate) ConvertPager() *Pager

type Repository

type Repository interface {
	FindOne(context.Context, string) (Entity, error)
	Find(context.Context, Conditions) (EntitySlice, error)
	Count(context.Context, Conditions) int
	CreateOne(context.Context, Entity) (Entity, error)
	UpdateByID(context.Context, string, Entity) error
	RemoveByID(context.Context, string) error
}

type RevokedTokenConditions

type RevokedTokenConditions struct {
	*RevokedTokenEntity
	*Paginate
}

func (*RevokedTokenConditions) ConvertConditionMongoDB

func (c *RevokedTokenConditions) ConvertConditionMongoDB() *MongoConditions

func (*RevokedTokenConditions) ConvertConditionMySQL

func (c *RevokedTokenConditions) ConvertConditionMySQL() []qm.QueryMod

type RevokedTokenEntity

type RevokedTokenEntity struct {
	ID           string             `bson:"-"`
	OID          primitive.ObjectID `bson:"_id"`
	Token        string             `bson:"token"`
	RevokedAt    time.Time          `bson:"-"`
	RevokedAtInt int                `bson:"revokedAt"`
	CreatedAt    time.Time          `bson:"-"`
	CreatedAtInt int                `bson:"createdAt"`
	UpdatedAt    time.Time          `bson:"-"`
	UpdatedAtInt int                `bson:"updatedAt"`
}

func (*RevokedTokenEntity) Bind

func (revoked *RevokedTokenEntity) Bind(b interface{}) error

type Sort

type Sort struct {
	Key   string
	Order Order
}

func (Sort) MongoDB

func (s Sort) MongoDB() bson.E

func (Sort) SQL

func (s Sort) SQL() string

type Sorts

type Sorts []Sort

func (Sorts) MongoDB

func (ss Sorts) MongoDB() bson.D

func (Sorts) SQL

func (ss Sorts) SQL() qm.QueryMod

Directories

Path Synopsis
gen

Jump to

Keyboard shortcuts

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