Documentation ¶
Overview ¶
Package project provides project-related logic
Index ¶
- Constants
- Variables
- func InsertProjectConfigDB(db *sql.DB, p *Project) error
- func InsertProjectConfigTx(db *sql.Tx, p *Project) error
- func InsertProjectDB(db *sql.DB, p *Project) error
- func InsertProjectTx(db *sql.Tx, p *Project) error
- type Config
- func (c Config) CallbackConfig() (url, version, projectKey string)
- func (c Config) HasCallback() bool
- func (c Config) HasValues() bool
- func (c Config) IsSet() bool
- func (c Config) MarshalJSON() ([]byte, error)
- func (c *Config) SetCallbackAPIVersion(ver string)
- func (c *Config) SetCallbackProjectKey(key string)
- func (c *Config) SetCallbackURL(callbackURL string)
- func (c *Config) SetReturnURL(url string)
- func (c *Config) SetWebURL(webURL string)
- func (c *Config) UnmarshalJSON(p []byte) error
- type ConfigJSON
- type Project
- func AllProjectsByPrincipalIDDB(db *sql.DB, principalID int64) ([]*Project, error)
- func ProjectByIDDB(db *sql.DB, projectId int64) (*Project, error)
- func ProjectByIDTx(db *sql.Tx, projectId int64) (*Project, error)
- func ProjectByPrincipalIDAndNameTx(db *sql.Tx, principalID int64, projectName string) (*Project, error)
- func ProjectByPrincipalIDNameDB(db *sql.DB, principalID int64, projectName string) (*Project, error)
- func ProjectByPrincipalIDandIDDB(db *sql.DB, principalID int64, projectId int64) (*Project, error)
- func ProjectByPrincipalIDandIDTx(db *sql.Tx, principalID int64, projectId int64) (*Project, error)
- type Projectkey
Constants ¶
const MetadataModel metadataModel = 0
representation of the metadata schema structure
Variables ¶
var ( // ErrProjectNotFound will be returned by select functions when the requested // project was not found ErrProjectNotFound = errors.New("project not found") // ErrProjectKeyNotFound will be returned by select functions when the requested // project key was not found ErrProjectKeyNotFound = errors.New("project key not found") )
Functions ¶
func InsertProjectConfigDB ¶
InsertProjectConfigDB sets a new project config
It will update the project config timestamp
func InsertProjectConfigTx ¶
InsertProjectConfigTx sets a new project config
It will update the project config timestamp
func InsertProjectDB ¶
InsertProjectDB inserts a project
This will modify the given project, setting the ID field.
Types ¶
type Config ¶
type Config struct { Timestamp time.Time WebURL sql.NullString CallbackURL sql.NullString CallbackAPIVersion sql.NullString CallbackProjectKey sql.NullString ReturnURL sql.NullString }
func (Config) CallbackConfig ¶
func (Config) HasCallback ¶
func (Config) MarshalJSON ¶
func (*Config) SetCallbackAPIVersion ¶
func (*Config) SetCallbackProjectKey ¶
func (*Config) SetCallbackURL ¶
func (*Config) SetReturnURL ¶
func (*Config) UnmarshalJSON ¶
type ConfigJSON ¶
type Project ¶
type Project struct { ID int64 `json:",string"` PrincipalID int64 `json:",string"` Name string Created time.Time CreatedBy string Config Config Metadata map[string]string `json:",omitempty"` }
Project represents a project
A project is a resource of a principle. It has its payment methodes and can be used to separate different business units of one principle
func ProjectByIDDB ¶
ProjectByIdDB selects a project by the given project id
If no such project exists, it will return an empty project
func ProjectByIDTx ¶
ProjectByIdTx selects a project by the given project id
If no such project exists, it will return an empty project
func ProjectByPrincipalIDAndNameTx ¶
func ProjectByPrincipalIDAndNameTx(db *sql.Tx, principalID int64, projectName string) (*Project, error)
ProjectByNameTx selects a project by the given project name
If no such project exists, it will return an empty project
func ProjectByPrincipalIDNameDB ¶
func ProjectByPrincipalIDNameDB(db *sql.DB, principalID int64, projectName string) (*Project, error)
ProjectByName selects a project by the given project name
If no such project exists, it will return an empty project
func ProjectByPrincipalIDandIDDB ¶
ProjectByIdDB selects a project by the given project id
If no such project exists, it will return an empty project
func ProjectByPrincipalIDandIDTx ¶
ProjectByIdTx selects a project by the given project id
If no such project exists, it will return an empty project
type Projectkey ¶
type Projectkey struct { Key string Timestamp time.Time Project Project CreatedBy string Secret string Active bool // contains filtered or unexported fields }
ProjectKey represents a project key
func ProjectKeyByKeyDB ¶
func ProjectKeyByKeyDB(db *sql.DB, key string) (*Projectkey, error)
ProjectKeyByKeyDB selects a project key by the given key
func ProjectKeyByKeyTx ¶
func ProjectKeyByKeyTx(db *sql.Tx, key string) (*Projectkey, error)
ProjectKeyByKeyTx selects a project key by the given key
func (*Projectkey) IsValid ¶
func (p *Projectkey) IsValid() bool
IsValid returns true if the project key is considered valid
func (*Projectkey) SecretBytes ¶
func (p *Projectkey) SecretBytes() ([]byte, error)
SecretBytes returns the binary representation of the shared secret