models

package
v0.0.0-...-3570084 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2014 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	HasEngine bool

	DbCfg struct {
		Type, Host, Name, User, Pwd, Path, SslMode string
	}

	EnableSQLite3 bool
	UseSQLite3    bool
)
View Source
var (
	ErrUserAlreadyExist = errors.New("User already exist")
	ErrUserNotExist     = errors.New("User does not exist")
	ErrUserNameIllegal  = errors.New("User name contains illegal characters")
)

Functions

func DumpDatabase

func DumpDatabase(filePath string) error

DumpDatabase dumps all data from database to file system.

func IsUserExist

func IsUserExist(name string) (bool, error)

IsUserExist checks if given user name exist, the user name should be noncased unique.

func LoadModelsConfig

func LoadModelsConfig()
Example
fmt.Println("hello, and")
fmt.Println("goodbye")
Output:

hello, and
goodbye

func NewEngine

func NewEngine() (err error)

func SetEngine

func SetEngine() (err error)

Types

type Statistic

type Statistic struct {
	Counter struct {
		User int64
	}
}

func GetStatistic

func GetStatistic() (stats Statistic)

type User

type User struct {
	Id        int64
	LowerName string `xorm:"unique not null"`
	Name      string `xorm:"unique not null"`
	FullName  string
	Email     string `xorm:"unique not null"`
	Password  string `xorm:"not null"`
	LoginName string
	Avatar    string `xorm:"varchar(2048) not null"`
	Location  string
	Website   string
	IsActive  bool
	IsAdmin   bool
	Created   time.Time `xorm:"created"`
	Updated   time.Time `xorm:"updated"`
}

User represents the object of individual and member of organization.

func CreateUser

func CreateUser(u *User) (*User, error)

CreateUser creates record of a new user.

func GetUserByName

func GetUserByName(name string) (*User, error)

GetUserByName returns the user object by given name if exists.

func (u *User) HomeLink() string

HomeLink returns the user home page link.

Jump to

Keyboard shortcuts

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