frmPkg

package
v0.0.0-...-4d984ad Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2014 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesGobStruct

func BytesGobStruct(f_b []byte, stur interface{})

BytesGobStruct 将[]byte转成Gob再转成结构体

func BytesToUint16

func BytesToUint16(buf []byte) uint16

BytesToUint16 []byte转uint16

func BytesToUint32

func BytesToUint32(buf []byte) uint32

BytesToUint32 []byte转uint32

func BytesToUint64

func BytesToUint64(buf []byte) uint64

BytesToUint64 []byte转uint64

func BytesToUint8

func BytesToUint8(buf []byte) uint8

BytesToUint8 []byte转uint8

func DirMustEnd

func DirMustEnd(dir string) string

DirMustEnd 判断目录名,如果不是“/”结尾就加上“/”

func FileExist

func FileExist(filename string) bool

文件是否存在

func GetConfig

func GetConfig(sorc string) *goconfig.ConfigFile

GetConfig 为获取配置文件信息

func GetSha1

func GetSha1(data string) string

GetSha1 生成SHA1值

func JsonToStruct

func JsonToStruct(f_b string, stur interface{})

JsonToStruct 将json的字符串转成结构体

func ReadSocketBytes

func ReadSocketBytes(conn net.Conn, len uint64) (returnByte []byte, err error)

ReadSocketBytes 从socket读出一定长度的数据,放入[]byte中,保证完整读出

func ReadSocketToFile

func ReadSocketToFile(conn net.Conn, len uint64, file *os.File) (err error)

ReadSocketToFile 从soket读出文件,用带缓冲的方式写入文件里

func ResourceFileToTree

func ResourceFileToTree(treepoint map[string]ResourceFileTreeStruct, path []string, name, hashid string)

ResourceFileToTree 将资源文件变成树状

func SendSocketBytes

func SendSocketBytes(conn *net.TCPConn, bytes []byte, len uint64) error

func SendSocketFile

func SendSocketFile(conn net.Conn, fileSize uint64, fileName string) (err error)

SendSocketFile 发送一个文件

func StructGobBytes

func StructGobBytes(e interface{}) []byte

StructGobBytes 将结构体数据转成Gob再转成[]Byte

func StructToJson

func StructToJson(e interface{}) string

StructToJson 将结构体转成Json的字符串

func Uint16ToBytes

func Uint16ToBytes(i uint16) []byte

Uint16ToBytes Uint16转[]byte

func Uint32ToBytes

func Uint32ToBytes(i uint32) []byte

Uint32ToBytes Uint32转[]byte

func Uint64ToBytes

func Uint64ToBytes(i uint64) []byte

Uint64ToBytes 为Uint64转[]byte

func Uint8ToBytes

func Uint8ToBytes(i uint8) []byte

Uint8ToBytes Uint8转[]byte

Types

type GroupsTable

type GroupsTable struct {
	Id         uint16 `PK`
	Name       string
	Expend     uint16
	PowerLevel string
	Info       string
}

type IsLoginInfo

type IsLoginInfo struct {
	IsLoginInfoBasic
	LastTime time.Time
}

func NewIsLoginInfo

func NewIsLoginInfo(hashid string, id uint32, name string, groupid uint16, groupname string, unitid uint16, unitname string, lastTime time.Time) *IsLoginInfo

NewIsLoginInfo 是初始化一个人员信息,必须给定name, level, lastTime

func (*IsLoginInfo) NotTimeOut

func (ili *IsLoginInfo) NotTimeOut(timeout int64) bool

NotTimeOut 根据给定的int类型的秒数,判断登录是否已经超时,没超时返回true,超时返回false

func (*IsLoginInfo) UpdateLastTime

func (ili *IsLoginInfo) UpdateLastTime() time.Time

UpdateLastTime 已当前时间写入LastTime中进行更新,并返回写入的时间

type IsLoginInfoBasic

type IsLoginInfoBasic struct {
	HashId    string //登录的hashid
	Id        uint32 //用户ID
	Name      string //用户名
	GroupId   uint16 //所在组ID
	GroupName string //所在组名称
	UnitId    uint16 //所在机构ID
	UnitName  string //所在机构名称
	UPower    UserPower
}

IsLoginInfo 是一个记录单个已经登录的人员信息的表

type OriginFileInfoFullStruct

type OriginFileInfoFullStruct struct {
	FullDir string //完整客户端本地路径
	OriginFileInfoStruct
}

type OriginFileInfoStruct

type OriginFileInfoStruct struct {
	RelativeDir string      //相对路径
	FileName    string      //文件名(只是文件名)
	Size        int64       //文件大小
	Mode        os.FileMode //文件权限
	ModeTime    time.Time   //文件修改日期
}

OriginFileInfoStruct 源文件信息结构体,用于客户端获取本地需上传的文件的相关信息,并由服务端获得并解析。类似os.FileInfo的结构。

