database

package
v0.0.0-...-660965e Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Client *mongo.Client

Client is the mongodb client of the whole application

DB default database to use

View Source
var Tables []string = []string{"users"}

Tables all tables name

View Source
var UserModel *mongo.Collection

UserModel represent users table

View Source
var WorkspaceModel *mongo.Collection

WorkspaceModel reposents workspace table

Functions

func Close

func Close()

Close releases connection opened by database

func CreateWorkspace

func CreateWorkspace(workspace Workspace) error

CreateWorkspace store workspace details in the database

func Drop

func Drop() error

Drop will drop all tables, better be done before running tests

func DropSome

func DropSome(t []string) error

DropSome drops tables that are parsed in t params

func InitDB

func InitDB()

InitDB initiate the database connection and perform a warmup connection

Types

type User

type User struct {
	CreatedAt    time.Duration `json:"created_at"`
	UpdatedAt    time.Duration `json:"updated_at"`
	ClientID     string        `json:"client_id"`
	ClientSecret string        `json:"client_secret"`
	TeamID       string        `json:"team_id"`
}

User represent a user

func ReadUser

func ReadUser(clientID string) (*User, error)

ReadUser read a single user

type Workspace

type Workspace struct {
	slack.OAuthResponse
	CreatedAt int `json:"created_at"`
	UpdatedAt int `json:"updated_at"`
}

Workspace represent workspace

Jump to

Keyboard shortcuts

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