chat

package
v0.0.0-...-93b93ea Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: MIT-0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCassandraSession

func CreateCassandraSession() (*gocql.Session, error)

connect to the cluster My envroiment : local laptop need to connect cassandra cluster with ssh tunnel example ssh ssh.host -L 9042:cassandra.host:9042

func CreatePKChatroomTable

func CreatePKChatroomTable(session *gocql.Session)

func CreatePKNameTable

func CreatePKNameTable(session *gocql.Session)

create chat table

func GetAllChatData

func GetAllChatData(c *gin.Context)

func GetHTMLPage

func GetHTMLPage(c *gin.Context)

func GetLatestChatData

func GetLatestChatData(c *gin.Context)

func GetRunTestResult

func GetRunTestResult(c *gin.Context)

func GetServerStatus

func GetServerStatus(c *gin.Context)

func InitApi

func InitApi() (Env, *gocql.Session, Comment)

func InitGinApp

func InitGinApp(r *gin.Engine)

func PostInsertChatData

func PostInsertChatData(c *gin.Context)

Types

type Comment

type Comment struct {
	Name     string `form:"name" json:"name"`
	Time     int64  `form:"time" json:"time"`
	Chatroom string `form:"chatroom" json:"chatroom"`
	Comment  string `form:"comment" json:"comment"`
}

func AllSelectData

func AllSelectData(session *gocql.Session) []Comment

list all chat

func ChatroomAllData

func ChatroomAllData(session *gocql.Session, chatroom string) []Comment

func ChatroomLatestData

func ChatroomLatestData(session *gocql.Session, chatroom string) []Comment

func GenerateChatData

func GenerateChatData() Comment

generate random test data

func InsertData

func InsertData(session *gocql.Session, chatData *Comment) *Comment

Insert test data

func SelectTestData

func SelectTestData(session *gocql.Session, chatData *Comment) Comment

Get Insert data

type Comments

type Comments struct {
	Response []Comment `form:"name" json:"response"`
}

type Env

type Env struct {
	AppEnv            string `envconfig:"APP_ENV" default:"test"`
	AppPort           string `envconfig:"APP_PORT" default:"8081"`
	AppEndpoint       string `envconfig:"APP_ENDPOINT" default:"http://127.0.0.1"`
	CassdraEndpoint   string `envconfig:"CASSANDRA_ENDPOINT" default:"127.0.0.1"`
	CassandraPort     int    `envconfig:"CASSANDRA_PORT" default:"9042"`
	CassandraUserName string `envconfig:"CASSANDRA_USER" default:"cassandra"`
	CassandraUserPass string `envconfig:"CASSANDRA_PASS" default:"cassandra"`
	CassandraKeyspace string `envconfig:"CASSANDRA_KS" default:"example"`
}

func CreateSessionConf

func CreateSessionConf(env Env) (*gocql.ClusterConfig, Env)

func GetEnvValue

func GetEnvValue() Env

Jump to

Keyboard shortcuts

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