models

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteAccount

func DeleteAccount(username string) error

func DeleteNode

func DeleteNode(id string) error

func DeleteProfile

func DeleteProfile(id string) error

func DeleteUser

func DeleteUser(id string) error

func FindAccount

func FindAccount(username string) (*innerAccount, error)

func Init

func Init()

Types

type Account

type Account struct {
	Username string `json:"username"`
	Password string `json:"password"`
	IsAdmin  bool   `json:"isAdmin"`
}

func (*Account) Insert

func (account *Account) Insert() error

func (*Account) PasswordIsCorrect

func (account *Account) PasswordIsCorrect(inner *innerAccount) bool

func (*Account) Update

func (account *Account) Update() error

type Node

type Node struct {
	Id         primitive.ObjectID `json:"id" bson:"_id"`
	Name       string             `json:"name"`
	APIAddress string             `json:"apiAddress" bson:"apiAddress"`
}

func FindNode

func FindNode(id any) (*Node, error)

func FindNodes

func FindNodes(skip int64, limit int64) ([]Node, error)

func (*Node) Insert

func (node *Node) Insert() error

func (*Node) Update

func (node *Node) Update() error

type Profile

type Profile struct {
	Id       primitive.ObjectID         `json:"id" bson:"_id"`
	Name     string                     `json:"name"`
	Inbound  *inboundDetourConfig       `json:"inbound"`
	Outbound *conf.OutboundDetourConfig `json:"outbound"`
	NodeId   primitive.ObjectID         `json:"nodeId" bson:"nodeId"`
}

func FindProfile

func FindProfile(id string) (*Profile, error)

func FindProfiles

func FindProfiles(filter any, sort any, skip int64, limit int64) ([]Profile, error)

func (*Profile) Insert

func (profile *Profile) Insert() error

type User

type User struct {
	Id          primitive.ObjectID            `json:"id" bson:"_id"`
	Name        string                        `json:"name"`
	Email       string                        `json:"email"`
	Level       uint32                        `json:"level"`
	BillingDate *time.Time                    `json:"billingDate" bson:"billingDate"`
	Account     map[string]json.RawMessage    `json:"account"`
	Profiles    map[primitive.ObjectID]string `json:"profiles"`
}

func FindUser

func FindUser(id string) (*User, error)

func FindUsers

func FindUsers(filter any, sort any, skip int64, limit int64) ([]User, error)

func (*User) Insert

func (user *User) Insert() error

func (*User) RemoveProfile

func (user *User) RemoveProfile(profileId string) error

func (*User) Update

func (user *User) Update() error

type UserResponse

type UserResponse struct {
	User     User      `json:"user,omitempty"`
	Profiles []Profile `json:"profiles,omitempty"`
}

func UserProfilesAggregateQuery

func UserProfilesAggregateQuery(skip int64, limit int64) ([]UserResponse, error)

Jump to

Keyboard shortcuts

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