controller

package
v0.0.0-...-046b512 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetURLNameType

func GetURLNameType(sendURL string) map[string]string

Get the file name and type by URL

func LoadConfigFile

func LoadConfigFile(configSrc string) (map[string]interface{}, error)

Read the configuration file

func SaveConfigFile

func SaveConfigFile(configSrc string, configData interface{}) error

Write the configuration file

func SetName

func SetName(name string)

Set name name string - A unique string for all application identifiers

func SimpleHttpGet

func SimpleHttpGet(sendURL string, params map[string][]string) ([]byte, error)

Gets the URL data get mode

func SimpleHttpPost

func SimpleHttpPost(sendURL string, params map[string][]string) ([]byte, error)

Gets the URL data post mode

Types

type Database

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

Database operation module

func (*Database) Close

func (this *Database) Close() error

Close the database connection

func (*Database) Connect

func (this *Database) Connect(dbType string, dbDNS string) error

Connect to the database

func (*Database) Delete

func (this *Database) Delete(table string, id int64) (int64, error)

Removes the specified id

func (*Database) GetField

func (this *Database) GetField(table string, fields []string, field string, value string) (*sql.Row, error)

Gets the specified field

func (*Database) GetFieldsToStr

func (this *Database) GetFieldsToStr(fields []string) string

Obtains a field string based on the number of fields.

func (*Database) GetID

func (this *Database) GetID(table string, fields []string, id int) (*sql.Row, error)

Gets the specified ID

func (*Database) GetList

func (this *Database) GetList(table string, fields []string, page int, max int, sort int, desc bool) (map[int]map[string]interface{}, error)

get the list

func (*Database) GetPageSortStr

func (this *Database) GetPageSortStr(page int, max int, sort string, desc bool) string

Get the sql pagination combo section.

func (*Database) GetResultToList

func (this *Database) GetResultToList(fields []string, result *sql.Rows) (map[int]map[string]interface{}, error)

Obtain a list of data according to the field.

func (*Database) Insert

func (this *Database) Insert(table string, fields []string, values []string)

This is just a placeholder

func (*Database) Update

func (this *Database) Update(table string, setField string, setValue string, id int) (int64, error)

update data

type FileOperate

type FileOperate struct {
}

func (*FileOperate) CopyFile

func (this *FileOperate) CopyFile(src string, dest string) (bool, error)

Copy file

func (*FileOperate) CreateDir

func (this *FileOperate) CreateDir(src string) error

Create a folder

func (*FileOperate) CutFile

func (this *FileOperate) CutFile(src string, newSrc string) error

Modify the file name Can be used to cut files.

func (*FileOperate) DeleteFile

func (this *FileOperate) DeleteFile(src string) error

Delete file

func (*FileOperate) GetFileInfo

func (this *FileOperate) GetFileInfo(src string) (os.FileInfo, error)

Get file information

func (*FileOperate) GetFileList

func (this *FileOperate) GetFileList(src string) ([]string, error)

Gets a list of files under the folder

func (*FileOperate) GetFileListCount

func (this *FileOperate) GetFileListCount(src string) (int, error)

Gets the number of files in the folder

func (*FileOperate) GetFileNames

func (this *FileOperate) GetFileNames(src string) (map[string]string, error)

Gets the file name and type

func (*FileOperate) GetFileSha1

func (this *FileOperate) GetFileSha1(src string) (string, error)

Calculates the file sha1 value

func (*FileOperate) GetFileSize

func (this *FileOperate) GetFileSize(src string) int64

Get the file size

func (*FileOperate) GetPathSep

func (this *FileOperate) GetPathSep() string

Gets the system path separator

func (*FileOperate) GetTimeDirSrc

func (this *FileOperate) GetTimeDirSrc(src string, appendFileType string) (string, error)

Gets the directory path for the time build eg : Return and create the path ,"[src]/201611/" eg : Return and create the path ,"[src]/201611/2016110102-03[appendFileType]"

func (*FileOperate) IsExist

func (this *FileOperate) IsExist(src string) bool

Determine whether the file exists