type ResourceFileTable

type ResourceFileTable struct {
	ResourceItemTable
	Fname   string
	ExtName string
	Opath   string
	Fpath   string
	Fsite   string
	Fsize   int64
}

type ResourceFileTreeStruct

type ResourceFileTreeStruct struct {
	Name       string
	HashId     string
	IsDir      bool
	PowerLevel uint32
	Type       uint8 //1.直接资源,2.派生文件
	Files      map[string]ResourceFileTreeStruct
}

type ResourceGroupTable

type ResourceGroupTable struct {
	HashId     string
	Name       string
	RtId       uint32
	Info       string
	Btime      int64
	Derivative string
	UnitsId    uint16
	PowerLevel uint8
	UsersId    uint32
	Expand     uint16
	MetaData   string
}

type ResourceGroupTable_MD

type ResourceGroupTable_MD struct {
	Author string
	Editor string
	ISBN   string
}

MetaData

type ResourceGroupTable_RSR

type ResourceGroupTable_RSR struct {
	RtName     string
	UnintsName string
	UsersName  string
}

Related search results

type ResourceItemTable

type ResourceItemTable struct {
	HashId     string
	Name       string
	RiType     uint8
	LastTime   int64
	Version    uint16
	RgHashId   string
	Derivative string
	UnitsId    uint16
	PowerLevel uint32
	UsersId    uint32
	Expand     uint16
	MetaData   string
}

type ResourceRelationTable

type ResourceRelationTable struct {
	QuoteSide string
	BeQuote   string
	RrType    uint8
}

type ResourceStatusTable

type ResourceStatusTable struct {
	HashId  string
	Status1 uint8
	Status2 uint8
	Status4 uint8
	Status5 uint8
	Status6 uint8
	Status7 uint8
	Status8 uint8
	Status9 uint8
}

type ResourceTextTable

type ResourceTextTable struct {
	ResourceItemTable
	ContentType string
	Conent      string
}

type ResourceTypeTable

type ResourceTypeTable struct {
	Id         uint32 `PK`
	Name       string
	PowerLevel uint8
	Expend     uint16
	Info       string
}

type SelfLoginInfo

type SelfLoginInfo struct {
	IsLoginInfoBasic
	SID string
}

func NewSelfLoginInfo

func NewSelfLoginInfo(hashid string, id uint32, name string, groupid uint16, groupname string, unitid uint16, unitname string, sid string) *SelfLoginInfo

type ServersFileInfoStruct

type ServersFileInfoStruct struct {
	FileHash string //文件hash值
	OriginFileInfoStruct
}

ServersFileInfoStruct 服务器的文件信息结构体

type UnitsTable

type UnitsTable struct {
	Id         uint16 `PK`
	Name       string
	Expand     uint16
	PowerLevel string
	Info       string
}

一组数据库表对应结构体

type UserIsLogin

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

UserIsLogin 是一个map,记录所有已经登录的人员信息

func NewUserIsLogin

func NewUserIsLogin() *UserIsLogin

NewUserIsLogin 初始化UserIsLogin的map

func (*UserIsLogin) Add

func (uil *UserIsLogin) Add(ckcode string, hashid string, id uint32, name string, groupid uint16, groupname string, unitid uint16, unitname string, lastTime time.Time) (ili *IsLoginInfo, err error)

Add 增加一条用户信息,返回响应的IsLoginInfo,如果ckcode重复,则返回错误

func (*UserIsLogin) Clean

func (uil *UserIsLogin) Clean(timeout int64)

Clean 清理已经过期的条目,实际清理的过期时间是设置的两倍

func (*UserIsLogin) Del

func (uil *UserIsLogin) Del(ckcode string)

Del 删除一条用户信息,通常是在其过期之后

func (*UserIsLogin) Get

func (uil *UserIsLogin) Get(ckcode string) (ili *IsLoginInfo, err error)

Get 获得ckode的用户登录信息,如果err不为nil则为找不到

type UserPower

type UserPower map[string]map[string]uint8

UserPower 用户具体权限为[权限大类][权限小类]权限级别

func (UserPower) Add

func (up UserPower) Add(key1, key2 string, value uint8)

AddPower 增加一个Power值

func (UserPower) CheckPowerLevel

func (up UserPower) CheckPowerLevel(topp string, secp string, asklevel uint8) bool

CheckPowerLevel 检查UPower的权限

func (UserPower) UpdatePowerLevel

func (up UserPower) UpdatePowerLevel(topp string, secp string, asklevel uint8)

UpdatePowerLevel 更新UserPower的值

type UsersTable

type UsersTable struct {
	Id         uint32 `pk`
	Name       string
	Passwd     string
	UnitsId    uint16
	GroupsId   uint16
	Expend     uint16
	PowerLevel string
}

Jump to

Keyboard shortcuts

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