project

package
v0.0.0-...-b3f3fbb Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2015 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Overview

Package project provides project-related logic

Index

Constants

View Source
const MetadataModel metadataModel = 0

representation of the metadata schema structure

Variables

View Source
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

func InsertProjectConfigDB(db *sql.DB, p *Project) error

InsertProjectConfigDB sets a new project config

It will update the project config timestamp

func InsertProjectConfigTx

func InsertProjectConfigTx(db *sql.Tx, p *Project) error

InsertProjectConfigTx sets a new project config

It will update the project config timestamp

func InsertProjectDB

func InsertProjectDB(db *sql.DB, p *Project) error

InsertProjectDB inserts a project

This will modify the given project, setting the ID field.

func InsertProjectTx

func InsertProjectTx(db *sql.Tx, p *Project) error

InsertProjectTx 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 (c Config) CallbackConfig() (url, version, projectKey string)

func (Config) HasCallback

func (c Config) HasCallback() bool

func (Config) HasValues

func (c Config) HasValues() bool

HasValues returns true if the config has any values set

func (Config) IsSet

func (c Config) IsSet() bool

IsSet returns true if the config was set and stored

func (Config) MarshalJSON

func (c Config) MarshalJSON() ([]byte, error)

func (*Config) SetCallbackAPIVersion

func (c *Config) SetCallbackAPIVersion(ver string)

func (*Config) SetCallbackProjectKey

func (c *Config) SetCallbackProjectKey(key string)

func (*Config) SetCallbackURL

func (c *Config) SetCallbackURL(callbackURL string)

func (*Config) SetReturnURL

func (c *Config) SetReturnURL(url string)

func (*Config) SetWebURL

func (c *Config) SetWebURL(webURL string)

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(p []byte) error

type ConfigJSON

type ConfigJSON struct {
	WebURL             *string
	CallbackURL        *string
	CallbackAPIVersion *string
	CallbackProjectKey *string
	ReturnURL          *string
}

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 AllProjectsByPrincipalIDDB

func AllProjectsByPrincipalIDDB(db *sql.DB, principalID int64) ([]*Project, error)

func ProjectByIDDB

func ProjectByIDDB(db *sql.DB, projectId int64) (*Project, error)

ProjectByIdDB selects a project by the given project id

If no such project exists, it will return an empty project

func ProjectByIDTx

func ProjectByIDTx(db *sql.Tx, projectId int64) (*Project, error)

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

func ProjectByPrincipalIDandIDDB(db *sql.DB, principalID int64, projectId int64) (*Project, error)

ProjectByIdDB selects a project by the given project id

If no such project exists, it will return an empty project

func ProjectByPrincipalIDandIDTx

func ProjectByPrincipalIDandIDTx(db *sql.Tx, principalID int64, projectId int64) (*Project, error)

ProjectByIdTx selects a project by the given project id

If no such project exists, it will return an empty project

func (*Project) Empty

func (p *Project) Empty() bool

Empty returns true if the project is considered empty/uninitialized

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

Jump to

Keyboard shortcuts

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