You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: user_terms_of_service.go
    path of file: ./repos/mattermost/server/channels/store/sqlstore
    
    the code of the file until where you have to start completion: // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

package sqlstore

import (
	"database/sql"

	"github.com/pkg/errors"

	"github.com/mattermost/mattermost/server/public/model"
	"github.com/mattermost/mattermost/server/v8/channels/store"
)

type SqlUserTermsOfServiceStore struct {
	*SqlStore
}

func newSqlUserTermsOfServiceStore(sqlStore *Sq
    
func (s SqlUserTermsOfServiceStore) GetByUser(userId string) (*model.UserTermsOfService, error) {
	var userTermsOfService model.UserTermsOfService
	query := `
		SELECT * 
		FROM UserTermsOfService 
		WHERE UserId = ?
	`
	if err := s.GetReplicaX().Get(&userTermsOfService, query, userId); err != nil {
		if err == sql.ErrNoRows {
			return nil, store.NewErrNotFound("UserTermsOfService", "userId="+userId)
		}

		return nil, errors.Wrapf(err, "failed to get UserTermsOfService with userId=%s", userId)
	}

	return &userTermsOfService, nil
}