model

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2018 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseTx

func CloseTx(tx *db.Tx, err error)

CloseTx will close tx with err. If err is nil, we will try to commit this tx. If err is not nil, we will rollback.

func DeleteDoc

func DeleteDoc(p string) (err error)

DeleteDoc will delete doc from database.

func DeleteDocID

func DeleteDocID(id uint64) (err error)

DeleteDocID will delete a Doc ID.

func FormatDocIDKey

func FormatDocIDKey(id uint64) []byte

FormatDocIDKey will format doc ID's key.

Types

type Doc

type Doc struct {
	ID        uint64 `msgpack:"id"`
	UpdatedAt int64  `msgpack:"ua"`
	URL       string `msgpack:"u"`
	Title     string `msgpack:"t"`
}

Doc is the base model in xuanzang.

func CreateDoc

func CreateDoc(p string, updatedAt int64) (u *Doc, err error)

CreateDoc will create doc in database.

func GetDoc

func GetDoc(p string) (u *Doc, err error)

GetDoc will get a Doc from database.

func GetDocByID

func GetDocByID(id uint64) (u *Doc, err error)

GetDocByID will get a doc by it's id.

func (*Doc) Save

func (u *Doc) Save() (err error)

Save will save current url to database.

Jump to

Keyboard shortcuts

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