本文整理匯總了Golang中github.com/flynn/flynn/pkg/postgres.Scanner類的典型用法代碼示例。如果您正苦於以下問題:Golang Scanner類的具體用法?Golang Scanner怎麽用?Golang Scanner使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Scanner類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: scanExpandedFormation
func scanExpandedFormation(s postgres.Scanner) (*ct.ExpandedFormation, error) {
f := &ct.ExpandedFormation{
App: &ct.App{},
Release: &ct.Release{},
}
var artifactIDs string
err := s.Scan(
&f.App.ID,
&f.App.Name,
&f.App.Meta,
&f.Release.ID,
&artifactIDs,
&f.Release.Meta,
&f.Release.Env,
&f.Release.Processes,
&f.Processes,
&f.Tags,
&f.UpdatedAt,
)
if err != nil {
if err == pgx.ErrNoRows {
err = ErrNotFound
}
return nil, err
}
if artifactIDs != "" {
f.Release.ArtifactIDs = split(artifactIDs[1:len(artifactIDs)-1], ",")
}
return f, nil
}
示例2: scanExpandedFormation
func scanExpandedFormation(s postgres.Scanner) (*ct.ExpandedFormation, error) {
f := &ct.ExpandedFormation{
App: &ct.App{},
Release: &ct.Release{},
Artifact: &ct.Artifact{},
}
var artifactID *string
err := s.Scan(
&f.App.ID,
&f.App.Name,
&f.Release.ID,
&artifactID,
&f.Release.Meta,
&f.Release.Env,
&f.Release.Processes,
&f.Artifact.ID,
&f.Artifact.Type,
&f.Artifact.URI,
&f.Processes,
&f.Tags,
&f.UpdatedAt,
)
if err != nil {
if err == pgx.ErrNoRows {
err = ErrNotFound
}
return nil, err
}
if artifactID != nil {
f.Release.ArtifactID = *artifactID
}
return f, nil
}
示例3: scanJob
func scanJob(s postgres.Scanner) (*ct.Job, error) {
job := &ct.Job{}
var state string
err := s.Scan(
&job.ID,
&job.UUID,
&job.HostID,
&job.AppID,
&job.ReleaseID,
&job.Type,
&state,
&job.Meta,
&job.ExitStatus,
&job.HostError,
&job.RunAt,
&job.Restarts,
&job.CreatedAt,
&job.UpdatedAt,
&job.Args,
)
if err != nil {
if err == pgx.ErrNoRows {
err = ErrNotFound
}
return nil, err
}
job.State = ct.JobState(state)
return job, nil
}
示例4: scanArtifact
func scanArtifact(s postgres.Scanner) (*ct.Artifact, error) {
artifact := &ct.Artifact{}
err := s.Scan(&artifact.ID, &artifact.Type, &artifact.URI, &artifact.CreatedAt)
if err == pgx.ErrNoRows {
err = ErrNotFound
}
return artifact, err
}
示例5: scanProvider
func scanProvider(s postgres.Scanner) (*ct.Provider, error) {
p := &ct.Provider{}
err := s.Scan(&p.ID, &p.Name, &p.URL, &p.CreatedAt, &p.UpdatedAt)
if err == pgx.ErrNoRows {
err = ErrNotFound
}
return p, err
}
示例6: scanKey
func scanKey(s postgres.Scanner) (*ct.Key, error) {
key := &ct.Key{}
err := s.Scan(&key.ID, &key.Key, &key.Comment, &key.CreatedAt)
if err == sql.ErrNoRows {
err = ErrNotFound
}
return key, err
}
示例7: scanArtifact
func scanArtifact(s postgres.Scanner) (*ct.Artifact, error) {
artifact := &ct.Artifact{}
err := s.Scan(&artifact.ID, &artifact.Type, &artifact.URI, &artifact.CreatedAt)
if err == sql.ErrNoRows {
err = ErrNotFound
}
artifact.ID = postgres.CleanUUID(artifact.ID)
return artifact, err
}
示例8: scanArtifact
func scanArtifact(s postgres.Scanner) (*ct.Artifact, error) {
artifact := &ct.Artifact{}
var typ string
err := s.Scan(&artifact.ID, &typ, &artifact.URI, &artifact.Meta, &artifact.CreatedAt)
if err == pgx.ErrNoRows {
err = ErrNotFound
}
artifact.Type = host.ArtifactType(typ)
return artifact, err
}
示例9: scanFormation
func scanFormation(s postgres.Scanner) (*ct.Formation, error) {
f := &ct.Formation{}
err := s.Scan(&f.AppID, &f.ReleaseID, &f.Processes, &f.Tags, &f.CreatedAt, &f.UpdatedAt)
if err != nil {
if err == pgx.ErrNoRows {
err = ErrNotFound
}
return nil, err
}
return f, err
}
示例10: scanJob
func scanJob(s postgres.Scanner) (*ct.Job, error) {
job := &ct.Job{}
err := s.Scan(&job.ID, &job.AppID, &job.ReleaseID, &job.Type, &job.State, &job.Meta, &job.CreatedAt, &job.UpdatedAt)
if err != nil {
if err == pgx.ErrNoRows {
err = ErrNotFound
}
return nil, err
}
return job, nil
}
示例11: scanJobEvent
func scanJobEvent(s postgres.Scanner) (*ct.JobEvent, error) {
event := &ct.JobEvent{}
err := s.Scan(&event.ID, &event.JobID, &event.AppID, &event.ReleaseID, &event.Type, &event.State, &event.CreatedAt)
if err != nil {
if err == sql.ErrNoRows {
err = ErrNotFound
}
return nil, err
}
event.AppID = postgres.CleanUUID(event.AppID)
event.ReleaseID = postgres.CleanUUID(event.ReleaseID)
return event, nil
}
示例12: scanJob
func scanJob(s postgres.Scanner) (*ct.Job, error) {
job := &ct.Job{}
var meta []byte
err := s.Scan(&job.ID, &job.AppID, &job.ReleaseID, &job.Type, &job.State, &meta, &job.CreatedAt, &job.UpdatedAt)
if err != nil {
if err == sql.ErrNoRows {
err = ErrNotFound
}
return nil, err
}
err = json.Unmarshal(meta, &job.Meta)
return job, nil
}
示例13: scanResource
func scanResource(s postgres.Scanner) (*ct.Resource, error) {
r := &ct.Resource{}
var appIDs string
err := s.Scan(&r.ID, &r.ProviderID, &r.ExternalID, &r.Env, &appIDs, &r.CreatedAt)
if err == pgx.ErrNoRows {
return nil, ErrNotFound
} else if err != nil {
return nil, err
}
if appIDs != "" {
r.Apps = split(appIDs[1:len(appIDs)-1], ",")
}
return r, err
}
示例14: scanApp
func scanApp(s postgres.Scanner) (*ct.App, error) {
app := &ct.App{}
var releaseID *string
err := s.Scan(&app.ID, &app.Name, &app.Meta, &app.Strategy, &releaseID, &app.CreatedAt, &app.UpdatedAt)
if err == pgx.ErrNoRows {
return nil, ErrNotFound
} else if err != nil {
return nil, err
}
if releaseID != nil {
app.ReleaseID = *releaseID
}
return app, err
}
示例15: scanFormation
func scanFormation(s postgres.Scanner) (*ct.Formation, error) {
f := &ct.Formation{}
var procs []byte
err := s.Scan(&f.AppID, &f.ReleaseID, &procs, &f.CreatedAt, &f.UpdatedAt)
if err != nil {
if err == sql.ErrNoRows {
err = ErrNotFound
}
return nil, err
}
if len(procs) > 0 {
err = json.Unmarshal(procs, &f.Processes)
}
return f, err
}