base

package
v0.0.0-...-4215b1c Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionName = "base"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IMongoMapper

type IMongoMapper interface {
	Insert(ctx context.Context, i *Interface) error
	Update(ctx context.Context, i *Interface) error
	FindAndCount(ctx context.Context, p *basic.PaginationOptions) ([]*Interface, int64, error)
	FindOne(ctx context.Context, id string) (i *Interface, err error)
	FindOneByURLAndMethod(ctx context.Context, rawURL string, method string) (i *Interface, err error)
	Delete(ctx context.Context, id string) error
}

type Interface

type Interface struct {
	ID         primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Name       string             `bson:"name" json:"name"`
	Host       string             `bson:"host" json:"host"`
	Path       string             `bson:"path" json:"path"`
	Method     int64              `bson:"method" json:"method"`
	PassWay    int64              `bson:"passWay" json:"passWay"`
	Params     map[string]string  `bson:"params" json:"params"`
	Content    string             `bson:"content" json:"content"`
	Status     int64              `bson:"status" json:"status"`
	CreateTime time.Time          `bson:"create_time" json:"createTime"`
	UpdateTime time.Time          `bson:"update_time" json:"updateTime"`
	DeleteTime time.Time          `bson:"delete_time,omitempty" json:"deleteTime,omitempty"`
}

type MongoMapper

type MongoMapper struct {
	// contains filtered or unexported fields
}

func NewMongoMapper

func NewMongoMapper(config *config.Config) *MongoMapper

func (*MongoMapper) Delete

func (m *MongoMapper) Delete(ctx context.Context, id string) error

func (*MongoMapper) FindAndCount

func (m *MongoMapper) FindAndCount(ctx context.Context, p *basic.PaginationOptions) ([]*Interface, int64, error)

func (*MongoMapper) FindOne

func (m *MongoMapper) FindOne(ctx context.Context, id string) (i *Interface, err error)

func (*MongoMapper) FindOneByURLAndMethod

func (m *MongoMapper) FindOneByURLAndMethod(ctx context.Context, rawURL string, method string) (i *Interface, err error)

func (*MongoMapper) Insert

func (m *MongoMapper) Insert(ctx context.Context, i *Interface) error

func (*MongoMapper) Update

func (m *MongoMapper) Update(ctx context.Context, i *Interface) error

Jump to

Keyboard shortcuts

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