Documentation ¶
Index ¶
- Variables
- type DB
- func (db *DB) AddProject(ctx context.Context, project Project) error
- func (db *DB) Connect(ctx context.Context, uri string) error
- func (db *DB) LastSync(ctx context.Context) LastSync
- func (db *DB) Projects(ctx context.Context) ([]Project, error)
- func (db *DB) RemoveProject(ctx context.Context, id primitive.ObjectID) error
- func (db *DB) UpdateProject(ctx context.Context, project Project) error
- func (db *DB) WriteLastSync(ctx context.Context, timestamp time.Time) error
- type LastSync
- type Project
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ConnectionTimeout is the default timeout for connecting to the database. ConnectionTimeout = 60 * time.Second // DatabaseName is the name of the database DatabaseName = "ado-asana-sync" // Timeout is the default timeout for database operations. Timeout = 10 * time.Second )
View Source
var (
// LastSyncCollection is the name of the collection in the database
LastSyncCollection = "last_sync"
)
View Source
var (
// ProjectsCollection is the name of the collection in the database
ProjectsCollection = "projects"
)
Functions ¶
This section is empty.
Types ¶
type DB ¶
func (*DB) AddProject ¶
AddProject adds a new project to the database. It takes a Project struct as input and returns an error, if any.
func (*DB) Projects ¶
Projects retrieves all projects from the database. It returns a slice of Project structs and an error, if any.
func (*DB) RemoveProject ¶
RemoveProject removes a project from the database based on its ID. It takes an ID ObjectID as input and returns an error, if any.
func (*DB) UpdateProject ¶
UpdateProject updates an existing project in the database. It takes a Project struct as input and returns an error, if any.
type Project ¶
type Project struct { ID primitive.ObjectID `json:"id" bson:"_id"` ADOProjectName string `json:"ado_project_name" bson:"ado_project_name"` ADOTeamName string `json:"ado_team_name" bson:"ado_team_name"` AsanaProjectName string `json:"asana_project_name" bson:"asana_project_name"` AsanaWorkspaceName string `json:"asana_workspace_name" bson:"asana_workspace_name"` }
Project represents a project with its corresponding names in ADO and Asana.
Click to show internal directories.
Click to hide internal directories.