func (*FileOperate) IsFile

func (this *FileOperate) IsFile(src string) bool

Determine whether the file

func (*FileOperate) IsFolder

func (this *FileOperate) IsFolder(src string) bool

To determine whether the folder

func (*FileOperate) LoadFile

func (this *FileOperate) LoadFile(src string) ([]byte, error)

Load file

func (*FileOperate) WriteFile

func (this *FileOperate) WriteFile(src string, content []byte) error

Write file If the file does not exist, it is created.

func (*FileOperate) WriteFileAppend

func (this *FileOperate) WriteFileAppend(src string, content []byte, isForward bool) error

Append data to a file

type IPAddrs

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

IP address structure

func (*IPAddrs) GetExternal

func (this *IPAddrs) GetExternal() string

Obtain an IP address from the network

func (*IPAddrs) GetIP

func (this *IPAddrs) GetIP() map[string]string

Gets the IP address

func (*IPAddrs) GetInternal

func (this *IPAddrs) GetInternal() string

Get the local IP address

func (*IPAddrs) GetOneIP

func (this *IPAddrs) GetOneIP() string

Gets the one IP address

type Language

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

Language configuration processor

func (*Language) Get

func (this *Language) Get(name string) string

Get the language

func (*Language) Init

func (this *Language) Init(languageName string) bool

Initialize the language configuration processor

type Log

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

log struct You need to set the related configuration. IP address if the output is set, otherwise you can leave empty.

func (*Log) GetNowTime

func (this *Log) GetNowTime() string

Gets the current time

func (*Log) NewLog

func (this *Log) NewLog(msg string, err error)

New log The log is automatically sent according to the settings.

func (*Log) SendFile

func (this *Log) SendFile(content string)

Send log to file

func (*Log) SendFmtPrintln

func (this *Log) SendFmtPrintln(msg string)

Send logs to the console

func (*Log) SetIsAppendIP

func (this *Log) SetIsAppendIP(b bool)

Set is append ip

func (*Log) SetIsAppendTime

func (this *Log) SetIsAppendTime(b bool)

Setis append time

func (*Log) SetIsForward

func (this *Log) SetIsForward(b bool)

Set is forward

func (*Log) SetIsSendErrorToFile

func (this *Log) SetIsSendErrorToFile(b bool)

Set is send error to file

func (*Log) SetIsSendErrorToFmt

func (this *Log) SetIsSendErrorToFmt(b bool)

Set is send error to fmt

func (*Log) SetIsSendMsgToFile

func (this *Log) SetIsSendMsgToFile(b bool)

Set is send error to file

func (*Log) SetIsSendMsgToFmt

func (this *Log) SetIsSendMsgToFmt(b bool)

Set is send msg to fmt

func (*Log) SetLogDirSrc

func (this *Log) SetLogDirSrc(logDirSrc string)

Set log dir src

func (*Log) SetOneFileName

func (this *Log) SetOneFileName(name string)

Set one file name

func (*Log) UpdateIP

func (this *Log) UpdateIP()

Update the IP address

type MatchString

type MatchString struct {
}

Authentication and query modules

func (*MatchString) CheckEmail

func (this *MatchString) CheckEmail(str string) bool

Verify email

func (*MatchString) CheckPassword

func (this *MatchString) CheckPassword(str string) bool

Verify the 6-20 digit password

func (*MatchString) CheckUsername

func (this *MatchString) CheckUsername(str string) bool

Verify the 4-16-digit user name

func (*MatchString) GetRandStr

func (this *MatchString) GetRandStr(n int) string

Get a random number n - range

func (*MatchString) GetSha1

func (this *MatchString) GetSha1(content string) string

Gets the string sha1 value

type Session

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

session struct

func (*Session) Get

func (this *Session) Get(w http.ResponseWriter, r *http.Request, sessionMark string) (map[interface{}]interface{}, bool)

Get the session data

func (*Session) Set

func (this *Session) Set(w http.ResponseWriter, r *http.Request, sessionMark string, data map[interface{}]interface{}) bool

Write session data

Jump to

Keyboard shortcuts

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