當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Scanner.Scan方法代碼示例

本文整理匯總了Golang中github.com/flynn/flynn/pkg/postgres.Scanner.Scan方法的典型用法代碼示例。如果您正苦於以下問題:Golang Scanner.Scan方法的具體用法?Golang Scanner.Scan怎麽用?Golang Scanner.Scan使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/flynn/flynn/pkg/postgres.Scanner的用法示例。


在下文中一共展示了Scanner.Scan方法的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
}
開發者ID:eldarion-gondor,項目名稱:cli,代碼行數:30,代碼來源:formation.go

示例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
}
開發者ID:devick,項目名稱:flynn,代碼行數:33,代碼來源:formation.go

示例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
}
開發者ID:imjorge,項目名稱:flynn,代碼行數:29,代碼來源:jobs.go

示例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
}
開發者ID:devick,項目名稱:flynn,代碼行數:8,代碼來源:artifact.go

示例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
}
開發者ID:devick,項目名稱:flynn,代碼行數:8,代碼來源:provider.go

示例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
}
開發者ID:suifing,項目名稱:flynn,代碼行數:8,代碼來源:key.go

示例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
}
開發者ID:josephwinston,項目名稱:flynn,代碼行數:9,代碼來源:artifact.go

示例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
}
開發者ID:ably-forks,項目名稱:flynn,代碼行數:10,代碼來源:artifact.go

示例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
}
開發者ID:devick,項目名稱:flynn,代碼行數:11,代碼來源:formation.go

示例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
}
開發者ID:solotzg,項目名稱:flynn,代碼行數:11,代碼來源:jobs.go

示例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
}
開發者ID:josephwinston,項目名稱:flynn,代碼行數:13,代碼來源:jobs.go

示例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
}
開發者ID:qiukeren,項目名稱:flynn,代碼行數:13,代碼來源:jobs.go

示例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
}
開發者ID:ably-forks,項目名稱:flynn,代碼行數:14,代碼來源:resource.go

示例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
}
開發者ID:rikur,項目名稱:flynn,代碼行數:14,代碼來源:app.go

示例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
}
開發者ID:caputomarcos,項目名稱:flynn,代碼行數:15,代碼來源:formation.go


注:本文中的github.com/flynn/flynn/pkg/postgres.Scanner.Scan方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。