db

package
Version: v0.0.0-...-489b206 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2019 License: Unlicense Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Db *sql.DB

	// Test statement to check if cockroach db is alive
	TestStmt *sql.Stmt

	// Authorization
	LoginStmt *sql.Stmt

	// Registration
	RegisterStmt *sql.Stmt

	// Messages
	GetMessagesStmt      *sql.Stmt
	SendMessageStmt      *sql.Stmt
	GetMessagesUsersStmt *sql.Stmt

	// Timeline
	GetFromTimelineStmt *sql.Stmt

	// Users
	GetUsersListStmt              *sql.Stmt
	GetUsersListWithSearchStmt    *sql.Stmt
	GetFriendsList                *sql.Stmt
	GetFriendsCount               *sql.Stmt
	GetFriendsRequestList         *sql.Stmt
	GetRequestedAcceptedForFriend *sql.Stmt

	// Friends
	AddFriendsRequestStmt *sql.Stmt
	ConfirmFriendshipStmt *sql.Stmt

	// Profile
	GetProfileStmt    *sql.Stmt
	AddProfileStmt    *sql.Stmt
	UpdateProfileStmt *sql.Stmt

	// City
	GetCityInfoStmt       *sql.Stmt
	GetCityInfoByNameStmt *sql.Stmt
	AddCityStmt           *sql.Stmt
)

Functions

func Escape

func Escape(q string) string

func EscapeBuffer

func EscapeBuffer(b *bytes.Buffer, q string)

func GetUserFriends

func GetUserFriends(userId uint64) (userIds []uint64, err error)

func GetUserFriendsCount

func GetUserFriendsCount(userId uint64) (cnt uint64, err error)

func GetUserFriendsRequests

func GetUserFriendsRequests(userId uint64) (userIds []uint64, err error)

func GetUserNames

func GetUserNames(userIds []string) (map[string]string, error)

user id is string for simplicity

func INstr

func INstr(values []string) string

INstr is used for VALUES( ... ) and string values

func INuint

func INuint(values []uint64) string

INuint is used for VALUES( ... ) and int values

func InitStmts

func InitStmts()

language=PostgreSQL

func IsUserFriend

func IsUserFriend(userId, friendId uint64) (isFriend, requestAccepted bool, err error)

Types

type City

type City struct {
	Id   uint64
	Name string
	Lon  float64
	Lat  float64
}

func GetCityInfo

func GetCityInfo(id uint64) (*City, error)

func GetCityInfoByName

func GetCityInfoByName(name string) (*City, error)

type Querier

type Querier interface {
	Query(query string, args ...interface{}) (*sql.Rows, error)
}

Source Files

Jump to

Keyboard shortcuts

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