package domain //import "io" type BogFileService struct { user_agent_repo UserAgentRepository file_data_repo FileDataRepository } func (b BogFileService) CreateOrOpenInFile(ref FileReference) (BogInFile ,error) { user_agent, err := b.user_agent_repo.GetByName(ref.UserAgent) f, err := b.file_data_repo.Create(ref.Path, string(user_agent.ID)) if err != nil { return nil, err } return f, err } func (b BogFileService) OpenOutFile(ref FileReference) (BogOutFile, error) { user_agent, err := b.user_agent_repo.GetByName(ref.UserAgent) f, err := b.file_data_repo.Open(ref.Path, string(user_agent.ID)) if err != nil { return nil, err } return f, nil }