models

package
v0.0.0-...-2029094 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	None = iota
	Top
)
View Source
const (
	DocDBPath   = "./doc"
	ImageBDPath = "./imageDB"
	ImagePath   = "./image"

	DefaultDBPathConfig = "/tmp/painter"
	ConfigDBPath        = "db"
)
View Source
const AccessDBPath = "./access"

Variables

View Source
var GlobalDBPath string

GlobalDBPath absolute path for database

View Source
var ImageStoreSingleCase imageStore.ImageStore

Functions

This section is empty.

Types

type Access

type Access struct {
	IP net.IP
	// contains filtered or unexported fields
}

type AccessLog

type AccessLog interface {
	Login(net.IP)
	Access(ip net.IP, docID string)
	GetLatestAccess() []string
	GetLatestLogin() []string
	Start(path string) error
	Stop()
}
var AccessLogSingleCase AccessLog

type AccessLogLevelDBImpl

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

func (*AccessLogLevelDBImpl) Access

func (a *AccessLogLevelDBImpl) Access(ip net.IP, docID string)

func (*AccessLogLevelDBImpl) GetLatestAccess

func (a *AccessLogLevelDBImpl) GetLatestAccess() []string

func (*AccessLogLevelDBImpl) GetLatestLogin

func (a *AccessLogLevelDBImpl) GetLatestLogin() []string

func (*AccessLogLevelDBImpl) Login

func (a *AccessLogLevelDBImpl) Login(ip net.IP)

func (*AccessLogLevelDBImpl) Start

func (a *AccessLogLevelDBImpl) Start(path string) error

func (*AccessLogLevelDBImpl) Stop

func (a *AccessLogLevelDBImpl) Stop()

type Author

type Author struct {
	Config appConfig.AppConfig
}
var AuthorSingleCase Author

func (*Author) ChangePwd

func (a *Author) ChangePwd(pwd string)

ChangePwd Change pwd

func (*Author) Close

func (a *Author) Close(confPath string)

func (*Author) GetEmail

func (a *Author) GetEmail() string

ChangePwd Change pwd

func (*Author) Login

func (a *Author) Login(pwd string, ip net.IP) (bool, string)

Login login todo 当前先传递口令明文,保存scrypt return bool value and a token 如果返回true,这把token设置到cookie即可

func (*Author) MarshalJSON

func (a *Author) MarshalJSON(webDN string) ([]byte, error)

MarshalJSON Marshaler {title: "Painter Qiao",

         subTitle: "for dear & love",
         avatar: "http://.../avatar.jpeg",
         lastLogin: 123213213,
         name: "Painter Qiao",
			ipc: "",
			github: "",
         say: "a blog for dear & love"
         email: ""}

func (*Author) SetAvatar

func (a *Author) SetAvatar(avatar string) error

SetAvatar Set Avatar

func (*Author) SetEmail

func (a *Author) SetEmail(email string) error

func (*Author) SetNormal

func (a *Author) SetNormal(in ...string) error

SetNormal set normal config

func (*Author) Start

func (a *Author) Start(confPath string) error

func (*Author) TokenMatch

func (a *Author) TokenMatch(token string, fromIP net.IP) bool

type DocumentComparer

type DocumentComparer struct{}

func (DocumentComparer) Compare

func (DocumentComparer) Compare(a, b []byte) int

func (DocumentComparer) Name

func (DocumentComparer) Name() string

func (DocumentComparer) Separator

func (DocumentComparer) Separator(dst, a, b []byte) []byte

func (DocumentComparer) Successor

func (DocumentComparer) Successor(dst, b []byte) []byte

type DocumentDataBase

type DocumentDataBase interface {
	Init(dbPath string, hookAfterInitDB func(dbPath string)) (err error)
	Close()

	GetDocument(key []byte) (content []byte, err error)
	GetMate(key []byte, length int) ([]byte, error)
	GetDocumentByTag(tag []string) []string
	//相同的key会覆盖
	Push(content []byte, mate *DocumentMate) (err error)
	//tag
	GetTags() map[string][]string
	//delete
	DeleteDoc(key []byte) error
	AddTag([]string) error
}

DocumentDataBase document data base

var DocumentDataBaseSingleCase DocumentDataBase

type DocumentLevelDB

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

func (*DocumentLevelDB) AddTag

func (ddb *DocumentLevelDB) AddTag(t []string) error

func (*DocumentLevelDB) Close

func (ddb *DocumentLevelDB) Close()

func (*DocumentLevelDB) DeleteDoc

func (ddb *DocumentLevelDB) DeleteDoc(key []byte) (err error)

func (*DocumentLevelDB) GetDocument

func (ddb *DocumentLevelDB) GetDocument(key []byte) (content []byte, err error)

func (*DocumentLevelDB) GetDocumentByTag

func (ddb *DocumentLevelDB) GetDocumentByTag(tag []string) []string

func (*DocumentLevelDB) GetMate

func (ddb *DocumentLevelDB) GetMate(key []byte, length int) ([]byte, error)

func (*DocumentLevelDB) GetTags

func (ddb *DocumentLevelDB) GetTags() map[string][]string

func (*DocumentLevelDB) Init

func (ddb *DocumentLevelDB) Init(dbPath string, hookAfterInitDB func(dbPath string)) (err error)

func (*DocumentLevelDB) Push

func (ddb *DocumentLevelDB) Push(content []byte, mate *DocumentMate) (err error)

相同的key会覆盖 自动维护 calibration 使用事务

func (*DocumentLevelDB) RemoveTag

func (ddb *DocumentLevelDB) RemoveTag(tagKey string) (err error)

type DocumentMate

type DocumentMate struct {
	ID       string   `json:"id"`
	Title    string   `json:"title"`
	SubTitle string   `json:"subTitle"`
	Tags     []string `json:"tags"`
	Attr     int      `json:"attr"`
	LastTime int64    `json:"time"`
	Abstract string   `json:"abstract"`
}

DocumentMate mate of document

func (*DocumentMate) Decode

func (d *DocumentMate) Decode(content []byte) error

Decode decode

func (*DocumentMate) Encode

func (d *DocumentMate) Encode() ([]byte, error)

Encode encode

type Login

type Login struct {
	IP net.IP
	// contains filtered or unexported fields
}

type LoginTimes

type LoginTimes struct {
	// contains filtered or unexported fields
}
var LoginTimesLog LoginTimes

func (*LoginTimes) Push

func (l *LoginTimes) Push(ip net.IP, success bool) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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