postgres

package
v0.0.0-...-44748d9 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const NoParentClubID = 0

Variables

View Source
var (
	TextPostgresUniqueConstraintViolation = "postgres unique constraint violation"
	TextPostgresForeignKeyViolation       = "postgres foreign key violation"
	TextPostgresNotFoundError             = "postgres not found error"
	TextPostgresUnknownError              = "postgres unknown error"
)
View Source
var (
	ErrPostgresUniqueConstraintViolation = errors.New(TextPostgresUniqueConstraintViolation)
	ErrPostgresForeignKeyViolation       = errors.New(TextPostgresForeignKeyViolation)
	ErrPostgresUnknownError              = errors.New(TextPostgresUnknownError)
	ErrPostgresNotFoundError             = errors.New(TextPostgresNotFoundError)
)

Functions

This section is empty.

Types

type Postgres

type Postgres struct {
	// contains filtered or unexported fields
}

func NewPostgres

func NewPostgres(databaseURL string) (*Postgres, error)

func (*Postgres) AddClub

func (s *Postgres) AddClub(_ context.Context, c *domain.Club) (int, error)

func (*Postgres) AddClubPhotos

func (s *Postgres) AddClubPhotos(_ context.Context, p []domain.ClubPhoto) error

func (*Postgres) AddDefaultMedia

func (p *Postgres) AddDefaultMedia(ctx context.Context, mediaID int) (int, error)

func (*Postgres) AddMediaFile

func (p *Postgres) AddMediaFile(name, key string) (int, error)

func (*Postgres) AddMember

func (p *Postgres) AddMember(ctx context.Context, mem *domain.Member) (int, error)

func (*Postgres) AddOrgs

func (s *Postgres) AddOrgs(_ context.Context, orgs []domain.ClubOrg) error

func (*Postgres) DeleteClubPhoto

func (s *Postgres) DeleteClubPhoto(_ context.Context, id int) error

func (*Postgres) DeleteClubWithOrgs

func (s *Postgres) DeleteClubWithOrgs(_ context.Context, clubID int) error

func (*Postgres) DeleteDefaultMedia

func (p *Postgres) DeleteDefaultMedia(ctx context.Context, id int) error

func (*Postgres) DeleteDocument

func (p *Postgres) DeleteDocument(ctx context.Context, id int) (string, error)

func (*Postgres) DeleteDocumentCategory

func (p *Postgres) DeleteDocumentCategory(_ context.Context, id int) error

func (*Postgres) DeleteEncounter

func (p *Postgres) DeleteEncounter(_ context.Context, id int) error

func (*Postgres) DeleteEvent

func (p *Postgres) DeleteEvent(_ context.Context, id int) error

func (*Postgres) DeleteFeed

func (p *Postgres) DeleteFeed(_ context.Context, id int) error

func (*Postgres) DeleteMediaFile

func (p *Postgres) DeleteMediaFile(id int) error

func (*Postgres) DeleteMediaFiles

func (p *Postgres) DeleteMediaFiles(ctx context.Context, keys []string) error

func (*Postgres) DeleteMember

func (p *Postgres) DeleteMember(ctx context.Context, id int) error

func (*Postgres) GetActiveMainVideo

func (p *Postgres) GetActiveMainVideo(ctx context.Context) (*domain.MainVideo, error)

func (*Postgres) GetAllClub

func (s *Postgres) GetAllClub(_ context.Context) ([]domain.Club, error)

func (*Postgres) GetAllClubOrgs

func (s *Postgres) GetAllClubOrgs(_ context.Context) ([]domain.ClubOrg, error)

func (*Postgres) GetAllDefaultMedia

func (p *Postgres) GetAllDefaultMedia(ctx context.Context) ([]domain.DefaultMedia, error)

func (*Postgres) GetAllDocumentCategories

func (p *Postgres) GetAllDocumentCategories(_ context.Context) ([]domain.DocumentCategory, error)

func (*Postgres) GetAllDocumentKeys

func (p *Postgres) GetAllDocumentKeys(_ context.Context) ([]string, error)

func (*Postgres) GetAllDocuments

func (p *Postgres) GetAllDocuments(_ context.Context) ([]domain.Document, error)

func (*Postgres) GetAllEvents

func (p *Postgres) GetAllEvents(_ context.Context) ([]domain.Event, error)

func (*Postgres) GetAllFeed

func (p *Postgres) GetAllFeed(_ context.Context) ([]domain.Feed, error)

func (*Postgres) GetAllMediaKeys

func (p *Postgres) GetAllMediaKeys(ctx context.Context) ([]string, error)

func (*Postgres) GetAllMembers

func (p *Postgres) GetAllMembers(_ context.Context) ([]domain.Member, error)

func (*Postgres) GetClub

func (pgs *Postgres) GetClub(_ context.Context, id int) (*domain.Club, error)

func (*Postgres) GetClubMediaFiles

func (s *Postgres) GetClubMediaFiles(clubID int) ([]domain.ClubPhoto, error)

func (*Postgres) GetClubOrgs

func (s *Postgres) GetClubOrgs(_ context.Context, clubID int) ([]domain.ClubOrg, error)

func (*Postgres) GetClubSubOrgs

func (s *Postgres) GetClubSubOrgs(_ context.Context, clubID int) ([]domain.ClubOrg, error)

func (*Postgres) GetClubsByName

func (s *Postgres) GetClubsByName(_ context.Context, name string) ([]domain.Club, error)

