commits

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetch

func Fetch(c *gin.Context)

func GetLastID added in v0.0.5

func GetLastID(ctx context.Context, projectID, dsn, owner, repository string) (int64, int64, error)

func Items added in v0.0.6

func Items(owner, repository string, p dataset.PullReq, list []*github.RepositoryCommit) []interface{}
Example
package main

import (
	"fmt"
	"time"

	"github.com/google/go-github/v40/github"
	"github.com/itsubaki/fourkeys/dataset"
	"github.com/itsubaki/fourkeys/handler/pullreqs/commits"
)

func main() {
	items := commits.Items("itsubaki", "fourkeys", dataset.PullReq{
		ID: 1234,
	}, []*github.RepositoryCommit{
		{
			SHA: github.String("1234567890"),
			Commit: &github.Commit{
				Committer: &github.CommitAuthor{
					Date: &time.Time{},
				},
			},
		},
	})

	for _, item := range items {
		c := item.(dataset.PullReqCommit)
		fmt.Printf("%v %v\n", c.ID, c.SHA)
	}

}
Output:

1234 1234567890

func ListPullReqs

func ListPullReqs(ctx context.Context, projectID, dsn, owner, repository string, lastID int64, limit string) ([]dataset.PullReq, error)
Example
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/itsubaki/fourkeys/handler/pullreqs/commits"
)

func main() {
	prs, err := commits.ListPullReqs(context.Background(), os.Getenv("PROJECT_ID"), os.Getenv("DATASET_NAME"), "itsubaki", "fourkeys", 0, "5")
	if err != nil {
		log.Fatalf("list pullreqs: %v", err)
	}

	for _, pr := range prs {
		fmt.Printf("%v(%v)\n", pr.ID, pr.Number)
	}

}
Output:

955942047(1)
956961787(2)
971456366(4)
1058764804(5)
1066891742(6)

Types

This section is empty.

Jump to

Keyboard shortcuts

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