postgres

package
Version: v0.0.0-...-9e745d5 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: Apache-2.0 Imports: 4 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Driver   string
	User     string
	Password string
	DataBase string
	SSLMode  string
}

Config for client postgres DB

type Host

type Host struct {
	ID       int64    `json:"id"`
	Host     string   `json:"host"`
	Type     string   `json:"type`
	User     string   `json:user`
	State    string   `json:"state,omitempty"`
	Projects []string `json:"projects"`
}

Host - struct for response all hosts data

type PGClient

type PGClient struct {
	DB *sql.DB
}

PGClient struct for postgres client

func (PGClient) ChangeUserPassword

func (c PGClient) ChangeUserPassword(id int64, password string) (err error)

ChangeUserPassword - delete user

func (PGClient) CheckScenario

func (c PGClient) CheckScenario(name string, gun string, projects string) (res bool, err error)

CheckScenario - Check scenario, if exist return true, if not exist return fasle

func (PGClient) DeleteHost

func (c PGClient) DeleteHost(id int64) (err error)

DeleteHost - delete host

func (PGClient) DeleteProject

func (c PGClient) DeleteProject(id int64) (err error)

DeleteProject - update projects values to table scenarios

func (PGClient) DeleteRole

func (c PGClient) DeleteRole(id int64) (err error)

DeleteRole - update role values to table scenarios

func (PGClient) DeleteScenario

func (c PGClient) DeleteScenario(id int64) (err error)

DeleteScenario - delete scenario from db

func (PGClient) DeleteService

func (c PGClient) DeleteService(id int64) (err error)

DeleteService - func for delete row from db

func (PGClient) DeleteServiceBin

func (c PGClient) DeleteServiceBin(id int64) (err error)

DeleteServiceBin - delete row from table tBins

func (PGClient) DeleteUser

func (c PGClient) DeleteUser(id int64) (err error)

DeleteUser - delete user

func (PGClient) GetAllGenerators

func (c PGClient) GetAllGenerators() ([]Host, error)

GetAllGenerators - return all generators info.

func (PGClient) GetAllHosts

func (c PGClient) GetAllHosts() ([]Host, error)

GetAllHosts - func return all hosts

func (PGClient) GetAllHostsWithProject

func (c PGClient) GetAllHostsWithProject(project string) ([]Host, error)

GetAllHostsWithProject - func return all hosts

func (PGClient) GetAllProjects

func (c PGClient) GetAllProjects() ([]Project, error)

GetAllProjects - func return all projects

func (PGClient) GetAllRoles

func (c PGClient) GetAllRoles() ([]Role, error)

GetAllRoles - func return all projects

func (PGClient) GetAllScenarios

func (c PGClient) GetAllScenarios() (*[]Scenario, error)

GetAllScenarios - return all scenario info

func (PGClient) GetAllServiceBinsByOwner

func (c PGClient) GetAllServiceBinsByOwner(projectIDs []string) (*[]ServiceBinsByOwner, error)

GetAllServiceBinsByOwner - return all servicebins info

func (PGClient) GetAllServiceBinsType

func (c PGClient) GetAllServiceBinsType() (*[]ServiceBin, error)

GetAllServiceBinsType - return all servicebins type

func (PGClient) GetAllServices

func (c PGClient) GetAllServices() (*[]Service, error)

GetAllServices - return all services info

func (PGClient) GetAllUsers

func (c PGClient) GetAllUsers() (users []User, err error)

GetAllUsers - return user password expiration

func (PGClient) GetLastScenarioID

func (c PGClient) GetLastScenarioID() (id int64, err error)

GetLastScenarioID - func to return lfst scenario id

func (PGClient) GetNewRunID

func (c PGClient) GetNewRunID() (runID int64, err error)

GetNewRunID - return new run ID

func (PGClient) GetProjectName

func (c PGClient) GetProjectName(id int64) (projectName string, err error)

GetProjectName - func return project name

func (PGClient) GetProjectsIDtoString

func (c PGClient) GetProjectsIDtoString(projects []string) (ids []string, err error)

GetProjectsIDtoString - func to return all users role and project for front project and role models

func (PGClient) GetScenarioName

func (c PGClient) GetScenarioName(id int64) (res string, err error)

GetScenarioName - insert new scenario values to table scenarios

func (PGClient) GetService

func (c PGClient) GetService(id int64) (res *Service, err error)

GetService - return ONLY type,name and runSTR for service

func (PGClient) GetServiceBin

func (c PGClient) GetServiceBin(id int64) (*ServiceBin, error)

GetServiceBin return serviceBin info(ONLY ID, Name, Type and runSTR)

func (PGClient) GetServicesByProject

func (c PGClient) GetServicesByProject(projects []string) (*[]Service, error)

GetServicesByProject - func return all service for user project

func (PGClient) GetUserHash

func (c PGClient) GetUserHash(user string) (hash string, err error)

GetUserHash - return user password hash

func (PGClient) GetUserIDAndRole

func (c PGClient) GetUserIDAndRole(user string) (id int64, role string, err error)

GetUserIDAndRole - func to return all users role and project for front project and role models

func (PGClient) GetUserPasswordExp

func (c PGClient) GetUserPasswordExp(user string) (exp string, err error)

GetUserPasswordExp - return user password expiration

func (PGClient) GetUserProjects

func (c PGClient) GetUserProjects(userID int64) (projects []string, err error)

GetUserProjects - func to return all users role and project for front project and role models

func (PGClient) GetUserRoleAndProjects

