Documentation
¶
Index ¶
- Variables
- func Delete(ctx context.Context, dbConn *db.MongoDB, id string) error
- func EnsureIndex(ctx context.Context, dbConn *db.MongoDB) error
- func InsertMember(ctx context.Context, dbConn *db.MongoDB, id string, member *Member) error
- func RemoveMember(ctx context.Context, dbConn *db.MongoDB, id string, memberId string) error
- func Update(ctx context.Context, dbConn *db.MongoDB, id string, upd *UpdOrg, now time.Time) error
- func UpdateMember(ctx context.Context, dbConn *db.MongoDB, id string, member *Member) error
- type Member
- type NewOrg
- type Organization
- func Create(ctx context.Context, dbConn *db.MongoDB, nu *Organization, now time.Time) (*Organization, error)
- func Get(ctx context.Context, dbConn *db.MongoDB, id string) (*Organization, error)
- func List(ctx context.Context, dbConn *db.MongoDB, optionsList ...func(*db.ListOpts)) ([]*Organization, error)
- type UpdOrg
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound abstracts the not found error. ErrNotFound = errors.New("Entity not found") // ErrInvalidID occurs when an ID is not in a valid form. ErrInvalidID = errors.New("ID is not in its proper form") // ErrAuthenticationFailure occurs when a user attempts to authenticate but // anything goes wrong. ErrAuthenticationFailure = errors.New("Authentication failed") // ErrForbidden occurs when a user tries to do something that is forbidden to them according to our access control policies. ErrForbidden = errors.New("Attempted action is not allowed") )
Functions ¶
func InsertMember ¶
InsertMember adds a member
func RemoveMember ¶
RemoveMember removes a member from an organization
Types ¶
type Organization ¶
type Organization struct { ID primitive.ObjectID `bson:"_id" json:"id"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` Deleted bool `json:"-" bson:"deleted"` Name string `json:"name" bson:"name"` Industry string `json:"industry" bson:"industry"` Type string `json:"type,omitempty" bson:"type,omitempty"` Size string `json:"size,omitempty" bson:"size,omitempty"` Email string `json:"email" bson:"email,omitempty"` Phone string `json:"phone" bson:"phone,omitempty"` ScreenName string `json:"screenName,omitempty" bson:"screenName,omitempty"` URL string `json:"url,omitempty" bson:"url,omitempty"` Country string `json:"country,omitempty" bson:"country,omitempty"` City string `json:"city,omitempty" bson:"city,omitempty"` Language string `bson:"language,omitempty" json:"language,omitempty"` Timezone string `bson:"timezone,omitempty" json:"timezone,omitempty"` Seats int `bson:"seats" json:"seats"` Members []*Member `json:"members" bson:"members"` }
Organization Model
func Create ¶
func Create(ctx context.Context, dbConn *db.MongoDB, nu *Organization, now time.Time) (*Organization, error)
Create inserts a new user into the database.
type UpdOrg ¶
type UpdOrg struct { Name *string `json:"name,omitempty" bson:"name,omitempty"` Industry *string `json:"industry,omitempty" bson:"industry,omitempty"` Type *string `json:"type,omitempty" bson:"type,omitempty"` Size *string `json:"size,omitempty" bson:"size,omitempty"` Email *string `json:"email,omitempty" bson:"email,omitempty"` Phone *string `json:"phone,omitempty" bson:"phone,omitempty"` ScreenName *string `json:"screenName,omitempty" bson:"screenName,omitempty"` URL *string `json:"url,omitempty" bson:"url,omitempty"` Country *string `json:"country,omitempty" bson:"country,omitempty"` City *string `json:"city,omitempty" bson:"city,omitempty"` Language *string `bson:"language,omitempty" json:"language,omitempty"` Timezone *string `bson:"timezone,omitempty" json:"timezone,omitempty"` Members []*Member `json:"members" bson:"members"` }
Click to show internal directories.
Click to hide internal directories.