Documentation ¶
Index ¶
- type PostgreSQL
- func (pg *PostgreSQL) AppendRawData(projectName string, raw models.Raw) error
- func (pg *PostgreSQL) Connect(c *config.ConfigToml) error
- func (pg *PostgreSQL) CreateDomain(projectName string, domain models.Domain) error
- func (pg *PostgreSQL) CreateIP(projectName string, ip models.IP) error
- func (pg *PostgreSQL) CreateOrUpdateDomain(projectName string, domain models.Domain) error
- func (pg *PostgreSQL) CreateOrUpdateDomains(projectName string, domains []models.Domain) error
- func (pg *PostgreSQL) CreateOrUpdateIP(projectName string, ip models.IP) error
- func (pg *PostgreSQL) CreateOrUpdateIPs(projectName string, ips []models.IP) error
- func (pg *PostgreSQL) CreateOrUpdatePort(projectName string, ip string, port models.Port) error
- func (pg *PostgreSQL) CreateOrUpdatePorts(projectName string, ip string, ports []models.Port) error
- func (pg *PostgreSQL) CreateOrUpdateProject(project models.Project) error
- func (pg *PostgreSQL) CreateOrUpdateURI(projectName string, ip string, port string, uri models.URI) error
- func (pg *PostgreSQL) CreateOrUpdateURIs(projectName string, ip string, port string, uris []models.URI) error
- func (pg *PostgreSQL) CreateOrUpdateUser(user models.User) error
- func (pg *PostgreSQL) CreatePort(projectName string, ip string, port models.Port) error
- func (pg *PostgreSQL) CreateProject(project models.Project) error
- func (pg *PostgreSQL) CreateURI(projectName string, ip string, port string, URI models.URI) error
- func (pg *PostgreSQL) CreateUser(user models.User) error
- func (pg *PostgreSQL) DeleteDatabase() error
- func (pg *PostgreSQL) DeleteDomain(projectName string, domain models.Domain) error
- func (pg *PostgreSQL) DeleteIP(ip models.IP) error
- func (pg *PostgreSQL) DeletePort(projectName string, ip string, port models.Port) error
- func (pg *PostgreSQL) DeleteProject(project models.Project) error
- func (pg *PostgreSQL) DeleteURI(projectName string, ip string, port string, dir models.URI) error
- func (pg *PostgreSQL) DeleteUser(user models.User) error
- func (pg *PostgreSQL) GenerateNewToken(user models.User) error
- func (pg *PostgreSQL) GetDomain(projectName string, domainName string) (models.Domain, error)
- func (pg *PostgreSQL) GetDomains(projectName string) ([]models.Domain, error)
- func (pg *PostgreSQL) GetIP(projectName string, ip string) (models.IP, error)
- func (pg *PostgreSQL) GetIPs(projectName string) ([]models.IP, error)
- func (pg *PostgreSQL) GetPort(projectName string, ip string, port string) (models.Port, error)
- func (pg *PostgreSQL) GetPorts(projectName string, ip string) ([]models.Port, error)
- func (pg *PostgreSQL) GetProject(projectName string) (models.Project, error)
- func (pg *PostgreSQL) GetProjects() ([]models.Project, error)
- func (pg *PostgreSQL) GetRawModule(projectName string, moduleName string) (map[string][]models.Raw, error)
- func (pg *PostgreSQL) GetRaws(projectName string) ([]models.Raw, error)
- func (pg *PostgreSQL) GetURI(projectName string, ip string, port string, dir string) (models.URI, error)
- func (pg *PostgreSQL) GetURIs(projectName string, ip string, port string) ([]models.URI, error)
- func (pg *PostgreSQL) GetUser(username string) (models.User, error)
- func (pg *PostgreSQL) GetUserByToken(token string) (models.User, error)
- func (pg *PostgreSQL) Name() string
- func (pg *PostgreSQL) SetupAuth(username, password, dbname string) error
- func (pg *PostgreSQL) SetupDatabase() error
- func (pg *PostgreSQL) UpdateDomain(projectName string, domain models.Domain) error
- func (pg *PostgreSQL) UpdateIP(projectName string, ip models.IP) error
- func (pg *PostgreSQL) UpdatePort(projectName string, ip string, port models.Port) error
- func (pg *PostgreSQL) UpdateProject(project models.Project) error
- func (pg *PostgreSQL) UpdateURI(projectName string, ip string, port string, URI models.URI) error
- func (pg *PostgreSQL) UpdateUser(user models.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgreSQL ¶
type PostgreSQL struct {
// contains filtered or unexported fields
}
PostgreSQL is the structure representing this adapter
func InitDatabase ¶
func InitDatabase(c *config.ConfigToml) *PostgreSQL
InitDatabase is only there to sets up the configuration of the database. This adapters need to connect to the database before any actions.
func (*PostgreSQL) AppendRawData ¶
func (pg *PostgreSQL) AppendRawData(projectName string, raw models.Raw) error
AppendRawData is the public wrapper to insert raw data into the database.
func (*PostgreSQL) Connect ¶
func (pg *PostgreSQL) Connect(c *config.ConfigToml) error
Connect is trying to connect to the database (and writing the connection to pg.db) with the provided configuration.
func (*PostgreSQL) CreateDomain ¶
func (pg *PostgreSQL) CreateDomain(projectName string, domain models.Domain) error
CreateDomain is the public wrapper to create a new Domain in the database.
func (*PostgreSQL) CreateIP ¶
func (pg *PostgreSQL) CreateIP(projectName string, ip models.IP) error
CreateIP is the public wrapper to create a new IP in the database.
func (*PostgreSQL) CreateOrUpdateDomain ¶
func (pg *PostgreSQL) CreateOrUpdateDomain(projectName string, domain models.Domain) error
CreateOrUpdateDomain is the "public" handler for creating a new or updating a domain name. It is the same function for subdomains as they are handled in the exact same manner.
func (*PostgreSQL) CreateOrUpdateDomains ¶
func (pg *PostgreSQL) CreateOrUpdateDomains(projectName string, domains []models.Domain) error
CreateOrUpdateDomains is the "public" handler for creating a new or updating multiple domains name. This function should be used instead of CreateOrUpdateDomain during bulk inserts.
func (*PostgreSQL) CreateOrUpdateIP ¶
func (pg *PostgreSQL) CreateOrUpdateIP(projectName string, ip models.IP) error
CreateOrUpdateIP is the public wrapper to create or update a new IP in the database.
func (*PostgreSQL) CreateOrUpdateIPs ¶
func (pg *PostgreSQL) CreateOrUpdateIPs(projectName string, ips []models.IP) error
CreateOrUpdateIPs is the public wrapper to create or update multiple IP This function should be used instead of CreateOrUpdateIP during bulk inserts.
func (*PostgreSQL) CreateOrUpdatePort ¶
CreateOrUpdatePort is the public wrapper to create or update a new port in the database.
func (*PostgreSQL) CreateOrUpdatePorts ¶
CreateOrUpdatePorts is the public wrapper to create or update multiple Port This function should be used instead of CreateOrUpdatePort during bulk inserts.
func (*PostgreSQL) CreateOrUpdateProject ¶
func (pg *PostgreSQL) CreateOrUpdateProject(project models.Project) error
CreateOrUpdateProject is the public wrapper to create or update a new project in the database.
func (*PostgreSQL) CreateOrUpdateURI ¶
func (pg *PostgreSQL) CreateOrUpdateURI(projectName string, ip string, port string, uri models.URI) error
CreateOrUpdateURI is the public wrapper to create or update a new URI for a project, ip and port.
func (*PostgreSQL) CreateOrUpdateURIs ¶
func (pg *PostgreSQL) CreateOrUpdateURIs(projectName string, ip string, port string, uris []models.URI) error
CreateOrUpdateURIs is the bulk insert version of CreateOrUpdateURI
func (*PostgreSQL) CreateOrUpdateUser ¶
func (pg *PostgreSQL) CreateOrUpdateUser(user models.User) error
CreateOrUpdateUser will create or update a new user in the database. If the user already exist,
func (*PostgreSQL) CreatePort ¶
CreatePort is the public wrapper to create a new port in the database.
func (*PostgreSQL) CreateProject ¶
func (pg *PostgreSQL) CreateProject(project models.Project) error
CreateProject is the public wrapper to create a new Project in the database.
func (*PostgreSQL) CreateUser ¶
func (pg *PostgreSQL) CreateUser(user models.User) error
CreateUser is the public wrapper to create a new User in the database.
func (*PostgreSQL) DeleteDatabase ¶
func (pg *PostgreSQL) DeleteDatabase() error
DeleteDatabase will drop all tables and remove the database from postgres
func (*PostgreSQL) DeleteDomain ¶
func (pg *PostgreSQL) DeleteDomain(projectName string, domain models.Domain) error
DeleteDomain remove a domain from the database. TOFIX
func (*PostgreSQL) DeletePort ¶
DeletePort TOFIX
func (*PostgreSQL) DeleteProject ¶
func (pg *PostgreSQL) DeleteProject(project models.Project) error
DeleteProject TOFIX
func (*PostgreSQL) DeleteUser ¶
func (pg *PostgreSQL) DeleteUser(user models.User) error
DeleteUser remove the user from the database (using its ID)
func (*PostgreSQL) GenerateNewToken ¶
func (pg *PostgreSQL) GenerateNewToken(user models.User) error
GenerateNewToken generates a new token and save it in the database. It uses the function GenerateNewToken provided by the `models` class
func (*PostgreSQL) GetDomain ¶
GetDomain is the public wrapper to get a domain information based on the project name and domain name.
func (*PostgreSQL) GetDomains ¶
func (pg *PostgreSQL) GetDomains(projectName string) ([]models.Domain, error)
GetDomains is the public wrapper for accessing the lists of all domains name found for a project.
func (*PostgreSQL) GetIPs ¶
func (pg *PostgreSQL) GetIPs(projectName string) ([]models.IP, error)
GetIPs is the public wrapper for getting all the IP for a project
func (*PostgreSQL) GetPort ¶
GetPort is the public wrapper for getting a specific port for a project based on the IP and port.
func (*PostgreSQL) GetPorts ¶
GetPorts is the public wrapper for getting all the ports for a project and a specific IP
func (*PostgreSQL) GetProject ¶
func (pg *PostgreSQL) GetProject(projectName string) (models.Project, error)
GetProject is the public wrapper for getting all the informations on a specific project
func (*PostgreSQL) GetProjects ¶
func (pg *PostgreSQL) GetProjects() ([]models.Project, error)
GetProjects is the public wrapper for getting all the project available
func (*PostgreSQL) GetRawModule ¶
func (pg *PostgreSQL) GetRawModule(projectName string, moduleName string) (map[string][]models.Raw, error)
GetRawModule is the public wrapper to get all the raw data for a specific module name.
func (*PostgreSQL) GetRaws ¶
func (pg *PostgreSQL) GetRaws(projectName string) ([]models.Raw, error)
GetRaws is the public wrapper to get all the raw data for a project.
func (*PostgreSQL) GetURI ¶
func (pg *PostgreSQL) GetURI(projectName string, ip string, port string, dir string) (models.URI, error)
GetURI will return one URI in the database from a project ip and port combo. This function is a wrapper around `getURI`
func (*PostgreSQL) GetURIs ¶
GetURIs will return all the available URI in the database from a project ip and port combo. This function is a wrapper around `getURIs`
func (*PostgreSQL) GetUser ¶
func (pg *PostgreSQL) GetUser(username string) (models.User, error)
GetUser will return the user information by it's username
func (*PostgreSQL) GetUserByToken ¶
func (pg *PostgreSQL) GetUserByToken(token string) (models.User, error)
GetUserByToken will return the user information by it's token
func (*PostgreSQL) Name ¶
func (pg *PostgreSQL) Name() string
Name return the name of the adapter. It is exported because it's called from other core packages.
func (*PostgreSQL) SetupAuth ¶
func (pg *PostgreSQL) SetupAuth(username, password, dbname string) error
SetupAuth TOFIX
func (*PostgreSQL) SetupDatabase ¶
func (pg *PostgreSQL) SetupDatabase() error
SetupDatabase will create the database tables
func (*PostgreSQL) UpdateDomain ¶
func (pg *PostgreSQL) UpdateDomain(projectName string, domain models.Domain) error
UpdateDomain is the public wrapper to update a new Domain in the database.
func (*PostgreSQL) UpdateIP ¶
func (pg *PostgreSQL) UpdateIP(projectName string, ip models.IP) error
UpdateIP is the public wrapper to update a new IP in the database.
func (*PostgreSQL) UpdatePort ¶
UpdatePort is the public wrapper to update a new port in the database.
func (*PostgreSQL) UpdateProject ¶
func (pg *PostgreSQL) UpdateProject(project models.Project) error
UpdateProject is the public wrapper to update a new Project in the database.
func (*PostgreSQL) UpdateUser ¶
func (pg *PostgreSQL) UpdateUser(user models.User) error
UpdateUser is the public wrapper to update a new User in the database.