func (c PGClient) GetUserRoleAndProjects(user string) (role string, projects []string, err error)

GetUserRoleAndProjects - func to return all users role and project for front project and role models

func (PGClient) GetUserToHost

func (c PGClient) GetUserToHost(ip string) (user string, err error)

GetUserToHost - func return user to host

func (PGClient) GetUsersAndHosts

func (c PGClient) GetUsersAndHosts() (map[string]string, error)

GetUsersAndHosts - func return ipp host and user for him

func (PGClient) HostIfExist

func (c PGClient) HostIfExist(ip string) (bool, error)

HostIfExist - chacke host, is exist return true

func (PGClient) NewHost

func (c PGClient) NewHost(ip string, user string, hostType string, projects []string) (err error)

NewHost - insert new host from database

func (PGClient) NewProject

func (c PGClient) NewProject(project string) (err error)

NewProject - insert new projects from database

func (PGClient) NewRole

func (c PGClient) NewRole(role string) (err error)

NewRole - insert new role from database

func (PGClient) NewScenario

func (c PGClient) NewScenario(name string, typeTest string, gun string, projects string, params string) (err error)

NewScenario - insert new scenario values to table scenarios

func (PGClient) NewService

func (c PGClient) NewService(name string, binsIB int64, host string, port int, typeService string, runSTR string, projects []string, owner string) (err error)

NewService - insert new scenario values to table scenarios

func (PGClient) NewServiceBin

func (c PGClient) NewServiceBin(name string, typeService string, runSTR string, own string, projects []string) (err error)

NewServiceBin - insert new scenario values to table scenarios

func (PGClient) NewUser

func (c PGClient) NewUser(users string, password string, role string, projects []string) error

NewUser - func create new users

func (PGClient) SetStartTest

func (c PGClient) SetStartTest(testName string, testType string) (err error)

SetStartTest - insert scenario values to table runs at start scenario

func (PGClient) SetStopTest

func (c PGClient) SetStopTest(runID string) error

SetStopTest - stop runs scenario. Send kill to parent procces a gatling

func (PGClient) UpdateHost

func (c PGClient) UpdateHost(id int64, ip string, hostType string, user string) (err error)

UpdateHost - update host values to table scenarios

func (PGClient) UpdateProject

func (c PGClient) UpdateProject(id int64, project string, status string) (err error)

UpdateProject - insert new projects from database

func (PGClient) UpdateRole

func (c PGClient) UpdateRole(id int64, role string) (err error)

UpdateRole - update role values

func (PGClient) UpdateScenario

func (c PGClient) UpdateScenario(id int64, name string, typeTest string, gun string, projects string, params string) (err error)

UpdateScenario - update scenario values to table scenarios

func (PGClient) UpdateService

func (c PGClient) UpdateService(id int64, port int, runSTR string) (err error)

UpdateService - update service values in database wothout string for run service

func (PGClient) UpdateServiceBin

func (c PGClient) UpdateServiceBin(id int64, runSTR string, projects []string) (err error)

UpdateServiceBin - func for update bins info

func (PGClient) UpdateUser

func (c PGClient) UpdateUser(id string, role string, projects []string) error

UpdateUser - func for update users, if len slice project ==0, projects not updatet

func (PGClient) UpdatetHostProjects

func (c PGClient) UpdatetHostProjects(id int64, projects []string) error

UpdatetHostProjects -

func (PGClient) UpdatetUserProjects

func (c PGClient) UpdatetUserProjects(id int64, projects []string) error

UpdatetUserProjects -

type Project

type Project struct {
	ID     int64  `json:"id"`
	Name   string `json:"name"`
	Status string `json:"status"`
}

Project - temp struct for response all Projects data

type Role

type Role struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

Role struct for return all roles

type Scenario

type Scenario struct {
	ID           int64  `json:"id"`
	Name         string `json:"name"`
	Type         string `json:"type"`
	Gun          string `json:"gun"`
	LastModified string `json:"lastmodified"`
	Projects     string `json:"projects"`
	TreadGroups  string `json:"params"`
}

Scenario - struct for return all scenario

type Service

type Service struct {
	ID       int64    `json:"id"`
	Name     string   `json:"name"`
	Host     string   `json:"host"`
	Port     int      `json:"port"`
	Owner    string   `json:"owner"`
	Type     string   `json:"type"`
	RunSTR   string   `json:"runstr"`
	BinsID   int64    `json:"binsid"`
	Status   string   `json:"status,omitempty"`
	Projects []string `json:"projects"`
}

Service - struct for return all service

type ServiceBin

type ServiceBin struct {
	ID           int64    `json:"id"`
	Name         string   `json:"name,omitempty"`
	Type         string   `json:"type,omitempty"`
	RunSTR       string   `json:"runstr,omitempty"`
	Owner        string   `json:"owner,omitempty"`
	LastModified string   `json:"lastmodified,omitempty"`
	Projects     []string `json:"projects,omitempty"`
}

ServiceBin - substruct for AllServiceBinsByOwner

type ServiceBinsByOwner

type ServiceBinsByOwner struct {
	Owner    string       `json:"owner"`
	Services []ServiceBin `json:"services"`
}

ServiceBinsByOwner - struct for return all servicebins, sort by owner

type User

type User struct {
	ID       int64    `json:"id,omitempty"`
	User     string   `json:"user,omitempty"`
	Password string   `json:"password,omitempty"`
	Role     string   `json:"role,omitempty"`
	Projects []string `json:"projects,omitempty"`
}

User struct data user for returln all users

Jump to

Keyboard shortcuts

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