func (*Postgres) GetClubsByType

func (s *Postgres) GetClubsByType(_ context.Context, type_ string) ([]domain.Club, error)

func (*Postgres) GetClubsOrgs

func (s *Postgres) GetClubsOrgs(_ context.Context, clubIDs []int) ([]domain.ClubOrg, error)

func (*Postgres) GetDefautlMedia

func (p *Postgres) GetDefautlMedia(ctx context.Context, id int) (*domain.DefaultMedia, error)

func (*Postgres) GetDocument

func (p *Postgres) GetDocument(_ context.Context, id int) (*domain.Document, error)

func (*Postgres) GetDocumentCategory

func (p *Postgres) GetDocumentCategory(_ context.Context, id int) (*domain.DocumentCategory, error)

func (*Postgres) GetDocumentsByCategory

func (p *Postgres) GetDocumentsByCategory(_ context.Context, categoryID int) ([]domain.Document, error)

func (*Postgres) GetDocumentsByClubID

func (p *Postgres) GetDocumentsByClubID(_ context.Context, clubID int) ([]domain.Document, error)

func (*Postgres) GetEvent

func (p *Postgres) GetEvent(_ context.Context, id int) (*domain.Event, error)

func (*Postgres) GetEventsByRange

func (p *Postgres) GetEventsByRange(_ context.Context, from, to time.Time) ([]domain.Event, error)

func (*Postgres) GetFeed

func (p *Postgres) GetFeed(_ context.Context, id int) (*domain.Feed, error)

func (*Postgres) GetFeedByTitle

func (p *Postgres) GetFeedByTitle(_ context.Context, title string) ([]domain.Feed, error)

func (*Postgres) GetFeedEncounters

func (p *Postgres) GetFeedEncounters(_ context.Context, id int) ([]domain.Encounter, error)

func (*Postgres) GetMediaFile

func (p *Postgres) GetMediaFile(id int) (*domain.MediaFile, error)

func (*Postgres) GetMediaFileByKey

func (p *Postgres) GetMediaFileByKey(ctx context.Context, key string) (*domain.MediaFile, error)

func (*Postgres) GetMediaFiles

func (p *Postgres) GetMediaFiles(ids []int) (map[int]domain.MediaFile, error)

func (*Postgres) GetMember

func (p *Postgres) GetMember(ctx context.Context, id int) (*domain.Member, error)

func (*Postgres) GetMemberByLogin

func (p *Postgres) GetMemberByLogin(_ context.Context, login string) (*domain.Member, error)

func (*Postgres) GetMemberHash

func (p *Postgres) GetMemberHash(_ context.Context, login string) (string, error)

func (*Postgres) GetMembersByName

func (p *Postgres) GetMembersByName(_ context.Context, name string) ([]domain.Member, error)

func (*Postgres) GetPhotoClubID

func (s *Postgres) GetPhotoClubID(_ context.Context, photoID int) (int, error)

func (*Postgres) GetRandomDefaultMedia

func (p *Postgres) GetRandomDefaultMedia(ctx context.Context) (*domain.DefaultMedia, error)

func (*Postgres) GetUnusedMedia

func (p *Postgres) GetUnusedMedia(ctx context.Context) ([]domain.MediaFile, error)

func (*Postgres) PostDocument

func (p *Postgres) PostDocument(ctx context.Context, name, key string, clubId, categoryId int) error

func (*Postgres) PostDocumentCategory

func (p *Postgres) PostDocumentCategory(_ context.Context, cat *domain.DocumentCategory) error

func (*Postgres) PostEncounter

func (p *Postgres) PostEncounter(_ context.Context, enc *domain.Encounter) error

func (*Postgres) PostEvent

func (p *Postgres) PostEvent(_ context.Context, event *domain.Event) error

func (*Postgres) PostFeed

func (p *Postgres) PostFeed(_ context.Context, feed *domain.Feed) error

func (*Postgres) PostMember

func (p *Postgres) PostMember(ctx context.Context, member *domain.Member) error

func (*Postgres) UpdateClub

func (s *Postgres) UpdateClub(_ context.Context, c *domain.Club, o []domain.ClubOrg) error

func (*Postgres) UpdateClubPhotos

func (s *Postgres) UpdateClubPhotos(_ context.Context, clubID int, p []domain.ClubPhoto) error

func (*Postgres) UpdateDefaultMedia

func (p *Postgres) UpdateDefaultMedia(ctx context.Context, id, mediaID int) error

func (*Postgres) UpdateDocument

func (p *Postgres) UpdateDocument(ctx context.Context, id int, name, key string, clubId, categoryId int) (string, error)

func (*Postgres) UpdateDocumentCategory

func (p *Postgres) UpdateDocumentCategory(_ context.Context, cat *domain.DocumentCategory) error

func (*Postgres) UpdateEncounter

func (p *Postgres) UpdateEncounter(_ context.Context, enc *domain.Encounter) error

func (*Postgres) UpdateEvent

func (p *Postgres) UpdateEvent(_ context.Context, event *domain.Event) error

func (*Postgres) UpdateFeed

func (p *Postgres) UpdateFeed(_ context.Context, feed *domain.Feed) error

func (*Postgres) UpdateMediaFile

func (p *Postgres) UpdateMediaFile(id int, name, key string) error

func (*Postgres) UpdateMember

func (p *Postgres) UpdateMember(ctx context.Context, member *domain.Member) error

Jump to

Keyboard shortcuts

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