model

package
v0.0.0-...-39e813e Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: Unlicense Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeletePGPFiles

func DeletePGPFiles(filter bson.M) (err error)

DeletePGPFiles will delete all PGPFiles that get through filter

func DeleteUsers

func DeleteUsers(filter bson.D) (err error)

DeleteUsers will delete all Users that get through filter

func GetPGPFiles

func GetPGPFiles(files []PGPFile, filter interface{}) (err error)

GetPGPFiles will get Many PGPfiles from mongo.Collection

func GetUsers

func GetUsers(users []User, filter interface{}) (err error)

GetUsers is a "R"ead Operation

func InsertPGPFiles

func InsertPGPFiles(files []PGPFile) (err error)

InsertPGPFiles is to insert multi-files. input parameter(files) need init all properties

func InsertUsers

func InsertUsers(users []User) (err error)

InsertUsers is to insert multi-users

func UpdatePGPFiles

func UpdatePGPFiles(update bson.M, filter bson.M) (err error)

UpdatePGPFiles will update all PGPFiles that get through filter

func UpdateUsers

func UpdateUsers(update bson.M, filter bson.M) (err error)

UpdateUsers will update all Users that get through filter

Types

type PGPFile

type PGPFile struct {
	// Name is used to figure out src & dst.
	// namely, "repeat name" is forbidden
	Name   string `bson:"name"`
	Author string `bson:"author"`
	Size   int    `bson:"size"`

	// Create_time represents when file sent to server
	CreateTime     time.Time `bson:"createtime"`
	LastModifyTime time.Time `bson:"lastmodifytime"`

	// Path means the place where this "File" stored
	// and this path is a relative path.
	// absolute path = path prefix + path (relative path)
	Path   string `bson:"path"`
	PubKey string `bson:"pubkey"`
}

PGPFile is file document type

type User

type User struct {
	Profile UserProfile `bson:"profile"`
	Files   []PGPFile   `bson:"files"`

	Session string `bson:"session"`
	PubKey  string `bson:"pubkey"`
}

User as a document

type UserProfile

type UserProfile struct {
	// Name is one of properties to identify users
	Name string `bson:"name"`
	// Password need stored after processing
	Password string `bson:"password"`
	// LastLoginTime is required in resp of login
	LastLoginTime time.Time `bson:"lastlogintime"`
}

UserProfile is a type used in User

Jump to

Keyboard shortcuts

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